1
0
Fork 0

Codechange: remove transitional supports from the pool

pull/13584/head
Rubidium 2025-02-08 08:47:44 +01:00 committed by rubidium42
parent 576a96c685
commit af00b835a1
29 changed files with 48 additions and 63 deletions

View File

@ -22,7 +22,7 @@ using EngineRenewID = PoolID<uint16_t, struct EngineRenewIDTag, 64000, 0xFFFF>;
* placed here so the only exception to this rule, the saveload code, can use * placed here so the only exception to this rule, the saveload code, can use
* it. * it.
*/ */
using EngineRenewPool = Pool<EngineRenew, EngineRenewID, 16, EngineRenewID::End().base()>; using EngineRenewPool = Pool<EngineRenew, EngineRenewID, 16>;
extern EngineRenewPool _enginerenew_pool; extern EngineRenewPool _enginerenew_pool;
/** /**

View File

@ -16,7 +16,7 @@
#include "station_map.h" #include "station_map.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
typedef Pool<BaseStation, StationID, 32, StationID::End().base()> StationPool; typedef Pool<BaseStation, StationID, 32> StationPool;
extern StationPool _station_pool; extern StationPool _station_pool;
template <typename T> template <typename T>

View File

@ -25,7 +25,7 @@ using CargoPacketID = PoolID<uint32_t, struct CargoPacketIDTag, 0xFFF000, 0xFFFF
struct CargoPacket; struct CargoPacket;
/** Type of the pool for cargo packets for a little over 16 million packets. */ /** Type of the pool for cargo packets for a little over 16 million packets. */
using CargoPacketPool = Pool<CargoPacket, CargoPacketID, 1024, CargoPacketID::End().base(), PoolType::Normal, true, false>; using CargoPacketPool = Pool<CargoPacket, CargoPacketID, 1024, PoolType::Normal, true, false>;
/** The actual pool with cargo packets. */ /** The actual pool with cargo packets. */
extern CargoPacketPool _cargopacket_pool; extern CargoPacketPool _cargopacket_pool;

View File

@ -62,7 +62,7 @@ private:
std::vector<BitmapStorage> used_bitmap; std::vector<BitmapStorage> used_bitmap;
}; };
typedef Pool<Company, CompanyID, 1, CompanyID::End().base()> CompanyPool; typedef Pool<Company, CompanyID, 1> CompanyPool;
extern CompanyPool _company_pool; extern CompanyPool _company_pool;
/** Statically loadable part of Company pool item */ /** Statically loadable part of Company pool item */

View File

@ -23,8 +23,9 @@
* @param type The return type of the method. * @param type The return type of the method.
*/ */
#define DEFINE_POOL_METHOD(type) \ #define DEFINE_POOL_METHOD(type) \
template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type, bool Tcache, bool Tzero> \ template <class Titem, typename Tindex, size_t Tgrowth_step, PoolType Tpool_type, bool Tcache, bool Tzero> \
type Pool<Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero> requires std::is_base_of_v<PoolIDBase, Tindex> \
type Pool<Titem, Tindex, Tgrowth_step, Tpool_type, Tcache, Tzero>
/** /**
* Create a clean pool. * Create a clean pool.
@ -47,15 +48,15 @@ DEFINE_POOL_METHOD(inline)::Pool(const char *name) :
* Resizes the pool so 'index' can be addressed * Resizes the pool so 'index' can be addressed
* @param index index we will allocate later * @param index index we will allocate later
* @pre index >= this->size * @pre index >= this->size
* @pre index < Tmax_size * @pre index < MAX_SIZE
*/ */
DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index) DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index)
{ {
assert(index >= this->data.size()); assert(index >= this->data.size());
assert(index < Tmax_size); assert(index < MAX_SIZE);
size_t old_size = this->data.size(); size_t old_size = this->data.size();
size_t new_size = std::min(Tmax_size, Align(index + 1, Tgrowth_step)); size_t new_size = std::min(MAX_SIZE, Align(index + 1, Tgrowth_step));
this->data.resize(new_size); this->data.resize(new_size);
this->used_bitmap.resize(Align(new_size, BITMAP_SIZE) / BITMAP_SIZE); this->used_bitmap.resize(Align(new_size, BITMAP_SIZE) / BITMAP_SIZE);
@ -83,12 +84,12 @@ DEFINE_POOL_METHOD(inline size_t)::FindFirstFree()
assert(this->first_unused == this->data.size()); assert(this->first_unused == this->data.size());
if (this->first_unused < Tmax_size) { if (this->first_unused < MAX_SIZE) {
this->ResizeFor(this->first_unused); this->ResizeFor(this->first_unused);
return this->first_unused; return this->first_unused;
} }
assert(this->first_unused == Tmax_size); assert(this->first_unused == MAX_SIZE);
return NO_FREE_ITEM; return NO_FREE_ITEM;
} }
@ -124,12 +125,8 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index)
} }
this->data[index] = item; this->data[index] = item;
SetBit(this->used_bitmap[index / BITMAP_SIZE], index % BITMAP_SIZE); SetBit(this->used_bitmap[index / BITMAP_SIZE], index % BITMAP_SIZE);
if constexpr (std::is_base_of_v<PoolIDBase, Tindex>) { /* MSVC complains about casting to narrower type, so first cast to the base type... then to the strong type. */
/* MSVC complains about casting to narrower type, so first cast to the base type... then to the strong type. */ item->index = static_cast<Tindex>(static_cast<Tindex::BaseType>(index));
item->index = static_cast<Tindex>(static_cast<Tindex::BaseType>(index));
} else {
item->index = static_cast<Tindex>(index);
}
return item; return item;
} }
@ -164,8 +161,8 @@ DEFINE_POOL_METHOD(void *)::GetNew(size_t size)
*/ */
DEFINE_POOL_METHOD(void *)::GetNew(size_t size, size_t index) DEFINE_POOL_METHOD(void *)::GetNew(size_t size, size_t index)
{ {
if (index >= Tmax_size) { if (index >= MAX_SIZE) {
SlErrorCorruptFmt("{} index {} out of range ({})", this->name, index, Tmax_size); SlErrorCorruptFmt("{} index {} out of range ({})", this->name, index, MAX_SIZE);
} }
if (index >= this->data.size()) this->ResizeFor(index); if (index >= this->data.size()) this->ResizeFor(index);

View File

@ -124,27 +124,16 @@ private:
* @tparam Titem Type of the class/struct that is going to be pooled * @tparam Titem Type of the class/struct that is going to be pooled
* @tparam Tindex Type of the index for this pool * @tparam Tindex Type of the index for this pool
* @tparam Tgrowth_step Size of growths; if the pool is full increase the size by this amount * @tparam Tgrowth_step Size of growths; if the pool is full increase the size by this amount
* @tparam Tmax_size Maximum size of the pool
* @tparam Tpool_type Type of this pool * @tparam Tpool_type Type of this pool
* @tparam Tcache Whether to perform 'alloc' caching, i.e. don't actually free/malloc just reuse the memory * @tparam Tcache Whether to perform 'alloc' caching, i.e. don't actually free/malloc just reuse the memory
* @tparam Tzero Whether to zero the memory * @tparam Tzero Whether to zero the memory
* @warning when Tcache is enabled *all* instances of this pool's item must be of the same size. * @warning when Tcache is enabled *all* instances of this pool's item must be of the same size.
*/ */
template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PoolType::Normal, bool Tcache = false, bool Tzero = true> template <class Titem, typename Tindex, size_t Tgrowth_step, PoolType Tpool_type = PoolType::Normal, bool Tcache = false, bool Tzero = true>
requires std::is_base_of_v<PoolIDBase, Tindex>
struct Pool : PoolBase { struct Pool : PoolBase {
private:
/** Some helper functions to get the maximum value of the provided index. */
template <typename T>
static constexpr size_t GetMaxIndexValue(T) { return std::numeric_limits<T>::max(); }
template <typename T> requires std::is_enum_v<T>
static constexpr size_t GetMaxIndexValue(T) { return std::numeric_limits<std::underlying_type_t<T>>::max(); }
template <typename T> requires std::is_base_of_v<PoolIDBase, T>
static constexpr size_t GetMaxIndexValue(T) { return std::numeric_limits<typename T::BaseType>::max(); }
public: public:
/* Ensure the highest possible index, i.e. Tmax_size -1, is within the bounds of Tindex. */ static constexpr size_t MAX_SIZE = Tindex::End().base(); ///< Make template parameter accessible from outside
static_assert(Tmax_size - 1 <= GetMaxIndexValue(Tindex{}));
static constexpr size_t MAX_SIZE = Tmax_size; ///< Make template parameter accessible from outside
using BitmapStorage = size_t; using BitmapStorage = size_t;
static constexpr size_t BITMAP_SIZE = std::numeric_limits<BitmapStorage>::digits; static constexpr size_t BITMAP_SIZE = std::numeric_limits<BitmapStorage>::digits;
@ -194,7 +183,7 @@ public:
*/ */
inline bool CanAllocate(size_t n = 1) inline bool CanAllocate(size_t n = 1)
{ {
bool ret = this->items <= Tmax_size - n; bool ret = this->items <= MAX_SIZE - n;
#ifdef WITH_ASSERT #ifdef WITH_ASSERT
this->checked = ret ? n : 0; this->checked = ret ? n : 0;
#endif /* WITH_ASSERT */ #endif /* WITH_ASSERT */
@ -293,12 +282,12 @@ public:
* Base class for all PoolItems * Base class for all PoolItems
* @tparam Tpool The pool this item is going to be part of * @tparam Tpool The pool this item is going to be part of
*/ */
template <struct Pool<Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero> *Tpool> template <struct Pool<Titem, Tindex, Tgrowth_step, Tpool_type, Tcache, Tzero> *Tpool>
struct PoolItem { struct PoolItem {
Tindex index; ///< Index of this pool item Tindex index; ///< Index of this pool item
/** Type of the pool this item is going to be part of */ /** Type of the pool this item is going to be part of */
typedef struct Pool<Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero> Pool; typedef struct Pool<Titem, Tindex, Tgrowth_step, Tpool_type, Tcache, Tzero> Pool;
/** /**
* Allocates space for new Titem * Allocates space for new Titem
@ -472,7 +461,6 @@ private:
void FreeItem(size_t index); void FreeItem(size_t index);
/* Temporary helper functions to get the raw index from either strongly and non-strongly typed pool items. */
static constexpr size_t GetRawIndex(size_t index) { return index; } static constexpr size_t GetRawIndex(size_t index) { return index; }
template <typename T> requires std::is_base_of_v<PoolIDBase, T> template <typename T> requires std::is_base_of_v<PoolIDBase, T>
static constexpr size_t GetRawIndex(const T &index) { return index.base(); } static constexpr size_t GetRawIndex(const T &index) { return index.base(); }

View File

@ -14,7 +14,7 @@
#include "core/pool_type.hpp" #include "core/pool_type.hpp"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
typedef Pool<Depot, DepotID, 64, DepotID::End().base()> DepotPool; typedef Pool<Depot, DepotID, 64> DepotPool;
extern DepotPool _depot_pool; extern DepotPool _depot_pool;
struct Depot : DepotPool::PoolItem<&_depot_pool> { struct Depot : DepotPool::PoolItem<&_depot_pool> {

View File

@ -14,7 +14,7 @@
#include "company_type.h" #include "company_type.h"
/** Type of pool to store cargo payments in; little over 1 million. */ /** Type of pool to store cargo payments in; little over 1 million. */
using CargoPaymentPool = Pool<CargoPayment, CargoPaymentID, 512, CargoPaymentID::End().base()>; using CargoPaymentPool = Pool<CargoPayment, CargoPaymentID, 512>;
/** The actual pool to store cargo payments in. */ /** The actual pool to store cargo payments in. */
extern CargoPaymentPool _cargo_payment_pool; extern CargoPaymentPool _cargo_payment_pool;

View File

@ -32,7 +32,7 @@ enum class EngineDisplayFlag : uint8_t {
using EngineDisplayFlags = EnumBitSet<EngineDisplayFlag, uint8_t>; using EngineDisplayFlags = EnumBitSet<EngineDisplayFlag, uint8_t>;
typedef Pool<Engine, EngineID, 64, EngineID::End().base()> EnginePool; typedef Pool<Engine, EngineID, 64> EnginePool;
extern EnginePool _engine_pool; extern EnginePool _engine_pool;
struct Engine : EnginePool::PoolItem<&_engine_pool> { struct Engine : EnginePool::PoolItem<&_engine_pool> {

View File

@ -14,7 +14,7 @@
#include "goal_type.h" #include "goal_type.h"
#include "core/pool_type.hpp" #include "core/pool_type.hpp"
using GoalPool = Pool<Goal, GoalID, 64, GoalID::End().base()>; using GoalPool = Pool<Goal, GoalID, 64>;
extern GoalPool _goal_pool; extern GoalPool _goal_pool;
/** Struct about goals, current and completed */ /** Struct about goals, current and completed */

View File

@ -17,7 +17,7 @@
#include "engine_type.h" #include "engine_type.h"
#include "livery.h" #include "livery.h"
using GroupPool = Pool<Group, GroupID, 16, GroupID::End().base()>; using GroupPool = Pool<Group, GroupID, 16>;
extern GroupPool _group_pool; ///< Pool of groups. extern GroupPool _group_pool; ///< Pool of groups.
/** Statistics and caches on the vehicles in a group. */ /** Statistics and caches on the vehicles in a group. */

View File

@ -20,7 +20,7 @@
#include "timer/timer_game_economy.h" #include "timer/timer_game_economy.h"
typedef Pool<Industry, IndustryID, 64, IndustryID::End().base()> IndustryPool; typedef Pool<Industry, IndustryID, 64> IndustryPool;
extern IndustryPool _industry_pool; extern IndustryPool _industry_pool;
static const TimerGameEconomy::Year PROCESSING_INDUSTRY_ABANDONMENT_YEARS{5}; ///< If a processing industry doesn't produce for this many consecutive economy years, it may close. static const TimerGameEconomy::Year PROCESSING_INDUSTRY_ABANDONMENT_YEARS{5}; ///< If a processing industry doesn't produce for this many consecutive economy years, it may close.

View File

@ -17,10 +17,10 @@
bool IsValidLink(Link link); bool IsValidLink(Link link);
using LeagueTableElementPool = Pool<LeagueTableElement, LeagueTableElementID, 64, LeagueTableElementID::End().base()>; using LeagueTableElementPool = Pool<LeagueTableElement, LeagueTableElementID, 64>;
extern LeagueTableElementPool _league_table_element_pool; extern LeagueTableElementPool _league_table_element_pool;
using LeagueTablePool = Pool<LeagueTable, LeagueTableID, 4, LeagueTableID::End().base()>; using LeagueTablePool = Pool<LeagueTable, LeagueTableID, 4>;
extern LeagueTablePool _league_table_pool; extern LeagueTablePool _league_table_pool;

View File

@ -24,7 +24,7 @@ class LinkGraph;
* Type of the pool for link graph components. Each station can be in at up to * Type of the pool for link graph components. Each station can be in at up to
* 32 link graphs. So we allow for plenty of them to be created. * 32 link graphs. So we allow for plenty of them to be created.
*/ */
using LinkGraphPool = Pool<LinkGraph, LinkGraphID, 32, LinkGraphID::End().base()>; using LinkGraphPool = Pool<LinkGraph, LinkGraphID, 32>;
/** The actual pool with link graphs. */ /** The actual pool with link graphs. */
extern LinkGraphPool _link_graph_pool; extern LinkGraphPool _link_graph_pool;

View File

@ -19,7 +19,7 @@ class Path;
typedef std::list<Path *> PathList; typedef std::list<Path *> PathList;
/** Type of the pool for link graph jobs. */ /** Type of the pool for link graph jobs. */
using LinkGraphJobPool = Pool<LinkGraphJob, LinkGraphJobID, 32, LinkGraphJobID::End().base()>; using LinkGraphJobPool = Pool<LinkGraphJob, LinkGraphJobID, 32>;
/** The actual pool with link graph jobs. */ /** The actual pool with link graph jobs. */
extern LinkGraphJobPool _link_graph_job_pool; extern LinkGraphJobPool _link_graph_job_pool;

View File

@ -18,7 +18,7 @@ extern AdminID _redirect_console_to_admin;
class ServerNetworkAdminSocketHandler; class ServerNetworkAdminSocketHandler;
/** Pool with all admin connections. */ /** Pool with all admin connections. */
using NetworkAdminSocketPool = Pool<ServerNetworkAdminSocketHandler, AdminID, 2, AdminID::End().base(), PoolType::NetworkAdmin>; using NetworkAdminSocketPool = Pool<ServerNetworkAdminSocketHandler, AdminID, 2, PoolType::NetworkAdmin>;
extern NetworkAdminSocketPool _networkadminsocket_pool; extern NetworkAdminSocketPool _networkadminsocket_pool;
/** Class for handling the server side of the game connection. */ /** Class for handling the server side of the game connection. */

View File

@ -17,7 +17,7 @@
#include "../timer/timer_game_economy.h" #include "../timer/timer_game_economy.h"
/** Type for the pool with client information. */ /** Type for the pool with client information. */
using NetworkClientInfoPool = Pool<NetworkClientInfo, ClientPoolID, 8, ClientPoolID::End().base(), PoolType::NetworkClient>; using NetworkClientInfoPool = Pool<NetworkClientInfo, ClientPoolID, 8, PoolType::NetworkClient>;
extern NetworkClientInfoPool _networkclientinfo_pool; extern NetworkClientInfoPool _networkclientinfo_pool;
/** Container for all information known about a client. */ /** Container for all information known about a client. */

View File

@ -17,7 +17,7 @@ class ServerNetworkGameSocketHandler;
/** Make the code look slightly nicer/simpler. */ /** Make the code look slightly nicer/simpler. */
typedef ServerNetworkGameSocketHandler NetworkClientSocket; typedef ServerNetworkGameSocketHandler NetworkClientSocket;
/** Pool with all client sockets. */ /** Pool with all client sockets. */
using NetworkClientSocketPool = Pool<NetworkClientSocket, ClientPoolID, 8, ClientPoolID::End().base(), PoolType::NetworkClient>; using NetworkClientSocketPool = Pool<NetworkClientSocket, ClientPoolID, 8, PoolType::NetworkClient>;
extern NetworkClientSocketPool _networkclientsocket_pool; extern NetworkClientSocketPool _networkclientsocket_pool;
/** Class for handling the server side of the game connection. */ /** Class for handling the server side of the game connection. */

View File

@ -50,7 +50,7 @@ struct ResolverObject;
* Adding an 'extra' margin would be assuming 64 sprite groups per real * Adding an 'extra' margin would be assuming 64 sprite groups per real
* sprite. 64 = 2^6, so 2^30 should be enough (for now) */ * sprite. 64 = 2^6, so 2^30 should be enough (for now) */
using SpriteGroupID = PoolID<uint32_t, struct SpriteGroupIDTag, 1U << 30, 0xFFFFFFFF>; using SpriteGroupID = PoolID<uint32_t, struct SpriteGroupIDTag, 1U << 30, 0xFFFFFFFF>;
using SpriteGroupPool = Pool<SpriteGroup, SpriteGroupID, 1024, SpriteGroupID::End().base(), PoolType::Data>; using SpriteGroupPool = Pool<SpriteGroup, SpriteGroupID, 1024, PoolType::Data>;
extern SpriteGroupPool _spritegroup_pool; extern SpriteGroupPool _spritegroup_pool;
/* Common wrapper for all the different sprite group types */ /* Common wrapper for all the different sprite group types */

View File

@ -189,7 +189,7 @@ typedef PersistentStorageArray<int32_t, 16> OldPersistentStorage;
using PersistentStorageID = PoolID<uint32_t, struct PersistentStorageIDTag, 0xFF000, 0xFFFFF>; using PersistentStorageID = PoolID<uint32_t, struct PersistentStorageIDTag, 0xFF000, 0xFFFFF>;
struct PersistentStorage; struct PersistentStorage;
using PersistentStoragePool = Pool<PersistentStorage, PersistentStorageID, 1, PersistentStorageID::End().base()>; using PersistentStoragePool = Pool<PersistentStorage, PersistentStorageID, 1>;
extern PersistentStoragePool _persistent_storage_pool; extern PersistentStoragePool _persistent_storage_pool;

View File

@ -16,7 +16,7 @@
#include "town_type.h" #include "town_type.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
using ObjectPool = Pool<Object, ObjectID, 64, ObjectID::End().base()>; using ObjectPool = Pool<Object, ObjectID, 64>;
extern ObjectPool _object_pool; extern ObjectPool _object_pool;
/** An object, such as transmitter, on the map. */ /** An object, such as transmitter, on the map. */

View File

@ -22,7 +22,7 @@ using OrderBackupID = PoolID<uint8_t, struct OrderBackupIDTag, 255, 0xFF>;
struct OrderBackup; struct OrderBackup;
/** The pool type for order backups. */ /** The pool type for order backups. */
using OrderBackupPool = Pool<OrderBackup, OrderBackupID, 1, OrderBackupID::End().base()>; using OrderBackupPool = Pool<OrderBackup, OrderBackupID, 1>;
/** The pool with order backups. */ /** The pool with order backups. */
extern OrderBackupPool _order_backup_pool; extern OrderBackupPool _order_backup_pool;

View File

@ -20,8 +20,8 @@
#include "timer/timer_game_tick.h" #include "timer/timer_game_tick.h"
#include "saveload/saveload.h" #include "saveload/saveload.h"
using OrderPool = Pool<Order, OrderID, 256, OrderID::End().base()>; using OrderPool = Pool<Order, OrderID, 256>;
using OrderListPool = Pool<OrderList, OrderListID, 128, OrderListID::End().base()>; using OrderListPool = Pool<OrderList, OrderListID, 128>;
extern OrderPool _order_pool; extern OrderPool _order_pool;
extern OrderListPool _orderlist_pool; extern OrderListPool _orderlist_pool;

View File

@ -15,7 +15,7 @@
#include "core/bitmath_func.hpp" #include "core/bitmath_func.hpp"
#include "vehicle_type.h" #include "vehicle_type.h"
using RoadStopPool = Pool<RoadStop, RoadStopID, 32, RoadStopID::End().base()>; using RoadStopPool = Pool<RoadStop, RoadStopID, 32>;
extern RoadStopPool _roadstop_pool; extern RoadStopPool _roadstop_pool;
/** A Stop for a Road Vehicle */ /** A Stop for a Road Vehicle */

View File

@ -15,7 +15,7 @@
#include "core/pool_type.hpp" #include "core/pool_type.hpp"
#include "company_type.h" #include "company_type.h"
typedef Pool<Sign, SignID, 16, SignID::End().base()> SignPool; typedef Pool<Sign, SignID, 16> SignPool;
extern SignPool _sign_pool; extern SignPool _sign_pool;
struct Sign : SignPool::PoolItem<&_sign_pool> { struct Sign : SignPool::PoolItem<&_sign_pool> {

View File

@ -17,8 +17,8 @@
#include "vehicle_type.h" #include "vehicle_type.h"
#include "core/pool_type.hpp" #include "core/pool_type.hpp"
using StoryPageElementPool = Pool<StoryPageElement, StoryPageElementID, 64, StoryPageElementID::End().base()>; using StoryPageElementPool = Pool<StoryPageElement, StoryPageElementID, 64>;
using StoryPagePool = Pool<StoryPage, StoryPageID, 64, StoryPageID::End().base()>; using StoryPagePool = Pool<StoryPage, StoryPageID, 64>;
extern StoryPageElementPool _story_page_element_pool; extern StoryPageElementPool _story_page_element_pool;
extern StoryPagePool _story_page_pool; extern StoryPagePool _story_page_pool;
extern uint32_t _story_page_element_next_sort_value; extern uint32_t _story_page_element_next_sort_value;

View File

@ -16,7 +16,7 @@
#include "subsidy_type.h" #include "subsidy_type.h"
#include "core/pool_type.hpp" #include "core/pool_type.hpp"
using SubsidyPool = Pool<Subsidy, SubsidyID, 1, SubsidyID::End().base()>; using SubsidyPool = Pool<Subsidy, SubsidyID, 1>;
extern SubsidyPool _subsidy_pool; extern SubsidyPool _subsidy_pool;
/** Struct about subsidies, offered and awarded */ /** Struct about subsidies, offered and awarded */

View File

@ -33,7 +33,7 @@ static const uint TOWN_GROWTH_DESERT = 0xFFFFFFFF; ///< The town needs the cargo
static const uint16_t TOWN_GROWTH_RATE_NONE = 0xFFFF; ///< Special value for Town::growth_rate to disable town growth. static const uint16_t TOWN_GROWTH_RATE_NONE = 0xFFFF; ///< Special value for Town::growth_rate to disable town growth.
static const uint16_t MAX_TOWN_GROWTH_TICKS = 930; ///< Max amount of original town ticks that still fit into uint16_t, about equal to UINT16_MAX / TOWN_GROWTH_TICKS but slightly less to simplify calculations static const uint16_t MAX_TOWN_GROWTH_TICKS = 930; ///< Max amount of original town ticks that still fit into uint16_t, about equal to UINT16_MAX / TOWN_GROWTH_TICKS but slightly less to simplify calculations
typedef Pool<Town, TownID, 64, TownID::End().base()> TownPool; typedef Pool<Town, TownID, 64> TownPool;
extern TownPool _town_pool; extern TownPool _town_pool;
/** Data structure with cached data of towns. */ /** Data structure with cached data of towns. */

View File

@ -196,7 +196,7 @@ struct MutableSpriteCache {
}; };
/** A vehicle pool for a little over 1 million vehicles. */ /** A vehicle pool for a little over 1 million vehicles. */
typedef Pool<Vehicle, VehicleID, 512, VehicleID::End().base()> VehiclePool; typedef Pool<Vehicle, VehicleID, 512> VehiclePool;
extern VehiclePool _vehicle_pool; extern VehiclePool _vehicle_pool;
/* Some declarations of functions, so we can make them friendly */ /* Some declarations of functions, so we can make them friendly */