Changeset - r22993:dc03fd0c241e
[Not reviewed]
master
0 3 0
Jonathan G Rennison - 6 years ago 2018-08-14 20:05:47
j.g.rennison@gmail.com
Fix #6875: Depot building cost does not include foundation build cost (#6883)
3 files changed with 19 insertions and 15 deletions:
0 comments (0 inline, 0 general)
bin/ai/regression/tst_regression/result.txt
Show inline comments
 
@@ -7253,7 +7253,7 @@ ERROR: IsEnd() is invalid as Begin() is 
 
  IsBuoyTile():         false
 
  IsLockTile():         false
 
  IsCanalTile():        false
 
  GetBankBalance():     479851
 
  GetBankBalance():     479664
 
  BuildWaterDepot():    true
 
  BuildDock():          true
 
  BuildBuoy():          true
 
@@ -7266,7 +7266,7 @@ ERROR: IsEnd() is invalid as Begin() is 
 
  IsBuoyTile():         true
 
  IsLockTile():         true
 
  IsCanalTile():        true
 
  GetBankBalance():     465257
 
  GetBankBalance():     465070
 

	
 
--AIWaypointList(BUOY)--
 
  Count():             1
 
@@ -7285,7 +7285,7 @@ ERROR: IsEnd() is invalid as Begin() is 
 
  IsBuoyTile():         false
 
  IsLockTile():         false
 
  IsCanalTile():        false
 
  GetBankBalance():     459862
 
  GetBankBalance():     459675
 
  BuildWaterDepot():    true
 
  BuildDock():          true
 

	
src/rail_cmd.cpp
Show inline comments
 
@@ -967,6 +967,8 @@ CommandCost CmdBuildTrainDepot(TileIndex
 

	
 
	DiagDirection dir = Extract<DiagDirection, 0, 2>(p2);
 

	
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 

	
 
	/* Prohibit construction if
 
	 * The tile is non-flat AND
 
	 * 1) build-on-slopes is disabled
 
@@ -974,14 +976,14 @@ CommandCost CmdBuildTrainDepot(TileIndex
 
	 * 3) the exit points in the wrong direction
 
	 */
 

	
 
	if (tileh != SLOPE_FLAT && (
 
				!_settings_game.construction.build_on_slopes ||
 
				!CanBuildDepotByTileh(dir, tileh)
 
			)) {
 
		return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
 
	if (tileh != SLOPE_FLAT) {
 
		if (!_settings_game.construction.build_on_slopes || !CanBuildDepotByTileh(dir, tileh)) {
 
			return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
 
		}
 
		cost.AddCost(_price[PR_BUILD_FOUNDATION]);
 
	}
 

	
 
	CommandCost cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
	cost.AddCost(DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR));
 
	if (cost.Failed()) return cost;
 

	
 
	if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
src/road_cmd.cpp
Show inline comments
 
@@ -1017,15 +1017,17 @@ CommandCost CmdBuildRoadDepot(TileIndex 
 

	
 
	if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
 

	
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 

	
 
	Slope tileh = GetTileSlope(tile);
 
	if (tileh != SLOPE_FLAT && (
 
				!_settings_game.construction.build_on_slopes ||
 
				!CanBuildDepotByTileh(dir, tileh)
 
			)) {
 
		return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
 
	if (tileh != SLOPE_FLAT) {
 
		if (!_settings_game.construction.build_on_slopes || !CanBuildDepotByTileh(dir, tileh)) {
 
			return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
 
		}
 
		cost.AddCost(_price[PR_BUILD_FOUNDATION]);
 
	}
 

	
 
	CommandCost cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
	cost.AddCost(DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR));
 
	if (cost.Failed()) return cost;
 

	
 
	if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
0 comments (0 inline, 0 general)