VarAction2: Cache current town industry counts/distances for var 67/68

This commit is contained in:
Jonathan G Rennison
2023-12-23 20:59:12 +00:00
parent 48f66306e5
commit f57088b261
2 changed files with 23 additions and 0 deletions

View File

@@ -16,6 +16,11 @@ struct IndustryLocationDistanceCache {
uint16 distances[NUM_INDUSTRYTYPES];
};
struct IndustryLocationDistanceAndCountCache {
uint16 distances[NUM_INDUSTRYTYPES];
uint8 counts[NUM_INDUSTRYTYPES];
};
/** Resolver for industry scopes. */
struct IndustriesScopeResolver : public ScopeResolver {
TileIndex tile; ///< Tile owned by the industry.
@@ -24,6 +29,7 @@ struct IndustriesScopeResolver : public ScopeResolver {
IndustryType type; ///< Type of the industry.
mutable std::unique_ptr<IndustryLocationDistanceCache> location_distance_cache;
mutable std::unique_ptr<IndustryLocationDistanceAndCountCache> town_location_distance_cache;
/**
* Scope resolver for industries.