diff --git a/src/company_base.h b/src/company_base.h --- a/src/company_base.h +++ b/src/company_base.h @@ -49,6 +49,19 @@ struct CompanyInfrastructure { uint32_t GetTramTotal() const; }; +class FreeUnitIDGenerator { +public: + UnitID NextID() const; + UnitID UseID(UnitID index); + void ReleaseID(UnitID index); + +private: + using BitmapStorage = size_t; + static constexpr size_t BITMAP_SIZE = std::numeric_limits::digits; + + std::vector used_bitmap; +}; + typedef Pool CompanyPool; extern CompanyPool _company_pool; @@ -129,6 +142,8 @@ struct Company : CompanyProperties, Comp CompanyInfrastructure infrastructure; ///< NOSAVE: Counts of company owned infrastructure. + FreeUnitIDGenerator freeunits[VEH_COMPANY_END]; + Money GetMaxLoan() const; /**