62 */ |
62 */ |
63 Station::~Station() |
63 Station::~Station() |
64 { |
64 { |
65 DEBUG(station, cDebugCtorLevel, "I-%3d", index); |
65 DEBUG(station, cDebugCtorLevel, "I-%3d", index); |
66 |
66 |
67 DeleteName(string_id); |
|
68 MarkDirty(); |
67 MarkDirty(); |
69 RebuildStationLists(); |
68 RebuildStationLists(); |
70 InvalidateWindowClasses(WC_STATION_LIST); |
69 InvalidateWindowClasses(WC_STATION_LIST); |
71 |
70 |
72 DeleteWindowById(WC_STATION_VIEW, index); |
71 DeleteWindowById(WC_STATION_VIEW, index); |
75 RemoveOrderFromAllVehicles(OT_GOTO_STATION, index); |
74 RemoveOrderFromAllVehicles(OT_GOTO_STATION, index); |
76 |
75 |
77 /* Subsidies need removal as well */ |
76 /* Subsidies need removal as well */ |
78 DeleteSubsidyWithStation(index); |
77 DeleteSubsidyWithStation(index); |
79 |
78 |
80 free(speclist); |
|
81 xy = 0; |
79 xy = 0; |
82 |
80 |
83 for (CargoID c = 0; c < NUM_CARGO; c++) { |
81 for (CargoID c = 0; c < NUM_CARGO; c++) { |
84 goods[c].cargo.Truncate(0); |
82 goods[c].cargo.Truncate(0); |
85 } |
83 } |
86 } |
84 |
87 |
85 this->QuickFree(); |
88 void* Station::operator new(size_t size) |
86 } |
|
87 |
|
88 void Station::QuickFree() |
|
89 { |
|
90 DeleteName(this->string_id); |
|
91 free(this->speclist); |
|
92 } |
|
93 |
|
94 void *Station::operator new(size_t size) |
89 { |
95 { |
90 Station *st = AllocateRaw(); |
96 Station *st = AllocateRaw(); |
91 return st; |
97 return st; |
92 } |
98 } |
93 |
99 |
94 void* Station::operator new(size_t size, int st_idx) |
100 void *Station::operator new(size_t size, int st_idx) |
95 { |
101 { |
96 if (!AddBlockIfNeeded(&_Station_pool, st_idx)) |
102 if (!AddBlockIfNeeded(&_Station_pool, st_idx)) |
97 error("Stations: failed loading savegame: too many stations"); |
103 error("Stations: failed loading savegame: too many stations"); |
98 |
104 |
99 Station *st = GetStation(st_idx); |
105 Station *st = GetStation(st_idx); |
478 DEBUG(ms, cDebugCtorLevel , "I- at %d[0x%x]", xy, xy); |
484 DEBUG(ms, cDebugCtorLevel , "I- at %d[0x%x]", xy, xy); |
479 |
485 |
480 xy = INVALID_TILE; |
486 xy = INVALID_TILE; |
481 } |
487 } |
482 |
488 |
483 |
|
484 /** Low-level function for allocating a RoadStop on the pool */ |
489 /** Low-level function for allocating a RoadStop on the pool */ |
485 RoadStop *RoadStop::AllocateRaw() |
490 RoadStop *RoadStop::AllocateRaw() |
486 { |
491 { |
487 RoadStop *rs; |
492 RoadStop *rs; |
488 |
493 |