diff options
Diffstat (limited to 'src/industry.h')
-rw-r--r-- | src/industry.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/industry.h b/src/industry.h index f462cf482..e82033dd1 100644 --- a/src/industry.h +++ b/src/industry.h @@ -62,6 +62,7 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> { PartOfSubsidy part_of_subsidy; ///< NOSAVE: is this industry a source/destination of a subsidy? StationList stations_near; ///< NOSAVE: List of nearby stations. + mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the industry Owner founder; ///< Founder of the industry Date construction_date; ///< Date of the construction of the industry @@ -157,10 +158,21 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> { memset(&counts, 0, sizeof(counts)); } + inline const char *GetCachedName() const + { + if (this->cached_name.empty()) this->FillCachedName(); + return this->cached_name.c_str(); + } + +private: + void FillCachedName() const; + protected: static uint16 counts[NUM_INDUSTRYTYPES]; ///< Number of industries per type ingame }; +void ClearAllIndustryCachedNames(); + void PlantRandomFarmField(const Industry *i); void ReleaseDisastersTargetingIndustry(IndustryID); |