src/water_cmd.cpp
branchgamebalance
changeset 9903 dc85aaa556ae
parent 9896 2473804114de
child 9908 0fa543611bbe
equal deleted inserted replaced
9902:ed8f92929297 9903:dc85aaa556ae
    90 		MakeShipDepot(tile2, _current_player, DEPOT_SOUTH, axis);
    90 		MakeShipDepot(tile2, _current_player, DEPOT_SOUTH, axis);
    91 		MarkTileDirtyByTile(tile);
    91 		MarkTileDirtyByTile(tile);
    92 		MarkTileDirtyByTile(tile2);
    92 		MarkTileDirtyByTile(tile2);
    93 	}
    93 	}
    94 
    94 
    95 	return cost + _price.build_ship_depot;
    95 	return cost + _eco->GetPrice(CEconomy::BUILD_SHIP_DEPOT);
    96 }
    96 }
    97 
    97 
    98 static int32 RemoveShipDepot(TileIndex tile, uint32 flags)
    98 static int32 RemoveShipDepot(TileIndex tile, uint32 flags)
    99 {
    99 {
   100 	TileIndex tile2;
   100 	TileIndex tile2;
   115 		MakeWater(tile2);
   115 		MakeWater(tile2);
   116 		MarkTileDirtyByTile(tile);
   116 		MarkTileDirtyByTile(tile);
   117 		MarkTileDirtyByTile(tile2);
   117 		MarkTileDirtyByTile(tile2);
   118 	}
   118 	}
   119 
   119 
   120 	return _price.remove_ship_depot;
   120 	return _eco->GetPrice(CEconomy::REMOVE_SHIP_DEPOT);
   121 }
   121 }
   122 
   122 
   123 // build a shiplift
   123 // build a shiplift
   124 static int32 DoBuildShiplift(TileIndex tile, DiagDirection dir, uint32 flags)
   124 static int32 DoBuildShiplift(TileIndex tile, DiagDirection dir, uint32 flags)
   125 {
   125 {
   156 		MarkTileDirtyByTile(tile);
   156 		MarkTileDirtyByTile(tile);
   157 		MarkTileDirtyByTile(tile - delta);
   157 		MarkTileDirtyByTile(tile - delta);
   158 		MarkTileDirtyByTile(tile + delta);
   158 		MarkTileDirtyByTile(tile + delta);
   159 	}
   159 	}
   160 
   160 
   161 	return _price.clear_water * 22 >> 3;
   161 	return _eco->GetPrice(CEconomy::CLEAR_WATER) * 22 >> 3;
   162 }
   162 }
   163 
   163 
   164 static int32 RemoveShiplift(TileIndex tile, uint32 flags)
   164 static int32 RemoveShiplift(TileIndex tile, uint32 flags)
   165 {
   165 {
   166 	TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));
   166 	TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));
   175 		DoClearSquare(tile);
   175 		DoClearSquare(tile);
   176 		DoClearSquare(tile + delta);
   176 		DoClearSquare(tile + delta);
   177 		DoClearSquare(tile - delta);
   177 		DoClearSquare(tile - delta);
   178 	}
   178 	}
   179 
   179 
   180 	return _price.clear_water * 2;
   180 	return _eco->GetPrice(CEconomy::CLEAR_WATER) * 2;
   181 }
   181 }
   182 
   182 
   183 static void MarkTilesAroundDirty(TileIndex tile)
   183 static void MarkTilesAroundDirty(TileIndex tile)
   184 {
   184 {
   185 	MarkTileDirtyByTile(TILE_ADDXY(tile, 0, 1));
   185 	MarkTileDirtyByTile(TILE_ADDXY(tile, 0, 1));
   264 			}
   264 			}
   265 			MarkTileDirtyByTile(tile);
   265 			MarkTileDirtyByTile(tile);
   266 			MarkTilesAroundDirty(tile);
   266 			MarkTilesAroundDirty(tile);
   267 		}
   267 		}
   268 
   268 
   269 		cost += _price.clear_water;
   269 		cost += _eco->GetPrice(CEconomy::CLEAR_WATER);
   270 	} END_TILE_LOOP(tile, size_x, size_y, 0);
   270 	} END_TILE_LOOP(tile, size_x, size_y, 0);
   271 
   271 
   272 	if (cost == 0) {
   272 	if (cost == 0) {
   273 		return_cmd_error(STR_1007_ALREADY_BUILT);
   273 		return_cmd_error(STR_1007_ALREADY_BUILT);
   274 	} else {
   274 	} else {
   292 			}
   292 			}
   293 
   293 
   294 			if (GetTileOwner(tile) != OWNER_WATER && !CheckTileOwnership(tile)) return CMD_ERROR;
   294 			if (GetTileOwner(tile) != OWNER_WATER && !CheckTileOwnership(tile)) return CMD_ERROR;
   295 
   295 
   296 			if (flags & DC_EXEC) DoClearSquare(tile);
   296 			if (flags & DC_EXEC) DoClearSquare(tile);
   297 			return _price.clear_water;
   297 			return _eco->GetPrice(CEconomy::CLEAR_WATER);
   298 
   298 
   299 		case WATER_TILE_COAST: {
   299 		case WATER_TILE_COAST: {
   300 			Slope slope = GetTileSlope(tile, NULL);
   300 			Slope slope = GetTileSlope(tile, NULL);
   301 
   301 
   302 			// Make sure no vehicle is on the tile
   302 			// Make sure no vehicle is on the tile
   308 				return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
   308 				return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
   309 			}
   309 			}
   310 
   310 
   311 			if (flags & DC_EXEC) DoClearSquare(tile);
   311 			if (flags & DC_EXEC) DoClearSquare(tile);
   312 			if (slope == SLOPE_N || slope == SLOPE_E || slope == SLOPE_S || slope == SLOPE_W) {
   312 			if (slope == SLOPE_N || slope == SLOPE_E || slope == SLOPE_S || slope == SLOPE_W) {
   313 				return _price.clear_water;
   313 				return _eco->GetPrice(CEconomy::CLEAR_WATER);
   314 			} else {
   314 			} else {
   315 				return _price.purchase_land;
   315 				return _eco->GetPrice(CEconomy::PURCHASE_LAND);
   316 			}
   316 			}
   317 		}
   317 		}
   318 
   318 
   319 		case WATER_TILE_LOCK: {
   319 		case WATER_TILE_LOCK: {
   320 			static const TileIndexDiffC _shiplift_tomiddle_offs[] = {
   320 			static const TileIndexDiffC _shiplift_tomiddle_offs[] = {