Changeset - r11918:5a296c52d1a8
[Not reviewed]
master
0 26 0
smatz - 16 years ago 2009-05-16 23:44:36
smatz@openttd.org
(svn r16326) -Codechange: replace GetPoolItemPoolSize() by PoolItem::GetPoolSize()
26 files changed with 66 insertions and 62 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_core.cpp
Show inline comments
 
@@ -104,7 +104,7 @@
 
/* static */ void AI::KillAll()
 
{
 
	/* It might happen there are no companies .. than we have nothing to loop */
 
	if (GetCompanyPoolSize() == 0) return;
 
	if (Company::GetPoolSize() == 0) return;
 

	
 
	const Company *c;
 
	FOR_ALL_COMPANIES(c) {
src/autoreplace_base.h
Show inline comments
 
@@ -34,7 +34,7 @@ struct EngineRenew : PoolItem<EngineRene
 
	inline bool IsValid() const { return this->from != INVALID_ENGINE; }
 
};
 

	
 
#define FOR_ALL_ENGINE_RENEWS_FROM(er, start) for (er = EngineRenew::Get(start); er != NULL; er = (er->index + 1U < GetEngineRenewPoolSize()) ? EngineRenew::Get(er->index + 1U) : NULL) if (er->IsValid())
 
#define FOR_ALL_ENGINE_RENEWS_FROM(er, start) for (er = EngineRenew::Get(start); er != NULL; er = (er->index + 1U < EngineRenew::GetPoolSize()) ? EngineRenew::Get(er->index + 1U) : NULL) if (er->IsValid())
 
#define FOR_ALL_ENGINE_RENEWS(er) FOR_ALL_ENGINE_RENEWS_FROM(er, 0)
 

	
 
#endif /* AUTOREPLACE_BASE_H */
src/cargopacket.h
Show inline comments
 
@@ -63,7 +63,7 @@ struct CargoPacket : PoolItem<CargoPacke
 
 * @param cp    the variable used as "iterator"
 
 * @param start the cargo packet ID of the first packet to iterate over
 
 */
 
#define FOR_ALL_CARGOPACKETS_FROM(cp, start) for (cp = CargoPacket::Get(start); cp != NULL; cp = (cp->index + 1U < GetCargoPacketPoolSize()) ? CargoPacket::Get(cp->index + 1U) : NULL) if (cp->IsValid())
 
#define FOR_ALL_CARGOPACKETS_FROM(cp, start) for (cp = CargoPacket::Get(start); cp != NULL; cp = (cp->index + 1U < CargoPacket::GetPoolSize()) ? CargoPacket::Get(cp->index + 1U) : NULL) if (cp->IsValid())
 

	
 
/**
 
 * Iterate over all _valid_ cargo packets from the begin of the pool
src/cheat_gui.cpp
Show inline comments
 
@@ -43,7 +43,7 @@ static int32 ClickMoneyCheat(int32 p1, i
 
 */
 
static int32 ClickChangeCompanyCheat(int32 p1, int32 p2)
 
{
 
	while ((uint)p1 < GetCompanyPoolSize()) {
 
	while ((uint)p1 < Company::GetPoolSize()) {
 
		if (IsValidCompanyID((CompanyID)p1)) {
 
			SetLocalCompany((CompanyID)p1);
 
			return _local_company;
src/company_base.h
Show inline comments
 
@@ -87,10 +87,10 @@ struct Company : PoolItem<Company, Compa
 

	
 
static inline bool IsValidCompanyID(CompanyID company)
 
{
 
	return company < MAX_COMPANIES && (uint)company < GetCompanyPoolSize() && Company::Get(company)->IsValid();
 
	return company < MAX_COMPANIES && (uint)company < Company::GetPoolSize() && Company::Get(company)->IsValid();
 
}
 

	
 
#define FOR_ALL_COMPANIES_FROM(d, start) for (d = Company::Get(start); d != NULL; d = (d->index + 1U < GetCompanyPoolSize()) ? Company::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_COMPANIES_FROM(d, start) for (d = Company::Get(start); d != NULL; d = (d->index + 1U < Company::GetPoolSize()) ? Company::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_COMPANIES(d) FOR_ALL_COMPANIES_FROM(d, 0)
 

	
 
static inline byte ActiveCompanyCount()
src/company_cmd.cpp
Show inline comments
 
@@ -457,7 +457,7 @@ Company *DoStartupNewCompany(bool is_ai)
 

	
 
	if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index);
 

	
 
	c->num_engines = CallocT<uint16>(GetEnginePoolSize());
 
	c->num_engines = CallocT<uint16>(Engine::GetPoolSize());
 

	
 
	return c;
 
}
src/depot_base.h
Show inline comments
 
@@ -24,12 +24,12 @@ struct Depot : PoolItem<Depot, DepotID, 
 

	
 
static inline bool IsValidDepotID(DepotID index)
 
{
 
	return index < GetDepotPoolSize() && Depot::Get(index)->IsValid();
 
	return index < Depot::GetPoolSize() && Depot::Get(index)->IsValid();
 
}
 

	
 
Depot *GetDepotByTile(TileIndex tile);
 

	
 
#define FOR_ALL_DEPOTS_FROM(d, start) for (d = Depot::Get(start); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? Depot::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_DEPOTS_FROM(d, start) for (d = Depot::Get(start); d != NULL; d = (d->index + 1U < Depot::GetPoolSize()) ? Depot::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
 

	
 
#endif /* DEPOT_BASE_H */
src/engine.cpp
Show inline comments
 
@@ -356,7 +356,7 @@ EngineID EngineOverrideManager::GetID(Ve
 
 */
 
void SetCachedEngineCounts()
 
{
 
	uint engines = GetEnginePoolSize();
 
	uint engines = Engine::GetPoolSize();
 

	
 
	/* Set up the engine count for all companies */
 
	Company *c;
src/engine_base.h
Show inline comments
 
@@ -84,10 +84,10 @@ extern EngineOverrideManager _engine_mng
 

	
 
static inline bool IsEngineIndex(uint index)
 
{
 
	return index < GetEnginePoolSize();
 
	return index < Engine::GetPoolSize();
 
}
 

	
 
#define FOR_ALL_ENGINES_FROM(e, start) for (e = Engine::Get(start); e != NULL; e = (e->index + 1U < GetEnginePoolSize()) ? Engine::Get(e->index + 1U) : NULL) if (e->IsValid())
 
#define FOR_ALL_ENGINES_FROM(e, start) for (e = Engine::Get(start); e != NULL; e = (e->index + 1U < Engine::GetPoolSize()) ? Engine::Get(e->index + 1U) : NULL) if (e->IsValid())
 
#define FOR_ALL_ENGINES(e) FOR_ALL_ENGINES_FROM(e, 0)
 

	
 
#define FOR_ALL_ENGINES_OF_TYPE(e, engine_type) FOR_ALL_ENGINES(e) if (e->type == engine_type)
src/group.h
Show inline comments
 
@@ -32,7 +32,7 @@ struct Group : PoolItem<Group, GroupID, 
 

	
 
static inline bool IsValidGroupID(GroupID index)
 
{
 
	return index < GetGroupPoolSize() && Group::Get(index)->IsValid();
 
	return index < Group::GetPoolSize() && Group::Get(index)->IsValid();
 
}
 

	
 
static inline bool IsDefaultGroupID(GroupID index)
 
@@ -50,7 +50,7 @@ static inline bool IsAllGroupID(GroupID 
 
	return id_g == ALL_GROUP;
 
}
 

	
 
#define FOR_ALL_GROUPS_FROM(g, start) for (g = Group::Get(start); g != NULL; g = (g->index + 1U < GetGroupPoolSize()) ? Group::Get(g->index + 1) : NULL) if (g->IsValid())
 
#define FOR_ALL_GROUPS_FROM(g, start) for (g = Group::Get(start); g != NULL; g = (g->index + 1U < Group::GetPoolSize()) ? Group::Get(g->index + 1) : NULL) if (g->IsValid())
 
#define FOR_ALL_GROUPS(g) FOR_ALL_GROUPS_FROM(g, 0)
 

	
 
/**
src/group_cmd.cpp
Show inline comments
 
@@ -47,7 +47,7 @@ Group::Group(Owner owner)
 
{
 
	this->owner = owner;
 

	
 
	if (this->IsValid()) this->num_engines = CallocT<uint16>(GetEnginePoolSize());
 
	if (this->IsValid()) this->num_engines = CallocT<uint16>(Engine::GetPoolSize());
 
}
 

	
 
Group::~Group()
src/industry.h
Show inline comments
 
@@ -272,7 +272,7 @@ void SetIndustryDailyChanges();
 
 */
 
static inline bool IsValidIndustryID(IndustryID index)
 
{
 
	return index < GetIndustryPoolSize() && Industry::Get(index)->IsValid();
 
	return index < Industry::GetPoolSize() && Industry::Get(index)->IsValid();
 
}
 

	
 

	
 
@@ -283,7 +283,7 @@ static inline IndustryID GetMaxIndustryI
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetIndustryPoolSize() - 1;
 
	return Industry::GetPoolSize() - 1;
 
}
 

	
 
extern int _total_industries;  // general counter
 
@@ -355,7 +355,7 @@ static inline Industry *GetRandomIndustr
 
	return Industry::Get(index);
 
}
 

	
 
#define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = Industry::Get(start); i != NULL; i = (i->index + 1U < GetIndustryPoolSize()) ? Industry::Get(i->index + 1U) : NULL) if (i->IsValid())
 
#define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = Industry::Get(start); i != NULL; i = (i->index + 1U < Industry::GetPoolSize()) ? Industry::Get(i->index + 1U) : NULL) if (i->IsValid())
 
#define FOR_ALL_INDUSTRIES(i) FOR_ALL_INDUSTRIES_FROM(i, 0)
 

	
 
static const uint8 IT_INVALID = 255;
src/network/core/tcp_game.h
Show inline comments
 
@@ -110,10 +110,10 @@ public:
 

	
 
static inline bool IsValidNetworkClientSocketIndex(ClientIndex index)
 
{
 
	return (uint)index < GetNetworkClientSocketPoolSize() && NetworkClientSocket::Get(index)->IsValid();
 
	return (uint)index < NetworkClientSocket::GetPoolSize() && NetworkClientSocket::Get(index)->IsValid();
 
}
 

	
 
#define FOR_ALL_CLIENT_SOCKETS_FROM(d, start) for (d = NetworkClientSocket::Get(start); d != NULL; d = (d->index + 1U < GetNetworkClientSocketPoolSize()) ? NetworkClientSocket::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_CLIENT_SOCKETS_FROM(d, start) for (d = NetworkClientSocket::Get(start); d != NULL; d = (d->index + 1U < NetworkClientSocket::GetPoolSize()) ? NetworkClientSocket::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_CLIENT_SOCKETS(d) FOR_ALL_CLIENT_SOCKETS_FROM(d, 0)
 

	
 
#endif /* ENABLE_NETWORK */
src/network/network_base.h
Show inline comments
 
@@ -29,10 +29,10 @@ struct NetworkClientInfo : PoolItem<Netw
 

	
 
static inline bool IsValidNetworkClientInfoIndex(ClientIndex index)
 
{
 
	return (uint)index < GetNetworkClientInfoPoolSize() && NetworkClientInfo::Get(index)->IsValid();
 
	return (uint)index < NetworkClientInfo::GetPoolSize() && NetworkClientInfo::Get(index)->IsValid();
 
}
 

	
 
#define FOR_ALL_CLIENT_INFOS_FROM(d, start) for (d = NetworkClientInfo::Get(start); d != NULL; d = (d->index + 1U < GetNetworkClientInfoPoolSize()) ? NetworkClientInfo::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_CLIENT_INFOS_FROM(d, start) for (d = NetworkClientInfo::Get(start); d != NULL; d = (d->index + 1U < NetworkClientInfo::GetPoolSize()) ? NetworkClientInfo::Get(d->index + 1U) : NULL) if (d->IsValid())
 
#define FOR_ALL_CLIENT_INFOS(d) FOR_ALL_CLIENT_INFOS_FROM(d, 0)
 

	
 
#endif /* ENABLE_NETWORK */
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -303,7 +303,7 @@ struct NetworkChatWindow : public QueryS
 

	
 
		/* First, try clients */
 
		if (*item < MAX_CLIENT_SLOTS) {
 
			if (*item < GetNetworkClientInfoPoolSize()) {
 
			if (*item < NetworkClientInfo::GetPoolSize()) {
 
				/* Skip inactive clients */
 
				NetworkClientInfo *ci;
 
				FOR_ALL_CLIENT_INFOS_FROM(ci, *item) break;
src/newgrf.cpp
Show inline comments
 
@@ -378,7 +378,7 @@ static Engine *GetNewEngine(const GRFFil
 

	
 
	if (static_access) return NULL;
 

	
 
	uint engine_pool_size = GetEnginePoolSize();
 
	uint engine_pool_size = Engine::GetPoolSize();
 

	
 
	/* ... it's not, so create a new one based off an existing engine */
 
	Engine *e = new Engine(type, internal_id);
 
@@ -392,12 +392,12 @@ static Engine *GetNewEngine(const GRFFil
 
	eid->internal_id     = internal_id;
 
	eid->substitute_id   = min(internal_id, _engine_counts[type]); // substitute_id == _engine_counts[subtype] means "no substitute"
 

	
 
	if (engine_pool_size != GetEnginePoolSize()) {
 
	if (engine_pool_size != Engine::GetPoolSize()) {
 
		/* Resize temporary engine data ... */
 
		_gted = ReallocT(_gted, GetEnginePoolSize());
 
		_gted = ReallocT(_gted, Engine::GetPoolSize());
 

	
 
		/* and blank the new block. */
 
		size_t len = (GetEnginePoolSize() - engine_pool_size) * sizeof(*_gted);
 
		size_t len = (Engine::GetPoolSize() - engine_pool_size) * sizeof(*_gted);
 
		memset(_gted + engine_pool_size, 0, len);
 
	}
 

	
 
@@ -5575,7 +5575,7 @@ static void ResetNewGRFData()
 
	ResetRailTypes();
 

	
 
	/* Allocate temporary refit/cargo class data */
 
	_gted = CallocT<GRFTempEngineData>(GetEnginePoolSize());
 
	_gted = CallocT<GRFTempEngineData>(Engine::GetPoolSize());
 

	
 
	/* Reset GRM reservations */
 
	memset(&_grm_engines, 0, sizeof(_grm_engines));
src/oldpool.h
Show inline comments
 
@@ -279,12 +279,21 @@ struct PoolItem {
 

	
 
	/**
 
	 * Get item with given index
 
	 * @param index item to get
 
	 */
 
	static FORCEINLINE T *Get(uint index)
 
	{
 
		return Tpool->Get(index);
 
	}
 

	
 
	/**
 
	 * Returns size of the pool (in number of items)
 
	 */
 
	static FORCEINLINE uint GetPoolSize()
 
	{
 
		return Tpool->GetSize();
 
	}
 

	
 
private:
 
	static T *AllocateSafeRaw(uint &first);
 

	
 
@@ -333,14 +342,9 @@ public:
 
	};
 

	
 

	
 
#define OLD_POOL_ACCESSORS(name, type) \
 
	static inline uint Get##name##PoolSize()  { return _##name##_pool.GetSize(); }
 

	
 

	
 
#define DECLARE_OLD_POOL(name, type, block_size_bits, max_blocks) \
 
	OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \
 
	extern OldMemoryPool<type> _##name##_pool; \
 
	OLD_POOL_ACCESSORS(name, type)
 
	extern OldMemoryPool<type> _##name##_pool;
 

	
 

	
 
#define DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \
 
@@ -359,7 +363,7 @@ public:
 
#define STATIC_OLD_POOL(name, type, block_size_bits, max_blocks, new_block_proc, clean_block_proc) \
 
	OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \
 
	static DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \
 
	OLD_POOL_ACCESSORS(name, type) \
 
	static inline type *Get##name(uint index) { return _##name##_pool.Get(index); }
 
	static inline type *Get##name(uint index) { return _##name##_pool.Get(index); } \
 
	static inline uint Get##name##PoolSize()  { return _##name##_pool.GetSize(); }
 

	
 
#endif /* OLDPOOL_H */
src/order_base.h
Show inline comments
 
@@ -250,12 +250,12 @@ static inline VehicleOrderID GetMaxOrder
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetOrderPoolSize() - 1;
 
	return Order::GetPoolSize() - 1;
 
}
 

	
 
static inline VehicleOrderID GetNumOrders()
 
{
 
	return GetOrderPoolSize();
 
	return Order::GetPoolSize();
 
}
 

	
 
/** Shared order list linking together the linked list of orders and the list
 
@@ -423,17 +423,17 @@ public:
 

	
 
static inline bool IsValidOrderListID(uint index)
 
{
 
	return index < GetOrderListPoolSize() && OrderList::Get(index)->IsValid();
 
	return index < OrderList::GetPoolSize() && OrderList::Get(index)->IsValid();
 
}
 

	
 
#define FOR_ALL_ORDERS_FROM(order, start) for (order = Order::Get(start); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? Order::Get(order->index + 1U) : NULL) if (order->IsValid())
 
#define FOR_ALL_ORDERS_FROM(order, start) for (order = Order::Get(start); order != NULL; order = (order->index + 1U < Order::GetPoolSize()) ? Order::Get(order->index + 1U) : NULL) if (order->IsValid())
 
#define FOR_ALL_ORDERS(order) FOR_ALL_ORDERS_FROM(order, 0)
 

	
 

	
 
#define FOR_VEHICLE_ORDERS(v, order) for (order = (v->orders.list == NULL) ? NULL : v->orders.list->GetFirstOrder(); order != NULL; order = order->next)
 

	
 

	
 
#define FOR_ALL_ORDER_LISTS_FROM(ol, start) for (ol = OrderList::Get(start); ol != NULL; ol = (ol->index + 1U < GetOrderListPoolSize()) ? OrderList::Get(ol->index + 1U) : NULL) if (ol->IsValid())
 
#define FOR_ALL_ORDER_LISTS_FROM(ol, start) for (ol = OrderList::Get(start); ol != NULL; ol = (ol->index + 1U < OrderList::GetPoolSize()) ? OrderList::Get(ol->index + 1U) : NULL) if (ol->IsValid())
 
#define FOR_ALL_ORDER_LISTS(ol) FOR_ALL_ORDER_LISTS_FROM(ol, 0)
 

	
 
#endif /* ORDER_H */
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -1362,7 +1362,7 @@ bool LoadOldVehicle(LoadgameState *ls, i
 
		}
 
		v->current_order.AssignOrder(UnpackOldOrder(_old_order));
 

	
 
		if (_old_next_ptr != 0xFFFF) v->next = GetVehiclePoolSize() <= _old_next_ptr ? new (_old_next_ptr) InvalidVehicle() : Vehicle::Get(_old_next_ptr);
 
		if (_old_next_ptr != 0xFFFF) v->next = Vehicle::GetPoolSize() <= _old_next_ptr ? new (_old_next_ptr) InvalidVehicle() : Vehicle::Get(_old_next_ptr);
 

	
 
		if (_cargo_count != 0) {
 
			CargoPacket *cp = new CargoPacket((_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, _cargo_count);
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -208,7 +208,7 @@ void UpdateOldAircraft()
 
 */
 
static void CheckValidVehicles()
 
{
 
	uint total_engines = GetEnginePoolSize();
 
	uint total_engines = Engine::GetPoolSize();
 
	EngineID first_engine[4] = { INVALID_ENGINE, INVALID_ENGINE, INVALID_ENGINE, INVALID_ENGINE };
 

	
 
	Engine *e;
src/signs_base.h
Show inline comments
 
@@ -38,15 +38,15 @@ static inline SignID GetMaxSignIndex()
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetSignPoolSize() - 1;
 
	return Sign::GetPoolSize() - 1;
 
}
 

	
 
static inline bool IsValidSignID(uint index)
 
{
 
	return index < GetSignPoolSize() && Sign::Get(index)->IsValid();
 
	return index < Sign::GetPoolSize() && Sign::Get(index)->IsValid();
 
}
 

	
 
#define FOR_ALL_SIGNS_FROM(ss, start) for (ss = Sign::Get(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? Sign::Get(ss->index + 1U) : NULL) if (ss->IsValid())
 
#define FOR_ALL_SIGNS_FROM(ss, start) for (ss = Sign::Get(start); ss != NULL; ss = (ss->index + 1U < Sign::GetPoolSize()) ? Sign::Get(ss->index + 1U) : NULL) if (ss->IsValid())
 
#define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
 

	
 
#endif /* SIGNS_BASE_H */
src/station_base.h
Show inline comments
 
@@ -211,26 +211,26 @@ static inline StationID GetMaxStationInd
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetStationPoolSize() - 1;
 
	return Station::GetPoolSize() - 1;
 
}
 

	
 
static inline uint GetNumStations()
 
{
 
	return GetStationPoolSize();
 
	return Station::GetPoolSize();
 
}
 

	
 
static inline bool IsValidStationID(StationID index)
 
{
 
	return index < GetStationPoolSize() && Station::Get(index)->IsValid();
 
	return index < Station::GetPoolSize() && Station::Get(index)->IsValid();
 
}
 

	
 
#define FOR_ALL_STATIONS_FROM(st, start) for (st = Station::Get(start); st != NULL; st = (st->index + 1U < GetStationPoolSize()) ? Station::Get(st->index + 1U) : NULL) if (st->IsValid())
 
#define FOR_ALL_STATIONS_FROM(st, start) for (st = Station::Get(start); st != NULL; st = (st->index + 1U < Station::GetPoolSize()) ? Station::Get(st->index + 1U) : NULL) if (st->IsValid())
 
#define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0)
 

	
 

	
 
/* Stuff for ROADSTOPS */
 

	
 
#define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = RoadStop::Get(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? RoadStop::Get(rs->index + 1U) : NULL) if (rs->IsValid())
 
#define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = RoadStop::Get(start); rs != NULL; rs = (rs->index + 1U < RoadStop::GetPoolSize()) ? RoadStop::Get(rs->index + 1U) : NULL) if (rs->IsValid())
 
#define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0)
 

	
 
/* End of stuff for ROADSTOPS */
src/town.h
Show inline comments
 
@@ -302,7 +302,7 @@ TileIndexDiff GetHouseNorthPart(HouseID 
 
 */
 
static inline bool IsValidTownID(TownID index)
 
{
 
	return index < GetTownPoolSize() && Town::Get(index)->IsValid();
 
	return index < Town::GetPoolSize() && Town::Get(index)->IsValid();
 
}
 

	
 
static inline TownID GetMaxTownIndex()
 
@@ -312,7 +312,7 @@ static inline TownID GetMaxTownIndex()
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetTownPoolSize() - 1;
 
	return Town::GetPoolSize() - 1;
 
}
 

	
 
static inline uint GetNumTowns()
 
@@ -346,7 +346,7 @@ static inline Town *GetRandomTown()
 

	
 
Town *CalcClosestTownFromTile(TileIndex tile, uint threshold = UINT_MAX);
 

	
 
#define FOR_ALL_TOWNS_FROM(t, start) for (t = Town::Get(start); t != NULL; t = (t->index + 1U < GetTownPoolSize()) ? Town::Get(t->index + 1U) : NULL) if (t->IsValid())
 
#define FOR_ALL_TOWNS_FROM(t, start) for (t = Town::Get(start); t != NULL; t = (t->index + 1U < Town::GetPoolSize()) ? Town::Get(t->index + 1U) : NULL) if (t->IsValid())
 
#define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0)
 

	
 
extern Town *_cleared_town;
src/vehicle_base.h
Show inline comments
 
@@ -649,15 +649,15 @@ static inline VehicleID GetMaxVehicleInd
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetVehiclePoolSize() - 1;
 
	return Vehicle::GetPoolSize() - 1;
 
}
 

	
 
static inline uint GetNumVehicles()
 
{
 
	return GetVehiclePoolSize();
 
	return Vehicle::GetPoolSize();
 
}
 

	
 
#define FOR_ALL_VEHICLES_FROM(v, start) for (v = Vehicle::Get(start); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? Vehicle::Get(v->index + 1) : NULL) if (v->IsValid())
 
#define FOR_ALL_VEHICLES_FROM(v, start) for (v = Vehicle::Get(start); v != NULL; v = (v->index + 1U < Vehicle::GetPoolSize()) ? Vehicle::Get(v->index + 1) : NULL) if (v->IsValid())
 
#define FOR_ALL_VEHICLES(v) FOR_ALL_VEHICLES_FROM(v, 0)
 

	
 
/**
 
@@ -667,7 +667,7 @@ static inline uint GetNumVehicles()
 
 */
 
static inline bool IsValidVehicleID(uint index)
 
{
 
	return index < GetVehiclePoolSize() && Vehicle::Get(index)->IsValid();
 
	return index < Vehicle::GetPoolSize() && Vehicle::Get(index)->IsValid();
 
}
 

	
 

	
src/waypoint.h
Show inline comments
 
@@ -42,10 +42,10 @@ struct Waypoint : PoolItem<Waypoint, Way
 

	
 
static inline bool IsValidWaypointID(WaypointID index)
 
{
 
	return index < GetWaypointPoolSize() && Waypoint::Get(index)->IsValid();
 
	return index < Waypoint::GetPoolSize() && Waypoint::Get(index)->IsValid();
 
}
 

	
 
#define FOR_ALL_WAYPOINTS_FROM(wp, start) for (wp = Waypoint::Get(start); wp != NULL; wp = (wp->index + 1U < GetWaypointPoolSize()) ? Waypoint::Get(wp->index + 1U) : NULL) if (wp->IsValid())
 
#define FOR_ALL_WAYPOINTS_FROM(wp, start) for (wp = Waypoint::Get(start); wp != NULL; wp = (wp->index + 1U < Waypoint::GetPoolSize()) ? Waypoint::Get(wp->index + 1U) : NULL) if (wp->IsValid())
 
#define FOR_ALL_WAYPOINTS(wp) FOR_ALL_WAYPOINTS_FROM(wp, 0)
 

	
 

	
src/waypoint_cmd.cpp
Show inline comments
 
@@ -69,7 +69,7 @@ static void MakeDefaultWaypointName(Wayp
 
	 * If it wasn't using 'used' and 'idx', it would just search for increasing 'next',
 
	 * but this way it is faster */
 

	
 
	WaypointID cid = 0; // current index, goes to GetWaypointPoolSize()-1, then wraps to 0
 
	WaypointID cid = 0; // current index, goes to Waypoint::GetPoolSize()-1, then wraps to 0
 
	do {
 
		Waypoint *lwp = Waypoint::Get(cid);
 

	
 
@@ -99,7 +99,7 @@ static void MakeDefaultWaypointName(Wayp
 
		}
 

	
 
		cid++;
 
		if (cid == GetWaypointPoolSize()) cid = 0; // wrap to zero...
 
		if (cid == Waypoint::GetPoolSize()) cid = 0; // wrap to zero...
 
	} while (cid != idx);
 

	
 
	wp->town_cn = (uint16)next; // set index...
0 comments (0 inline, 0 general)