diff options
author | fonsinchen <fonsinchen@openttd.org> | 2013-08-20 21:22:37 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2013-08-20 21:22:37 +0000 |
commit | 5e017b80008ca2e75d80de8a346bf91a6ce6364d (patch) | |
tree | d8389fc815525ca4bd6e7ff254aca6bbbd89d251 /src/vehicle_base.h | |
parent | 5c0b766ed95bd2d5557e1fa05dfc199ced5a18bf (diff) | |
download | openttd-5e017b80008ca2e75d80de8a346bf91a6ce6364d.tar.xz |
(svn r25737) -Codechange: move inner workings of RefreshNextHopsStats into separate function
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r-- | src/vehicle_base.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h index be3a4058f..4eecda6cc 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -23,6 +23,8 @@ #include "transport_type.h" #include "group_type.h" #include "base_consist.h" +#include <list> +#include <map> /** Vehicle status bits in #Vehicle::vehstatus. */ enum VehStatus { @@ -124,15 +126,33 @@ extern void FixOldVehicles(); struct GRFFile; +/** + * Simulated cargo type and capacity for prediction of future links. + */ +struct RefitDesc { + CargoID cargo; ///< Cargo type the vehicle will be carrying. + uint16 capacity; ///< Capacity the vehicle will have. + uint16 remaining; ///< Capacity remaining from before the previous refit. + RefitDesc(CargoID cargo, uint16 capacity, uint16 remaining) : + cargo(cargo), capacity(capacity), remaining(remaining) {} +}; + /** %Vehicle data structure. */ struct Vehicle : VehiclePool::PoolItem<&_vehicle_pool>, BaseVehicle, BaseConsist { private: + typedef std::list<RefitDesc> RefitList; + typedef std::map<CargoID, uint> CapacitiesMap; + Vehicle *next; ///< pointer to the next vehicle in the chain Vehicle *previous; ///< NOSAVE: pointer to the previous vehicle in the chain Vehicle *first; ///< NOSAVE: pointer to the first vehicle in the chain Vehicle *next_shared; ///< pointer to the next vehicle that shares the order Vehicle *previous_shared; ///< NOSAVE: pointer to the previous vehicle in the shared order chain + + void RefreshNextHopsStats(CapacitiesMap &capacities, + RefitList &refit_capacities, const Order *first, const Order *cur, + const Order *next, uint hops, bool was_refit, bool has_cargo); public: friend const SaveLoad *GetVehicleDescription(VehicleType vt); ///< So we can use private/protected variables in the saveload code friend void FixOldVehicles(); |