VarAction2: Cache refit capacity callback results which depend only on cargo

This commit is contained in:
Jonathan G Rennison
2022-06-06 18:34:30 +01:00
parent fcd9137a9f
commit 7a61b5d820
8 changed files with 109 additions and 7 deletions

View File

@@ -27,6 +27,11 @@ struct WagonOverride {
typedef Pool<Engine, EngineID, 64, 64000> EnginePool;
extern EnginePool _engine_pool;
struct EngineRefitCapacityValue {
CargoTypes cargoes;
uint32 capacity;
};
struct Engine : EnginePool::PoolItem<&_engine_pool> {
TinyString name; ///< Custom name of engine.
Date intro_date; ///< Date of introduction of the engine.
@@ -72,6 +77,8 @@ struct Engine : EnginePool::PoolItem<&_engine_pool> {
uint64 cb36_properties_used = UINT64_MAX;
btree::btree_map<const SpriteGroup *, uint64> sprite_group_cb36_properties_used;
std::unique_ptr<EngineRefitCapacityValue, FreeDeleter> refit_capacity_values;
Engine() {}
Engine(VehicleType type, EngineID base);
bool IsEnabled() const;