BrokenRegistry / Rotp-Fusion

Other
22 stars 4 forks source link

Move common features of ShipFleet and Transport into base class #16

Closed dHannasch closed 11 months ago

dHannasch commented 12 months ago

This de-duplicates some of the common features of ShipFleet and Transport into a new base class, which I am imaginatively calling FleetBase. (There might be a better name.)

This also extracts travelTurnsRemaining() into the interface Ship.

(For the moment, Ship and FleetBase are technically unrelated.)

This also makes Transport.setDest() always call setArrivalTime() immediately, instead of waiting for the Transport to be launched. This does change governor behavior: previously the governor tried to take account of incoming transports when deciding Ecology spending, but if a transport from a neighboring colony would only take one turn to arrive, then it would never be taken account of, because the arrival time for that transport had not been set (because previously the arrival time for a Transport was only set when it was launched). However, I don't think the arrival time of a not-yet-launched transport was ever used except by the governor. In any case, if any part of the code does query the arrival time of a not-yet-launched transport, it seems more correct to provide the most likely arrival time, instead of Float.MAX_VALUE.