summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--depot.c2
-rw-r--r--depot.h4
-rw-r--r--engine.c2
-rw-r--r--engine.h4
-rw-r--r--industry.h4
-rw-r--r--industry_cmd.c2
-rw-r--r--newgrf_sound.c4
-rw-r--r--newgrf_spritegroup.c4
-rw-r--r--oldpool.c (renamed from pool.c)8
-rw-r--r--oldpool.h (renamed from pool.h)44
-rw-r--r--openttd.tgt2
-rw-r--r--openttd.vcproj4
-rw-r--r--openttd_vs80.vcproj4
-rw-r--r--order.h4
-rw-r--r--order_cmd.c2
-rw-r--r--player.h2
-rw-r--r--saveload.c2
-rw-r--r--signs.c2
-rw-r--r--signs.h4
-rw-r--r--station.h6
-rw-r--r--station_cmd.c4
-rw-r--r--town.h4
-rw-r--r--town_cmd.c2
-rw-r--r--vehicle.c2
-rw-r--r--vehicle.h4
-rw-r--r--waypoint.c2
-rw-r--r--waypoint.h4
28 files changed, 67 insertions, 67 deletions
diff --git a/Makefile b/Makefile
index 5d29b8bcb..85ce7a4bf 100644
--- a/Makefile
+++ b/Makefile
@@ -741,6 +741,7 @@ SRCS += newgrf_text.c
SRCS += news_gui.c
SRCS += npf.c
SRCS += oldloader.c
+SRCS += oldpool.c
SRCS += openttd.c
SRCS += order_cmd.c
SRCS += order_gui.c
@@ -748,7 +749,6 @@ SRCS += os_timer.c
SRCS += pathfind.c
SRCS += player_gui.c
SRCS += players.c
-SRCS += pool.c
SRCS += queue.c
SRCS += rail.c
SRCS += rail_cmd.c
diff --git a/depot.c b/depot.c
index b838b66c2..49fdfa21c 100644
--- a/depot.c
+++ b/depot.c
@@ -23,7 +23,7 @@ static void DepotPoolNewBlock(uint start_item)
for (d = GetDepot(start_item); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? GetDepot(d->index + 1U) : NULL) d->index = start_item++;
}
-DEFINE_POOL(Depot, Depot, DepotPoolNewBlock, NULL)
+DEFINE_OLD_POOL(Depot, Depot, DepotPoolNewBlock, NULL)
/**
diff --git a/depot.h b/depot.h
index 0c69ab700..c52c3292a 100644
--- a/depot.h
+++ b/depot.h
@@ -7,7 +7,7 @@
* @see depot.c */
#include "direction.h"
-#include "pool.h"
+#include "oldpool.h"
#include "tile.h"
#include "variables.h"
@@ -17,7 +17,7 @@ struct Depot {
DepotID index;
};
-DECLARE_POOL(Depot, Depot, 3, 8000)
+DECLARE_OLD_POOL(Depot, Depot, 3, 8000)
/**
* Check if a depot really exists.
diff --git a/engine.c b/engine.c
index d6acd5d05..9ac2ad7ac 100644
--- a/engine.c
+++ b/engine.c
@@ -431,7 +431,7 @@ bool IsEngineBuildable(EngineID engine, byte type, PlayerID player)
static void EngineRenewPoolNewBlock(uint start_item);
-DEFINE_POOL(EngineRenew, EngineRenew, EngineRenewPoolNewBlock, NULL)
+DEFINE_OLD_POOL(EngineRenew, EngineRenew, EngineRenewPoolNewBlock, NULL)
static void EngineRenewPoolNewBlock(uint start_item)
{
diff --git a/engine.h b/engine.h
index 9675ca396..a0b355874 100644
--- a/engine.h
+++ b/engine.h
@@ -5,7 +5,7 @@
/** @file engine.h */
-#include "pool.h"
+#include "oldpool.h"
typedef struct RailVehicleInfo {
byte image_index;
@@ -235,7 +235,7 @@ typedef struct EngineRenew EngineRenew;
* placed here so the only exception to this rule, the saveload code, can use
* it.
*/
-DECLARE_POOL(EngineRenew, EngineRenew, 3, 8000)
+DECLARE_OLD_POOL(EngineRenew, EngineRenew, 3, 8000)
/**
* Check if a EngineRenew really exists.
diff --git a/industry.h b/industry.h
index 7369450db..db1b915f3 100644
--- a/industry.h
+++ b/industry.h
@@ -3,7 +3,7 @@
#ifndef INDUSTRY_H
#define INDUSTRY_H
-#include "pool.h"
+#include "oldpool.h"
typedef byte IndustryGfx;
typedef uint8 IndustryType;
@@ -80,7 +80,7 @@ typedef struct IndustrySpec {
const IndustrySpec *GetIndustrySpec(IndustryType thistype);
-DECLARE_POOL(Industry, Industry, 3, 8000)
+DECLARE_OLD_POOL(Industry, Industry, 3, 8000)
/**
* Check if an Industry really exists.
diff --git a/industry_cmd.c b/industry_cmd.c
index 5d6c78d67..4516de189 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -45,7 +45,7 @@ static void IndustryPoolNewBlock(uint start_item)
for (i = GetIndustry(start_item); i != NULL; i = (i->index + 1U < GetIndustryPoolSize()) ? GetIndustry(i->index + 1U) : NULL) i->index = start_item++;
}
-DEFINE_POOL(Industry, Industry, IndustryPoolNewBlock, NULL)
+DEFINE_OLD_POOL(Industry, Industry, IndustryPoolNewBlock, NULL)
/**
* Retrieve the type for this industry. Although it is accessed by a tile,
diff --git a/newgrf_sound.c b/newgrf_sound.c
index b21ce7a4e..e96934104 100644
--- a/newgrf_sound.c
+++ b/newgrf_sound.c
@@ -2,7 +2,7 @@
#include "stdafx.h"
#include "openttd.h"
-#include "pool.h"
+#include "oldpool.h"
#include "sound.h"
#include "engine.h"
#include "vehicle.h"
@@ -11,7 +11,7 @@
#include "newgrf_sound.h"
static uint _sound_count = 0;
-STATIC_POOL(SoundInternal, FileEntry, 3, 1000, NULL, NULL)
+STATIC_OLD_POOL(SoundInternal, FileEntry, 3, 1000, NULL, NULL)
/* Allocate a new FileEntry */
diff --git a/newgrf_spritegroup.c b/newgrf_spritegroup.c
index 48985a2c5..ef2ca9091 100644
--- a/newgrf_spritegroup.c
+++ b/newgrf_spritegroup.c
@@ -4,14 +4,14 @@
#include "openttd.h"
#include "variables.h"
#include "macros.h"
-#include "pool.h"
+#include "oldpool.h"
#include "newgrf_spritegroup.h"
#include "date.h"
static void SpriteGroupPoolCleanBlock(uint start_item, uint end_item);
static uint _spritegroup_count = 0;
-STATIC_POOL(SpriteGroup, SpriteGroup, 4, 8000, NULL, SpriteGroupPoolCleanBlock)
+STATIC_OLD_POOL(SpriteGroup, SpriteGroup, 4, 8000, NULL, SpriteGroupPoolCleanBlock)
static void DestroySpriteGroup(SpriteGroup *group)
{
diff --git a/pool.c b/oldpool.c
index 828aa87d9..e857907f1 100644
--- a/pool.c
+++ b/oldpool.c
@@ -4,12 +4,12 @@
#include "openttd.h"
#include "debug.h"
#include "functions.h"
-#include "pool.h"
+#include "oldpool.h"
/**
* Clean a pool in a safe way (does free all blocks)
*/
-void CleanPool(MemoryPool *pool)
+void CleanPool(OldMemoryPool *pool)
{
uint i;
@@ -38,7 +38,7 @@ void CleanPool(MemoryPool *pool)
*
* @return Returns false if the pool could not be increased
*/
-bool AddBlockToPool(MemoryPool *pool)
+bool AddBlockToPool(OldMemoryPool *pool)
{
/* Is the pool at his max? */
if (pool->max_blocks == pool->current_blocks)
@@ -76,7 +76,7 @@ bool AddBlockToPool(MemoryPool *pool)
*
* @return Returns false if adding failed
*/
-bool AddBlockIfNeeded(MemoryPool *pool, uint index)
+bool AddBlockIfNeeded(OldMemoryPool *pool, uint index)
{
while (index >= pool->total_items) {
if (!AddBlockToPool(pool))
diff --git a/pool.h b/oldpool.h
index 8ee7bd2df..bd067a6f1 100644
--- a/pool.h
+++ b/oldpool.h
@@ -3,19 +3,19 @@
#ifndef POOL_H
#define POOL_H
-typedef struct MemoryPool MemoryPool;
+typedef struct OldMemoryPool OldMemoryPool;
/* The function that is called after a new block is added
start_item is the first item of the new made block */
-typedef void MemoryPoolNewBlock(uint start_item);
+typedef void OldMemoryPoolNewBlock(uint start_item);
/* The function that is called before a block is cleaned up */
-typedef void MemoryPoolCleanBlock(uint start_item, uint end_item);
+typedef void OldMemoryPoolCleanBlock(uint start_item, uint end_item);
/**
- * Stuff for dynamic vehicles. Use the wrappers to access the MemoryPool
+ * Stuff for dynamic vehicles. Use the wrappers to access the OldMemoryPool
* please try to avoid manual calls!
*/
-struct MemoryPool {
+struct OldMemoryPool {
const char* const name; ///< Name of the pool (just for debugging)
const uint max_blocks; ///< The max amount of blocks this pool can have
@@ -23,9 +23,9 @@ struct MemoryPool {
const uint item_size; ///< How many bytes one block is
/// Pointer to a function that is called after a new block is added
- MemoryPoolNewBlock *new_block_proc;
+ OldMemoryPoolNewBlock *new_block_proc;
/// Pointer to a function that is called to clean a block
- MemoryPoolCleanBlock *clean_block_proc;
+ OldMemoryPoolCleanBlock *clean_block_proc;
uint current_blocks; ///< How many blocks we have in our pool
uint total_items; ///< How many items we now have in this pool
@@ -40,25 +40,25 @@ struct MemoryPool {
* AddBlockToPool adds 1 more block to the pool. Returns false if there is no
* more room
*/
-void CleanPool(MemoryPool *array);
-bool AddBlockToPool(MemoryPool *array);
+void CleanPool(OldMemoryPool *array);
+bool AddBlockToPool(OldMemoryPool *array);
/**
* Adds blocks to the pool if needed (and possible) till index fits inside the pool
*
* @return Returns false if adding failed
*/
-bool AddBlockIfNeeded(MemoryPool *array, uint index);
+bool AddBlockIfNeeded(OldMemoryPool *array, uint index);
-#define POOL_ENUM(name, type, block_size_bits, max_blocks) \
+#define OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \
enum { \
name##_POOL_BLOCK_SIZE_BITS = block_size_bits, \
name##_POOL_MAX_BLOCKS = max_blocks \
};
-#define POOL_ACCESSORS(name, type) \
+#define OLD_POOL_ACCESSORS(name, type) \
static inline type* Get##name(uint index) \
{ \
assert(index < _##name##_pool.total_items); \
@@ -74,23 +74,23 @@ bool AddBlockIfNeeded(MemoryPool *array, uint index);
}
-#define DECLARE_POOL(name, type, block_size_bits, max_blocks) \
- POOL_ENUM(name, type, block_size_bits, max_blocks) \
- extern MemoryPool _##name##_pool; \
- POOL_ACCESSORS(name, type)
+#define DECLARE_OLD_POOL(name, type, block_size_bits, max_blocks) \
+ OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \
+ extern OldMemoryPool _##name##_pool; \
+ OLD_POOL_ACCESSORS(name, type)
-#define DEFINE_POOL(name, type, new_block_proc, clean_block_proc) \
- MemoryPool _##name##_pool = { \
+#define DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \
+ OldMemoryPool _##name##_pool = { \
#name, name##_POOL_MAX_BLOCKS, name##_POOL_BLOCK_SIZE_BITS, sizeof(type), \
new_block_proc, clean_block_proc, \
0, 0, NULL \
};
-#define STATIC_POOL(name, type, block_size_bits, max_blocks, new_block_proc, clean_block_proc) \
- POOL_ENUM(name, type, block_size_bits, max_blocks) \
- static DEFINE_POOL(name, type, new_block_proc, clean_block_proc) \
- POOL_ACCESSORS(name, type)
+#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)
#endif /* POOL_H */
diff --git a/openttd.tgt b/openttd.tgt
index 0d3fa1dd3..dc2c11089 100644
--- a/openttd.tgt
+++ b/openttd.tgt
@@ -1687,7 +1687,7 @@ WVList
387
MItem
6
-pool.c
+oldpool.c
388
WString
4
diff --git a/openttd.vcproj b/openttd.vcproj
index 46746b3af..25154a552 100644
--- a/openttd.vcproj
+++ b/openttd.vcproj
@@ -361,7 +361,7 @@
RelativePath="players.c">
</File>
<File
- RelativePath=".\pool.c">
+ RelativePath=".\oldpool.c">
</File>
<File
RelativePath=".\queue.c">
@@ -611,7 +611,7 @@
RelativePath=".\player.h">
</File>
<File
- RelativePath=".\pool.h">
+ RelativePath=".\oldpool.h">
</File>
<File
RelativePath=".\queue.h">
diff --git a/openttd_vs80.vcproj b/openttd_vs80.vcproj
index 79f8ec3d0..c1dc2d0a9 100644
--- a/openttd_vs80.vcproj
+++ b/openttd_vs80.vcproj
@@ -729,7 +729,7 @@
>
</File>
<File
- RelativePath=".\pool.c"
+ RelativePath=".\oldpool.c"
>
</File>
<File
@@ -1112,7 +1112,7 @@
>
</File>
<File
- RelativePath=".\pool.h"
+ RelativePath=".\oldpool.h"
>
</File>
<File
diff --git a/order.h b/order.h
index dce9d38ce..d0265cd2a 100644
--- a/order.h
+++ b/order.h
@@ -6,7 +6,7 @@
#define ORDER_H
#include "macros.h"
-#include "pool.h"
+#include "oldpool.h"
enum {
INVALID_VEH_ORDER_ID = 0xFF,
@@ -107,7 +107,7 @@ typedef struct {
VARDEF TileIndex _backup_orders_tile;
VARDEF BackuppedOrders _backup_orders_data[1];
-DECLARE_POOL(Order, Order, 6, 1000)
+DECLARE_OLD_POOL(Order, Order, 6, 1000)
static inline VehicleOrderID GetOrderArraySize(void)
{
diff --git a/order_cmd.c b/order_cmd.c
index 20966a084..fe4511d77 100644
--- a/order_cmd.c
+++ b/order_cmd.c
@@ -28,7 +28,7 @@ static void OrderPoolNewBlock(uint start_item)
for (order = GetOrder(start_item); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? GetOrder(order->index + 1U) : NULL) order->index = start_item++;
}
-DEFINE_POOL(Order, Order, OrderPoolNewBlock, NULL)
+DEFINE_OLD_POOL(Order, Order, OrderPoolNewBlock, NULL)
/**
*
diff --git a/player.h b/player.h
index a359b1064..c06900257 100644
--- a/player.h
+++ b/player.h
@@ -3,7 +3,7 @@
#ifndef PLAYER_H
#define PLAYER_H
-#include "pool.h"
+#include "oldpool.h"
#include "aystar.h"
#include "rail.h"
#include "engine.h"
diff --git a/saveload.c b/saveload.c
index 0b492c076..3a5a7889d 100644
--- a/saveload.c
+++ b/saveload.c
@@ -1056,7 +1056,7 @@ typedef struct ThreadedSave {
} ThreadedSave;
/* A maximum size of of 128K * 500 = 64.000KB savegames */
-STATIC_POOL(Savegame, byte, 17, 500, NULL, NULL)
+STATIC_OLD_POOL(Savegame, byte, 17, 500, NULL, NULL)
static ThreadedSave _ts;
static bool InitMem(void)
diff --git a/signs.c b/signs.c
index 7c7c85f32..4b2d48cd1 100644
--- a/signs.c
+++ b/signs.c
@@ -25,7 +25,7 @@ static void SignPoolNewBlock(uint start_item)
}
/* Initialize the sign-pool */
-DEFINE_POOL(Sign, Sign, SignPoolNewBlock, NULL)
+DEFINE_OLD_POOL(Sign, Sign, SignPoolNewBlock, NULL)
/**
*
diff --git a/signs.h b/signs.h
index bfcf9d95a..0ded78353 100644
--- a/signs.h
+++ b/signs.h
@@ -3,7 +3,7 @@
#ifndef SIGNS_H
#define SIGNS_H
-#include "pool.h"
+#include "oldpool.h"
typedef struct Sign {
StringID str;
@@ -16,7 +16,7 @@ typedef struct Sign {
SignID index;
} Sign;
-DECLARE_POOL(Sign, Sign, 2, 16000)
+DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
static inline SignID GetSignArraySize(void)
{
diff --git a/station.h b/station.h
index c2594f7e8..0499c8aa8 100644
--- a/station.h
+++ b/station.h
@@ -4,7 +4,7 @@
#define STATION_H
#include "player.h"
-#include "pool.h"
+#include "oldpool.h"
#include "sprite.h"
#include "tile.h"
#include "newgrf_station.h"
@@ -142,7 +142,7 @@ void UpdateAllStationVirtCoord(void);
void RebuildStationLists(void);
void ResortStationLists(void);
-DECLARE_POOL(Station, Station, 6, 1000)
+DECLARE_OLD_POOL(Station, Station, 6, 1000)
static inline StationID GetStationArraySize(void)
{
@@ -181,7 +181,7 @@ static inline void DeleteStation(Station *st)
/* Stuff for ROADSTOPS */
-DECLARE_POOL(RoadStop, RoadStop, 5, 2000)
+DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
/**
* Check if a RaodStop really exists.
diff --git a/station_cmd.c b/station_cmd.c
index 7de77721e..3c82289d9 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -68,8 +68,8 @@ static void RoadStopPoolNewBlock(uint start_item)
for (rs = GetRoadStop(start_item); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) rs->index = start_item++;
}
-DEFINE_POOL(Station, Station, StationPoolNewBlock, StationPoolCleanBlock)
-DEFINE_POOL(RoadStop, RoadStop, RoadStopPoolNewBlock, NULL)
+DEFINE_OLD_POOL(Station, Station, StationPoolNewBlock, StationPoolCleanBlock)
+DEFINE_OLD_POOL(RoadStop, RoadStop, RoadStopPoolNewBlock, NULL)
extern void UpdateAirplanesOnNewStation(Station *st);
diff --git a/town.h b/town.h
index 73155c855..896e3415c 100644
--- a/town.h
+++ b/town.h
@@ -3,7 +3,7 @@
#ifndef TOWN_H
#define TOWN_H
-#include "pool.h"
+#include "oldpool.h"
#include "player.h"
struct Town {
@@ -152,7 +152,7 @@ bool CheckforTownRating(uint32 flags, Town *t, byte type);
VARDEF const Town** _town_sort;
-DECLARE_POOL(Town, Town, 3, 8000)
+DECLARE_OLD_POOL(Town, Town, 3, 8000)
/**
* Check if a Town really exists.
diff --git a/town_cmd.c b/town_cmd.c
index 20be3354a..d5c0b10b2 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -43,7 +43,7 @@ static void TownPoolNewBlock(uint start_item)
}
/* Initialize the town-pool */
-DEFINE_POOL(Town, Town, TownPoolNewBlock, NULL)
+DEFINE_OLD_POOL(Town, Town, TownPoolNewBlock, NULL)
void DestroyTown(Town *t)
{
diff --git a/vehicle.c b/vehicle.c
index 8cb22c7cf..8af9b1960 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -95,7 +95,7 @@ static void VehiclePoolNewBlock(uint start_item)
}
/* Initialize the vehicle-pool */
-DEFINE_POOL(Vehicle, Vehicle, VehiclePoolNewBlock, NULL)
+DEFINE_OLD_POOL(Vehicle, Vehicle, VehiclePoolNewBlock, NULL)
void VehicleServiceInDepot(Vehicle *v)
{
diff --git a/vehicle.h b/vehicle.h
index 3dde48548..9f842b155 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -3,7 +3,7 @@
#ifndef VEHICLE_H
#define VEHICLE_H
-#include "pool.h"
+#include "oldpool.h"
#include "order.h"
#include "rail.h"
@@ -368,7 +368,7 @@ Direction GetDirectionTowards(const Vehicle* v, int x, int y);
#define BEGIN_ENUM_WAGONS(v) do {
#define END_ENUM_WAGONS(v) } while ( (v=v->next) != NULL);
-DECLARE_POOL(Vehicle, Vehicle, 9, 125)
+DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125)
static inline VehicleID GetVehicleArraySize(void)
{
diff --git a/waypoint.c b/waypoint.c
index cb3195e5f..499faa3a1 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -36,7 +36,7 @@ static void WaypointPoolNewBlock(uint start_item)
for (wp = GetWaypoint(start_item); wp != NULL; wp = (wp->index + 1U < GetWaypointPoolSize()) ? GetWaypoint(wp->index + 1U) : NULL) wp->index = start_item++;
}
-DEFINE_POOL(Waypoint, Waypoint, WaypointPoolNewBlock, NULL)
+DEFINE_OLD_POOL(Waypoint, Waypoint, WaypointPoolNewBlock, NULL)
/* Create a new waypoint */
static Waypoint* AllocateWaypoint(void)
diff --git a/waypoint.h b/waypoint.h
index 59ffa84ad..0b689b317 100644
--- a/waypoint.h
+++ b/waypoint.h
@@ -3,7 +3,7 @@
#ifndef WAYPOINT_H
#define WAYPOINT_H
-#include "pool.h"
+#include "oldpool.h"
#include "rail_map.h"
struct Waypoint {
@@ -24,7 +24,7 @@ struct Waypoint {
byte deleted; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
};
-DECLARE_POOL(Waypoint, Waypoint, 3, 8000)
+DECLARE_OLD_POOL(Waypoint, Waypoint, 3, 8000)
/**
* Check if a Waypoint really exists.