(svn r25012) -Codechange: persistently keep 'reserved' cargo (for full-load improved loading) instead of calculating if for every cycle

This commit is contained in:
rubidium
2013-02-17 14:54:50 +00:00
parent c62cbe04a4
commit 7dd2354a13
12 changed files with 614 additions and 335 deletions

View File

@@ -34,13 +34,7 @@ public:
*/
uint MaxMove() { return this->max_move; }
/**
* Removes some cargo.
* @param cp Packet to be removed.
* @return True if the packet was completely delivered, false if only part of
* it was.
*/
inline bool operator()(CargoPacket *cp) { return this->Postprocess(cp, this->Preprocess(cp)); }
bool operator()(CargoPacket *cp);
};
/** Action of final delivery of cargo. */
@@ -95,6 +89,22 @@ public:
bool operator()(CargoPacket *cp);
};
/** Action of reserving cargo from a station to be loaded onto a vehicle. */
class CargoReservation: public CargoLoad {
public:
CargoReservation(StationCargoList *source, VehicleCargoList *destination, uint max_move, TileIndex load_place) :
CargoLoad(source, destination, max_move, load_place) {}
bool operator()(CargoPacket *cp);
};
/** Action of returning previously reserved cargo from the vehicle to the station. */
class CargoReturn: public CargoMovement<VehicleCargoList, StationCargoList> {
public:
CargoReturn(VehicleCargoList *source, StationCargoList *destination, uint max_move) :
CargoMovement<VehicleCargoList, StationCargoList>(source, destination, max_move) {}
bool operator()(CargoPacket *cp);
};
/** Action of shifting cargo from one vehicle to another. */
class CargoShift : public CargoMovement<VehicleCargoList, VehicleCargoList> {
public: