Changeset - r15938:d72e39d2ec08
[Not reviewed]
master
0 4 0
frosch - 14 years ago 2010-08-27 20:46:36
frosch@openttd.org
(svn r20636) -Codechange: Move MarkTileDirtyByTile() and DeleteAnimatedTile() into MakeWaterKeepingClass().
4 files changed with 8 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -145,12 +145,6 @@ Industry::~Industry()
 

	
 
				/* MakeWaterKeepingClass() can also handle 'land' */
 
				MakeWaterKeepingClass(tile_cur, OWNER_NONE);
 

	
 
				/* MakeWaterKeepingClass() doesn't remove animation if the tiles
 
				 * become watery, but be on the safe side an always remote it. */
 
				DeleteAnimatedTile(tile_cur);
 

	
 
				MarkTileDirtyByTile(tile_cur);
 
			}
 
		} else if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) {
 
			DeleteOilRig(tile_cur);
src/station_cmd.cpp
Show inline comments
 
@@ -2492,13 +2492,12 @@ static CommandCost RemoveDock(TileIndex 
 

	
 
	if (flags & DC_EXEC) {
 
		DoClearSquare(tile1);
 
		MarkTileDirtyByTile(tile1);
 
		MakeWaterKeepingClass(tile2, st->owner);
 

	
 
		st->rect.AfterRemoveTile(st, tile1);
 
		st->rect.AfterRemoveTile(st, tile2);
 

	
 
		MarkTileDirtyByTile(tile2);
 

	
 
		st->dock_tile = INVALID_TILE;
 
		st->facilities &= ~FACIL_DOCK;
 

	
 
@@ -3398,7 +3397,6 @@ void DeleteOilRig(TileIndex tile)
 
	Station *st = Station::GetByTile(tile);
 

	
 
	MakeWaterKeepingClass(tile, OWNER_NONE);
 
	MarkTileDirtyByTile(tile);
 

	
 
	st->dock_tile = INVALID_TILE;
 
	st->airport.Clear();
src/water_cmd.cpp
Show inline comments
 
@@ -136,8 +136,6 @@ CommandCost CmdBuildShipDepot(TileIndex 
 

	
 
void MakeWaterKeepingClass(TileIndex tile, Owner o)
 
{
 
	assert(IsTileType(tile, MP_WATER) || (IsTileType(tile, MP_STATION) && (IsBuoy(tile) || IsDock(tile) || IsOilRig(tile))) || IsTileType(tile, MP_INDUSTRY));
 

	
 
	WaterClass wc = GetWaterClass(tile);
 

	
 
	/* Autoslope might turn an originally canal or river tile into land */
 
@@ -146,12 +144,18 @@ void MakeWaterKeepingClass(TileIndex til
 

	
 
	if (wc == WATER_CLASS_SEA && z > 0) wc = WATER_CLASS_CANAL;
 

	
 
	/* Zero map array and terminate animation */
 
	DoClearSquare(tile);
 

	
 
	/* Maybe change to water */
 
	switch (wc) {
 
		case WATER_CLASS_SEA:   MakeSea(tile);                break;
 
		case WATER_CLASS_CANAL: MakeCanal(tile, o, Random()); break;
 
		case WATER_CLASS_RIVER: MakeRiver(tile, Random());    break;
 
		default:                DoClearSquare(tile);          break;
 
		default: break;
 
	}
 

	
 
	MarkTileDirtyByTile(tile);
 
}
 

	
 
static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags)
 
@@ -175,8 +179,6 @@ static CommandCost RemoveShipDepot(TileI
 

	
 
		MakeWaterKeepingClass(tile,  GetTileOwner(tile));
 
		MakeWaterKeepingClass(tile2, GetTileOwner(tile2));
 
		MarkTileDirtyByTile(tile);
 
		MarkTileDirtyByTile(tile2);
 
	}
 

	
 
	return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_DEPOT_SHIP]);
 
@@ -269,8 +271,6 @@ static CommandCost RemoveLock(TileIndex 
 
		DoClearSquare(tile);
 
		MakeWaterKeepingClass(tile + delta, GetTileOwner(tile));
 
		MakeWaterKeepingClass(tile - delta, GetTileOwner(tile));
 
		MarkTileDirtyByTile(tile - delta);
 
		MarkTileDirtyByTile(tile + delta);
 
		MarkCanalsAndRiversAroundDirty(tile - delta);
 
		MarkCanalsAndRiversAroundDirty(tile + delta);
 
	}
src/waypoint_cmd.cpp
Show inline comments
 
@@ -349,7 +349,6 @@ CommandCost RemoveBuoy(TileIndex tile, D
 
		 * buoy was placed. Otherwise one could plant a buoy on a canal edge,
 
		 * remove it and flood the land (if the canal edge is at level 0) */
 
		MakeWaterKeepingClass(tile, GetTileOwner(tile));
 
		MarkTileDirtyByTile(tile);
 

	
 
		wp->rect.AfterRemoveTile(wp, tile);
 

	
0 comments (0 inline, 0 general)