summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-01 23:49:06 +0000
committerrubidium <rubidium@openttd.org>2007-08-01 23:49:06 +0000
commitaa78685c99dc1cd2fe28a05ba55eb719e12f4029 (patch)
treea6179b4654ee8bc1cf111be24063de2f08787322 /src/station.cpp
parent4e96ce3dfea13ffab951a93061e35423e0b321e5 (diff)
downloadopenttd-aa78685c99dc1cd2fe28a05ba55eb719e12f4029.tar.xz
(svn r10745) -Codechange: generalize the pool cleanup/initialize functions for stations (in such a manner that they can be used for other pools too).
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/station.cpp b/src/station.cpp
index 02f165b6f..0f7db16ff 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -64,7 +64,6 @@ Station::~Station()
{
DEBUG(station, cDebugCtorLevel, "I-%3d", index);
- DeleteName(string_id);
MarkDirty();
RebuildStationLists();
InvalidateWindowClasses(WC_STATION_LIST);
@@ -77,21 +76,28 @@ Station::~Station()
/* Subsidies need removal as well */
DeleteSubsidyWithStation(index);
- free(speclist);
xy = 0;
for (CargoID c = 0; c < NUM_CARGO; c++) {
goods[c].cargo.Truncate(0);
}
+
+ this->QuickFree();
}
-void* Station::operator new(size_t size)
+void Station::QuickFree()
+{
+ DeleteName(this->string_id);
+ free(this->speclist);
+}
+
+void *Station::operator new(size_t size)
{
Station *st = AllocateRaw();
return st;
}
-void* Station::operator new(size_t size, int st_idx)
+void *Station::operator new(size_t size, int st_idx)
{
if (!AddBlockIfNeeded(&_Station_pool, st_idx))
error("Stations: failed loading savegame: too many stations");
@@ -480,7 +486,6 @@ RoadStop::~RoadStop()
xy = INVALID_TILE;
}
-
/** Low-level function for allocating a RoadStop on the pool */
RoadStop *RoadStop::AllocateRaw()
{