summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
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()
{