Changeset - r12586:54de0e97d6e2
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-08-02 14:54:42
rubidium@openttd.org
(svn r17039) -Fix (r16988): segfault when removing rail with waypoint remover and vice versa
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -1192,25 +1192,26 @@ CommandCost RemoveFromRailBaseStation(Ti
 
	int quantity = 0;
 

	
 
	/* Do the action for every tile into the area */
 
	TILE_LOOP(tile, ta.w, ta.h, ta.tile) {
 
		/* Make sure the specified tile is a rail station */
 
		if (!HasStationTileRail(tile)) continue;
 

	
 
		/* If there is a vehicle on ground, do not allow to remove (flood) the tile */
 
		if (!EnsureNoVehicleOnGround(tile)) continue;
 

	
 
		/* Check ownership of station */
 
		T *st = T::GetByTile(tile);
 
		if (st != NULL && _current_company != OWNER_WATER && !CheckOwnership(st->owner)) continue;
 
		if (st == NULL) continue;
 
		if (_current_company != OWNER_WATER && !CheckOwnership(st->owner)) continue;
 

	
 
		/* Do not allow removing from stations if non-uniform stations are not enabled
 
		 * The check must be here to give correct error message
 
		 */
 
		if (!_settings_game.station.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED);
 

	
 
		/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
 
		quantity++;
 

	
 
		if (flags & DC_EXEC) {
 
			/* read variables before the station tile is removed */
 
			uint specindex = GetCustomStationSpecIndex(tile);
0 comments (0 inline, 0 general)