Changeset - r15307:f844b2fa748c
[Not reviewed]
master
0 2 0
smatz - 14 years ago 2010-06-11 00:20:24
smatz@openttd.org
(svn r19958) -Codechange: move common code from Waypoint and Station destructors to BaseStation destructor
2 files changed with 2 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/station.cpp
Show inline comments
 
@@ -36,24 +36,26 @@ BaseStation::~BaseStation()
 
	free(this->name);
 
	free(this->speclist);
 

	
 
	if (CleaningPool()) return;
 

	
 
	Owner owner = this->owner;
 
	if (!Company::IsValidID(owner)) owner = _local_company;
 
	WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | owner;
 
	DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11));
 
	DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11));
 
	DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11));
 
	DeleteWindowById(WC_AIRCRAFT_LIST, wno | (VEH_AIRCRAFT << 11));
 

	
 
	this->sign.MarkDirty();
 
}
 

	
 
Station::Station(TileIndex tile) :
 
	SpecializedStation<Station, false>(tile),
 
	bus_station(INVALID_TILE, 0, 0),
 
	truck_station(INVALID_TILE, 0, 0),
 
	dock_tile(INVALID_TILE),
 
	indtype(IT_INVALID),
 
	time_since_load(255),
 
	time_since_unload(255),
 
	last_vehicle_type(VEH_INVALID)
 
{
 
@@ -79,25 +81,24 @@ Station::~Station()
 
		if (!a->IsNormalAircraft()) continue;
 
		if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
 
	}
 

	
 
	Vehicle *v;
 
	FOR_ALL_VEHICLES(v) {
 
		/* Forget about this station if this station is removed */
 
		if (v->last_station_visited == this->index) {
 
			v->last_station_visited = INVALID_STATION;
 
		}
 
	}
 

	
 
	this->sign.MarkDirty();
 
	InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
 

	
 
	DeleteWindowById(WC_STATION_VIEW, index);
 

	
 
	/* Now delete all orders that go to the station */
 
	RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
 

	
 
	/* Remove all news items */
 
	DeleteStationNews(this->index);
 

	
 
	for (CargoID c = 0; c < NUM_CARGO; c++) {
 
		this->goods[c].cargo.Truncate(0);
src/waypoint.cpp
Show inline comments
 
@@ -43,15 +43,13 @@ void Waypoint::GetTileArea(TileArea *ta,
 
			ta->h    = 1;
 
			break;
 

	
 
		default: NOT_REACHED();
 
	}
 
}
 

	
 
Waypoint::~Waypoint()
 
{
 
	if (CleaningPool()) return;
 
	DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
 
	RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
 

	
 
	this->sign.MarkDirty();
 
}
0 comments (0 inline, 0 general)