Changeset - r18586:e59d3231d7ae
[Not reviewed]
master
0 1 0
frosch - 13 years ago 2011-12-07 18:41:38
frosch@openttd.org
(svn r23443) -Fix (r23413): Building of locks in SE failed.
1 file changed with 10 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/water_cmd.cpp
Show inline comments
 
@@ -275,32 +275,34 @@ static CommandCost DoBuildLock(TileIndex
 
	if (GetTileSlope(tile + delta) != SLOPE_FLAT) {
 
		return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 
	}
 

	
 
	if ((MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) ||
 
	    (MayHaveBridgeAbove(tile - delta) && IsBridgeAbove(tile - delta)) ||
 
	    (MayHaveBridgeAbove(tile + delta) && IsBridgeAbove(tile + delta))) {
 
		return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		/* Update company infrastructure counts. */
 
		Company *c = Company::Get(_current_company);
 
		/* Counts for the water. */
 
		c->infrastructure.water++;
 
		if (!IsWaterTile(tile - delta)) c->infrastructure.water++;
 
		if (!IsWaterTile(tile + delta)) c->infrastructure.water++;
 
		/* Count for the lock itself. */
 
		c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles.
 
		DirtyCompanyInfrastructureWindows(_current_company);
 
		Company *c = Company::GetIfValid(_current_company);
 
		if (c != NULL) {
 
			/* Counts for the water. */
 
			c->infrastructure.water++;
 
			if (!IsWaterTile(tile - delta)) c->infrastructure.water++;
 
			if (!IsWaterTile(tile + delta)) c->infrastructure.water++;
 
			/* Count for the lock itself. */
 
			c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles.
 
			DirtyCompanyInfrastructureWindows(_current_company);
 
		}
 

	
 
		MakeLock(tile, _current_company, dir, wc_lower, wc_upper);
 
		MarkTileDirtyByTile(tile);
 
		MarkTileDirtyByTile(tile - delta);
 
		MarkTileDirtyByTile(tile + delta);
 
		MarkCanalsAndRiversAroundDirty(tile - delta);
 
		MarkCanalsAndRiversAroundDirty(tile + delta);
 
	}
 
	cost.AddCost(_price[PR_BUILD_LOCK]);
 

	
 
	return cost;
 
}
0 comments (0 inline, 0 general)