mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Un-bitstuff landscape commands.
This commit is contained in:
parent
e6e69d5289
commit
c6d7b98808
|
@ -382,7 +382,7 @@ static void ChangeTileOwner_Clear(TileIndex tile, Owner old_owner, Owner new_own
|
|||
|
||||
static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
extern const TileTypeProcs _tile_type_clear_procs = {
|
||||
|
|
|
@ -62,7 +62,7 @@ static void DisasterClearSquare(TileIndex tile)
|
|||
case MP_RAILWAY:
|
||||
if (Company::IsHumanID(GetTileOwner(tile)) && !IsRailDepot(tile)) {
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_WATER, FILE_LINE);
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile);
|
||||
cur_company.Restore();
|
||||
|
||||
/* update signals in buffer */
|
||||
|
@ -72,7 +72,7 @@ static void DisasterClearSquare(TileIndex tile)
|
|||
|
||||
case MP_HOUSE: {
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile);
|
||||
cur_company.Restore();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1103,7 +1103,7 @@ static bool SearchLumberMillTrees(TileIndex tile, void *user_data)
|
|||
_industry_sound_tile = tile;
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_38_LUMBER_MILL_1, tile);
|
||||
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile);
|
||||
|
||||
cur_company.Restore();
|
||||
return true;
|
||||
|
@ -1485,13 +1485,13 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
|
|||
|
||||
/* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_NONE, cur_tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_NONE, cur_tile);
|
||||
cur_company.Restore();
|
||||
|
||||
if (ret.Failed()) return ret;
|
||||
} else {
|
||||
/* Clear the tiles, but do not affect town ratings */
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, cur_tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, cur_tile);
|
||||
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
|
@ -1601,7 +1601,7 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags,
|
|||
}
|
||||
/* This is not 100% correct check, but the best we can do without modifying the map.
|
||||
* What is missing, is if the difference in height is more than 1.. */
|
||||
if (Command<CMD_TERRAFORM_LAND>::Do(flags & ~DC_EXEC, tile_walk, SLOPE_N, (curh > h) ? 0 : 1, {}).Failed()) {
|
||||
if (Command<CMD_TERRAFORM_LAND>::Do(flags & ~DC_EXEC, tile_walk, SLOPE_N, curh <= h).Failed()) {
|
||||
cur_company.Restore();
|
||||
return false;
|
||||
}
|
||||
|
@ -1616,7 +1616,7 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags,
|
|||
/* We give the terraforming for free here, because we can't calculate
|
||||
* exact cost in the test-round, and as we all know, that will cause
|
||||
* a nice assert if they don't match ;) */
|
||||
Command<CMD_TERRAFORM_LAND>::Do(flags, tile_walk, SLOPE_N, (curh > h) ? 0 : 1, {});
|
||||
Command<CMD_TERRAFORM_LAND>::Do(flags, tile_walk, SLOPE_N, curh <= h);
|
||||
curh += (curh > h) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
@ -1886,7 +1886,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
|||
|
||||
WaterClass wc = (IsWaterTile(cur_tile) ? GetWaterClass(cur_tile) : WATER_CLASS_INVALID);
|
||||
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, cur_tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, cur_tile);
|
||||
|
||||
MakeIndustry(cur_tile, i->index, it.gfx, Random(), wc);
|
||||
|
||||
|
@ -3062,7 +3062,7 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, i
|
|||
}
|
||||
}
|
||||
}
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
extern const TileTypeProcs _tile_type_industry_procs = {
|
||||
|
|
|
@ -686,12 +686,9 @@ void ClearSnowLine()
|
|||
* Clear a piece of landscape
|
||||
* @param flags of operation to conduct
|
||||
* @param tile tile to clear
|
||||
* @param p1 unused
|
||||
* @param p2 unused
|
||||
* @param text unused
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||
CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile)
|
||||
{
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
bool do_clear = false;
|
||||
|
@ -735,15 +732,13 @@ CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile, uint32 p1, ui
|
|||
* Clear a big piece of landscape
|
||||
* @param flags of operation to conduct
|
||||
* @param tile end tile of area dragging
|
||||
* @param p1 start tile of area dragging
|
||||
* @param p2 various bitstuffed data.
|
||||
* bit 0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
|
||||
* @param text unused
|
||||
* @param start_tile start tile of area dragging
|
||||
* @param diagonal Whether to use the Orthogonal (false) or Diagonal (true) iterator.
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdClearArea(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||
CommandCost CmdClearArea(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, bool diagonal)
|
||||
{
|
||||
if (p1 >= MapSize()) return CMD_ERROR;
|
||||
if (start_tile >= MapSize()) return CMD_ERROR;
|
||||
|
||||
Money money = GetAvailableMoneyForCommand();
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
|
@ -753,10 +748,10 @@ CommandCost CmdClearArea(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
|
|||
const Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? nullptr : Company::GetIfValid(_current_company);
|
||||
int limit = (c == nullptr ? INT32_MAX : GB(c->clear_limit, 16, 16));
|
||||
|
||||
TileIterator *iter = HasBit(p2, 0) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(tile, p1);
|
||||
TileIterator *iter = diagonal ? (TileIterator *)new DiagonalTileIterator(tile, start_tile) : new OrthogonalTileIterator(tile, start_tile);
|
||||
for (; *iter != INVALID_TILE; ++(*iter)) {
|
||||
TileIndex t = *iter;
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags & ~DC_EXEC, t, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags & ~DC_EXEC, t);
|
||||
if (ret.Failed()) {
|
||||
last_error = ret;
|
||||
|
||||
|
@ -773,14 +768,14 @@ CommandCost CmdClearArea(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
|
|||
delete iter;
|
||||
return cost;
|
||||
}
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(flags, t, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(flags, t);
|
||||
|
||||
/* draw explosion animation...
|
||||
* Disable explosions when game is paused. Looks silly and blocks the view. */
|
||||
if ((t == tile || t == p1) && _pause_mode == PM_UNPAUSED) {
|
||||
if ((t == tile || t == start_tile) && _pause_mode == PM_UNPAUSED) {
|
||||
/* big explosion in two corners, or small explosion for single tiles */
|
||||
CreateEffectVehicleAbove(TileX(t) * TILE_SIZE + TILE_SIZE / 2, TileY(t) * TILE_SIZE + TILE_SIZE / 2, 2,
|
||||
TileX(tile) == TileX(p1) && TileY(tile) == TileY(p1) ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
|
||||
TileX(tile) == TileX(start_tile) && TileY(tile) == TileY(start_tile) ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
#include "command_type.h"
|
||||
|
||||
CommandProc CmdLandscapeClear;
|
||||
CommandProc CmdClearArea;
|
||||
CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile);
|
||||
CommandCost CmdClearArea(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, bool diagonal);
|
||||
|
||||
DEF_CMD_TRAIT(CMD_LANDSCAPE_CLEAR, CmdLandscapeClear, CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION)
|
||||
DEF_CMD_TRAIT(CMD_CLEAR_AREA, CmdClearArea, CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) // destroying multi-tile houses makes town rating differ between test and execution
|
||||
|
|
|
@ -78,7 +78,7 @@ static const uint MAX_MAP_SIZE = 1 << MAX_MAP_SIZE_BITS; ///< Maximal map s
|
|||
#define STRAIGHT_TRACK_LENGTH 7071/10000
|
||||
|
||||
/** Argument for CmdLevelLand describing what to do. */
|
||||
enum LevelMode {
|
||||
enum LevelMode : byte {
|
||||
LM_LEVEL, ///< Level the land.
|
||||
LM_LOWER, ///< Lower the land.
|
||||
LM_RAISE, ///< Raise the land.
|
||||
|
|
|
@ -192,7 +192,7 @@ public:
|
|||
Company *c = Company::GetIfValid(_local_company);
|
||||
if (c != nullptr) {
|
||||
assert(_current_company == _local_company);
|
||||
CommandCost costclear = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_QUERY_COST, tile, 0, 0, {});
|
||||
CommandCost costclear = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_QUERY_COST, tile);
|
||||
if (costclear.Succeeded()) {
|
||||
Money cost = costclear.GetCost();
|
||||
if (cost < 0) {
|
||||
|
|
|
@ -231,7 +231,7 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, uint32 p1, uint3
|
|||
|
||||
if (type == OBJECT_OWNED_LAND) {
|
||||
/* Owned land is special as it can be placed on any slope. */
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {}));
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile));
|
||||
} else {
|
||||
/* Check the surface to build on. At this time we can't actually execute the
|
||||
* the CLEAR_TILE commands since the newgrf callback later on can check
|
||||
|
@ -244,7 +244,7 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, uint32 p1, uint3
|
|||
if (!IsWaterTile(t)) {
|
||||
/* Normal water tiles don't have to be cleared. For all other tile types clear
|
||||
* the tile but leave the water. */
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags & ~DC_NO_WATER & ~DC_EXEC, t, 0, 0, {}));
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags & ~DC_NO_WATER & ~DC_EXEC, t));
|
||||
} else {
|
||||
/* Can't build on water owned by another company. */
|
||||
Owner o = GetTileOwner(t);
|
||||
|
@ -262,7 +262,7 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, uint32 p1, uint3
|
|||
IsTileType(t, MP_OBJECT) &&
|
||||
IsTileOwner(t, _current_company) &&
|
||||
IsObjectType(t, OBJECT_HQ))) {
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags & ~DC_EXEC, t, 0, 0, {}));
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags & ~DC_EXEC, t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -294,10 +294,10 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, uint32 p1, uint3
|
|||
for (TileIndex t : ta) {
|
||||
if (HasTileWaterGround(t)) {
|
||||
if (!IsWaterTile(t)) {
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do((flags & ~DC_NO_WATER) | DC_NO_MODIFY_TOWN_RATING, t, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do((flags & ~DC_NO_WATER) | DC_NO_MODIFY_TOWN_RATING, t);
|
||||
}
|
||||
} else {
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_NO_MODIFY_TOWN_RATING, t, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_NO_MODIFY_TOWN_RATING, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, int
|
|||
}
|
||||
}
|
||||
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
extern const TileTypeProcs _tile_type_object_procs = {
|
||||
|
|
|
@ -448,7 +448,7 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai
|
|||
CommandCost ret = CheckTileOwnership(tile);
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
if (!IsPlainRail(tile)) return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {}); // just get appropriate error message
|
||||
if (!IsPlainRail(tile)) return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile); // just get appropriate error message
|
||||
|
||||
if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION);
|
||||
|
||||
|
@ -578,7 +578,7 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai
|
|||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
|
||||
|
@ -987,7 +987,7 @@ CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType rai
|
|||
cost.AddCost(_price[PR_BUILD_FOUNDATION]);
|
||||
}
|
||||
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {}));
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile));
|
||||
if (cost.Failed()) return cost;
|
||||
|
||||
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
|
@ -2882,7 +2882,7 @@ static void ChangeTileOwner_Track(TileIndex tile, Owner old_owner, Owner new_own
|
|||
|
||||
SetTileOwner(tile, new_owner);
|
||||
} else {
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3070,7 +3070,7 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int
|
|||
AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, GetRailDepotDirection(tile))) {
|
||||
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
||||
}
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
|
|||
|
||||
if (!IsTileType(tile, MP_ROAD)) {
|
||||
/* If it's the last roadtype, just clear the whole tile */
|
||||
if (GetRoadType(tile, OtherRoadTramType(rtt)) == INVALID_ROADTYPE) return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
if (GetRoadType(tile, OtherRoadTramType(rtt)) == INVALID_ROADTYPE) return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
||||
|
@ -817,7 +817,7 @@ do_clear:;
|
|||
}
|
||||
|
||||
if (need_to_clear) {
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ CommandCost CmdBuildRoadDepot(DoCommandFlag flags, TileIndex tile, RoadType rt,
|
|||
cost.AddCost(_price[PR_BUILD_FOUNDATION]);
|
||||
}
|
||||
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {}));
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile));
|
||||
if (cost.Failed()) return cost;
|
||||
|
||||
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
|
@ -1239,7 +1239,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags)
|
|||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -2167,7 +2167,7 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
|
|||
if (IsRoadDepot(tile)) {
|
||||
if (GetTileOwner(tile) == old_owner) {
|
||||
if (new_owner == INVALID_OWNER) {
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile);
|
||||
} else {
|
||||
/* A road depot has two road bits. No need to dirty windows here, we'll redraw the whole screen anyway. */
|
||||
RoadType rt = GetRoadTypeRoad(tile);
|
||||
|
@ -2253,7 +2253,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, int z
|
|||
}
|
||||
}
|
||||
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
/** Update power of road vehicle under which is the roadtype being converted */
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
EnforcePrecondition(false, ::IsValidTile(tile))
|
||||
EnforcePrecondition(false, IsAirportTile(tile) || IsHangarTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptAirport::GetNumHangars(TileIndex tile)
|
||||
|
|
|
@ -121,7 +121,7 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
|
|||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsBridgeTile(tile));
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ char *ScriptBridge::GetName(BridgeID bridge_id, ScriptVehicle::VehicleType vehicle_type)
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, IsWaterDepotTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptMarine::RemoveDock(TileIndex tile)
|
||||
|
@ -134,7 +134,7 @@
|
|||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, IsDockTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptMarine::RemoveBuoy(TileIndex tile)
|
||||
|
@ -143,7 +143,7 @@
|
|||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, IsBuoyTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptMarine::RemoveLock(TileIndex tile)
|
||||
|
@ -152,7 +152,7 @@
|
|||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, IsLockTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptMarine::RemoveCanal(TileIndex tile)
|
||||
|
@ -161,7 +161,7 @@
|
|||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, IsCanalTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ Money ScriptMarine::GetBuildCost(BuildType build_type)
|
||||
|
|
|
@ -593,7 +593,7 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD
|
|||
EnforcePrecondition(false, IsTileType(tile, MP_ROAD))
|
||||
EnforcePrecondition(false, GetRoadTileType(tile) == ROAD_TILE_DEPOT);
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptRoad::RemoveRoadStation(TileIndex tile)
|
||||
|
|
|
@ -255,7 +255,7 @@
|
|||
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
|
||||
EnforcePrecondition(false, tile < ::MapSize());
|
||||
|
||||
return ScriptObject::Command<CMD_TERRAFORM_LAND>::Do(tile, slope, 1, {});
|
||||
return ScriptObject::Command<CMD_TERRAFORM_LAND>::Do(tile, (::Slope)slope, true);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTile::LowerTile(TileIndex tile, int32 slope)
|
||||
|
@ -263,7 +263,7 @@
|
|||
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
|
||||
EnforcePrecondition(false, tile < ::MapSize());
|
||||
|
||||
return ScriptObject::Command<CMD_TERRAFORM_LAND>::Do(tile, slope, 0, {});
|
||||
return ScriptObject::Command<CMD_TERRAFORM_LAND>::Do(tile, (::Slope)slope, false);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTile::LevelTiles(TileIndex start_tile, TileIndex end_tile)
|
||||
|
@ -272,14 +272,14 @@
|
|||
EnforcePrecondition(false, start_tile < ::MapSize());
|
||||
EnforcePrecondition(false, end_tile < ::MapSize());
|
||||
|
||||
return ScriptObject::Command<CMD_LEVEL_LAND>::Do(end_tile, start_tile, LM_LEVEL << 1, {});
|
||||
return ScriptObject::Command<CMD_LEVEL_LAND>::Do(end_tile, start_tile, false, LM_LEVEL);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTile::DemolishTile(TileIndex tile)
|
||||
{
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTile::PlantTree(TileIndex tile)
|
||||
|
|
|
@ -126,5 +126,5 @@ static void _DoCommandReturnBuildTunnel1(class ScriptInstance *instance)
|
|||
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsTunnelTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile, 0, 0, {});
|
||||
return ScriptObject::Command<CMD_LANDSCAPE_CLEAR>::Do(tile);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ enum Corner {
|
|||
* slopes would mean that it is not a steep slope as halftile
|
||||
* slopes only span one height level.
|
||||
*/
|
||||
enum Slope {
|
||||
enum Slope : byte {
|
||||
SLOPE_FLAT = 0x00, ///< a flat tile
|
||||
SLOPE_W = 0x01, ///< the west corner of the tile is raised
|
||||
SLOPE_S = 0x02, ///< the south corner of the tile is raised
|
||||
|
|
|
@ -845,7 +845,7 @@ static CommandCost CheckFlatLandAirport(AirportTileTableIterator tile_iter, DoCo
|
|||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_iter, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_iter);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
}
|
||||
|
@ -932,7 +932,7 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
|
|||
continue;
|
||||
}
|
||||
}
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_cur, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_cur);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
}
|
||||
|
@ -1050,7 +1050,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
|
|||
cost.AddCost(RoadBuildCost(rt) * 2);
|
||||
}
|
||||
} else {
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, cur_tile, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, cur_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
cost.AddCost(RoadBuildCost(rt) * 2);
|
||||
|
@ -2489,7 +2489,7 @@ CommandCost CmdBuildDock(DoCommandFlag flags, TileIndex tile, StationID station_
|
|||
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
|
||||
|
@ -2504,7 +2504,7 @@ CommandCost CmdBuildDock(DoCommandFlag flags, TileIndex tile, StationID station_
|
|||
/* Get the water class of the water tile before it is cleared.*/
|
||||
WaterClass wc = GetWaterClass(tile_cur);
|
||||
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_cur, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_cur);
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
tile_cur += TileOffsByDiagDir(direction);
|
||||
|
@ -4197,7 +4197,7 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o
|
|||
/* Change owner of tile and all roadtypes */
|
||||
ChangeTileOwner(tile, old_owner, new_owner);
|
||||
} else {
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile);
|
||||
/* Set tile owner of water under (now removed) buoy and dock to OWNER_NONE.
|
||||
* Update owner of buoy if it was not removed (was in orders).
|
||||
* Do not update when owned by OWNER_WATER (sea and rivers). */
|
||||
|
@ -4314,7 +4314,7 @@ static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, in
|
|||
}
|
||||
}
|
||||
}
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -182,42 +182,41 @@ static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int
|
|||
* Terraform land
|
||||
* @param flags for this command type
|
||||
* @param tile tile to terraform
|
||||
* @param p1 corners to terraform (SLOPE_xxx)
|
||||
* @param p2 direction; eg up (non-zero) or down (zero)
|
||||
* @param text unused
|
||||
* @param slope corners to terraform (SLOPE_xxx)
|
||||
* @param dir_up direction; eg up (true) or down (false)
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdTerraformLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||
CommandCost CmdTerraformLand(DoCommandFlag flags, TileIndex tile, Slope slope, bool dir_up)
|
||||
{
|
||||
_terraform_err_tile = INVALID_TILE;
|
||||
|
||||
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
||||
int direction = (p2 != 0 ? 1 : -1);
|
||||
int direction = (dir_up ? 1 : -1);
|
||||
TerraformerState ts;
|
||||
|
||||
/* Compute the costs and the terraforming result in a model of the landscape */
|
||||
if ((p1 & SLOPE_W) != 0 && tile + TileDiffXY(1, 0) < MapSize()) {
|
||||
if ((slope & SLOPE_W) != 0 && tile + TileDiffXY(1, 0) < MapSize()) {
|
||||
TileIndex t = tile + TileDiffXY(1, 0);
|
||||
CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction);
|
||||
if (cost.Failed()) return cost;
|
||||
total_cost.AddCost(cost);
|
||||
}
|
||||
|
||||
if ((p1 & SLOPE_S) != 0 && tile + TileDiffXY(1, 1) < MapSize()) {
|
||||
if ((slope & SLOPE_S) != 0 && tile + TileDiffXY(1, 1) < MapSize()) {
|
||||
TileIndex t = tile + TileDiffXY(1, 1);
|
||||
CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction);
|
||||
if (cost.Failed()) return cost;
|
||||
total_cost.AddCost(cost);
|
||||
}
|
||||
|
||||
if ((p1 & SLOPE_E) != 0 && tile + TileDiffXY(0, 1) < MapSize()) {
|
||||
if ((slope & SLOPE_E) != 0 && tile + TileDiffXY(0, 1) < MapSize()) {
|
||||
TileIndex t = tile + TileDiffXY(0, 1);
|
||||
CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction);
|
||||
if (cost.Failed()) return cost;
|
||||
total_cost.AddCost(cost);
|
||||
}
|
||||
|
||||
if ((p1 & SLOPE_N) != 0) {
|
||||
if ((slope & SLOPE_N) != 0) {
|
||||
TileIndex t = tile + TileDiffXY(0, 0);
|
||||
CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction);
|
||||
if (cost.Failed()) return cost;
|
||||
|
@ -291,7 +290,7 @@ CommandCost CmdTerraformLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uin
|
|||
}
|
||||
CommandCost cost;
|
||||
if (indirectly_cleared) {
|
||||
cost = Command<CMD_LANDSCAPE_CLEAR>::Do(tile_flags, t, 0, 0, {});
|
||||
cost = Command<CMD_LANDSCAPE_CLEAR>::Do(tile_flags, t);
|
||||
} else {
|
||||
cost = _tile_type_procs[GetTileType(t)]->terraform_tile_proc(t, tile_flags, z_min, tileh);
|
||||
}
|
||||
|
@ -337,25 +336,22 @@ CommandCost CmdTerraformLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uin
|
|||
* Levels a selected (rectangle) area of land
|
||||
* @param flags for this command type
|
||||
* @param tile end tile of area-drag
|
||||
* @param p1 start tile of area drag
|
||||
* @param p2 various bitstuffed data.
|
||||
* bit 0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
|
||||
* bits 1 - 2: Mode of leveling \c LevelMode.
|
||||
* @param text unused
|
||||
* @param start_tile start tile of area drag
|
||||
* @param diagonal Whether to use the Orthogonal (false) or Diagonal (true) iterator.
|
||||
* @param LevelMode Mode of leveling \c LevelMode.
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdLevelLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||
CommandCost CmdLevelLand(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, bool diagonal, LevelMode lm)
|
||||
{
|
||||
if (p1 >= MapSize()) return CMD_ERROR;
|
||||
if (start_tile >= MapSize()) return CMD_ERROR;
|
||||
|
||||
_terraform_err_tile = INVALID_TILE;
|
||||
|
||||
/* remember level height */
|
||||
uint oldh = TileHeight(p1);
|
||||
uint oldh = TileHeight(start_tile);
|
||||
|
||||
/* compute new height */
|
||||
uint h = oldh;
|
||||
LevelMode lm = (LevelMode)GB(p2, 1, 2);
|
||||
switch (lm) {
|
||||
case LM_LEVEL: break;
|
||||
case LM_RAISE: h++; break;
|
||||
|
@ -375,12 +371,12 @@ CommandCost CmdLevelLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
|
|||
int limit = (c == nullptr ? INT32_MAX : GB(c->terraform_limit, 16, 16));
|
||||
if (limit == 0) return_cmd_error(STR_ERROR_TERRAFORM_LIMIT_REACHED);
|
||||
|
||||
TileIterator *iter = HasBit(p2, 0) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(tile, p1);
|
||||
TileIterator *iter = diagonal ? (TileIterator *)new DiagonalTileIterator(tile, start_tile) : new OrthogonalTileIterator(tile, start_tile);
|
||||
for (; *iter != INVALID_TILE; ++(*iter)) {
|
||||
TileIndex t = *iter;
|
||||
uint curh = TileHeight(t);
|
||||
while (curh != h) {
|
||||
CommandCost ret = Command<CMD_TERRAFORM_LAND>::Do(flags & ~DC_EXEC, t, SLOPE_N, (curh > h) ? 0 : 1, {});
|
||||
CommandCost ret = Command<CMD_TERRAFORM_LAND>::Do(flags & ~DC_EXEC, t, SLOPE_N, curh <= h);
|
||||
if (ret.Failed()) {
|
||||
last_error = ret;
|
||||
|
||||
|
@ -396,7 +392,7 @@ CommandCost CmdLevelLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
|
|||
delete iter;
|
||||
return cost;
|
||||
}
|
||||
Command<CMD_TERRAFORM_LAND>::Do(flags, t, SLOPE_N, (curh > h) ? 0 : 1, {});
|
||||
Command<CMD_TERRAFORM_LAND>::Do(flags, t, SLOPE_N, curh <= h);
|
||||
} else {
|
||||
/* When we're at the terraform limit we better bail (unneeded) testing as well.
|
||||
* This will probably cause the terraforming cost to be underestimated, but only
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
#define TERRAFORM_CMD_H
|
||||
|
||||
#include "command_type.h"
|
||||
#include "map_type.h"
|
||||
#include "slope_type.h"
|
||||
|
||||
CommandProc CmdTerraformLand;
|
||||
CommandProc CmdLevelLand;
|
||||
CommandCost CmdTerraformLand(DoCommandFlag flags, TileIndex tile, Slope slope, bool dir_up);
|
||||
CommandCost CmdLevelLand(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, bool diagonal, LevelMode lm);
|
||||
|
||||
DEF_CMD_TRAIT(CMD_TERRAFORM_LAND, CmdTerraformLand, CMD_ALL_TILES | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
|
||||
DEF_CMD_TRAIT(CMD_LEVEL_LAND, CmdLevelLand, CMD_ALL_TILES | CMD_AUTO | CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) // test run might clear tiles multiple times, in execution that only happens once
|
||||
|
|
|
@ -65,7 +65,7 @@ static void GenerateDesertArea(TileIndex end, TileIndex start)
|
|||
TileArea ta(start, end);
|
||||
for (TileIndex tile : ta) {
|
||||
SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Post(tile, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Post(tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
old_generating_world.Restore();
|
||||
|
@ -120,16 +120,16 @@ bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_t
|
|||
|
||||
switch (proc) {
|
||||
case DDSP_DEMOLISH_AREA:
|
||||
Command<CMD_CLEAR_AREA>::Post(STR_ERROR_CAN_T_CLEAR_THIS_AREA, CcPlaySound_EXPLOSION, end_tile, start_tile, _ctrl_pressed ? 1 : 0, {});
|
||||
Command<CMD_CLEAR_AREA>::Post(STR_ERROR_CAN_T_CLEAR_THIS_AREA, CcPlaySound_EXPLOSION, end_tile, start_tile, _ctrl_pressed);
|
||||
break;
|
||||
case DDSP_RAISE_AND_LEVEL_AREA:
|
||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_RAISE_LAND_HERE, CcTerraform, end_tile, start_tile, LM_RAISE << 1 | (_ctrl_pressed ? 1 : 0), {});
|
||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_RAISE_LAND_HERE, CcTerraform, end_tile, start_tile, _ctrl_pressed, LM_RAISE);
|
||||
break;
|
||||
case DDSP_LOWER_AND_LEVEL_AREA:
|
||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LOWER_LAND_HERE, CcTerraform, end_tile, start_tile, LM_LOWER << 1 | (_ctrl_pressed ? 1 : 0), {});
|
||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LOWER_LAND_HERE, CcTerraform, end_tile, start_tile, _ctrl_pressed, LM_LOWER);
|
||||
break;
|
||||
case DDSP_LEVEL_AREA:
|
||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LEVEL_LAND_HERE, CcTerraform, end_tile, start_tile, LM_LEVEL << 1 | (_ctrl_pressed ? 1 : 0), {});
|
||||
Command<CMD_LEVEL_LAND>::Post(STR_ERROR_CAN_T_LEVEL_LAND_HERE, CcTerraform, end_tile, start_tile, _ctrl_pressed, LM_LEVEL);
|
||||
break;
|
||||
case DDSP_CREATE_ROCKS:
|
||||
GenerateRockyArea(end_tile, start_tile);
|
||||
|
@ -392,15 +392,15 @@ static byte _terraform_size = 1;
|
|||
* @todo : Incorporate into game itself to allow for ingame raising/lowering of
|
||||
* larger chunks at the same time OR remove altogether, as we have 'level land' ?
|
||||
* @param tile The top-left tile where the terraforming will start
|
||||
* @param mode 1 for raising, 0 for lowering land
|
||||
* @param mode true for raising, false for lowering land
|
||||
*/
|
||||
static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
|
||||
static void CommonRaiseLowerBigLand(TileIndex tile, bool mode)
|
||||
{
|
||||
if (_terraform_size == 1) {
|
||||
StringID msg =
|
||||
mode ? STR_ERROR_CAN_T_RAISE_LAND_HERE : STR_ERROR_CAN_T_LOWER_LAND_HERE;
|
||||
|
||||
Command<CMD_TERRAFORM_LAND>::Post(msg, CcTerraform, tile, SLOPE_N, (uint32)mode, {});
|
||||
Command<CMD_TERRAFORM_LAND>::Post(msg, CcTerraform, tile, SLOPE_N, mode);
|
||||
} else {
|
||||
assert(_terraform_size != 0);
|
||||
TileArea ta(tile, _terraform_size, _terraform_size);
|
||||
|
@ -427,7 +427,7 @@ static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
|
|||
|
||||
for (TileIndex tile2 : ta) {
|
||||
if (TileHeight(tile2) == h) {
|
||||
Command<CMD_TERRAFORM_LAND>::Post(tile2, SLOPE_N, (uint32)mode, {});
|
||||
Command<CMD_TERRAFORM_LAND>::Post(tile2, SLOPE_N, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
|
|||
/* Delete all station signs */
|
||||
for (BaseStation *st : BaseStation::Iterate()) {
|
||||
/* There can be buoys, remove them */
|
||||
if (IsBuoyTile(st->xy)) Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, st->xy, 0, 0, {});
|
||||
if (IsBuoyTile(st->xy)) Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, st->xy);
|
||||
if (!st->IsInUse()) delete st;
|
||||
}
|
||||
|
||||
|
@ -659,11 +659,11 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
|||
break;
|
||||
|
||||
case WID_ETT_LOWER_LAND: // Lower land button
|
||||
CommonRaiseLowerBigLand(tile, 0);
|
||||
CommonRaiseLowerBigLand(tile, false);
|
||||
break;
|
||||
|
||||
case WID_ETT_RAISE_LAND: // Raise land button
|
||||
CommonRaiseLowerBigLand(tile, 1);
|
||||
CommonRaiseLowerBigLand(tile, true);
|
||||
break;
|
||||
|
||||
case WID_ETT_LEVEL_LAND: // Level land button
|
||||
|
|
|
@ -944,7 +944,7 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
|
|||
* This is to make sure that we can build a road here later. */
|
||||
RoadType rt = GetTownRoadType(t);
|
||||
if (Command<CMD_BUILD_ROAD>::Do(DC_AUTO | DC_NO_WATER, tile, (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X, rt, DRD_NONE, 0).Failed() &&
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile, 0, 0, {}).Failed()) {
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile).Failed()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
|
|||
if (!_generating_world && Chance16(1, 10)) {
|
||||
/* Note: Do not replace "^ SLOPE_ELEVATED" with ComplementSlope(). The slope might be steep. */
|
||||
res = Command<CMD_TERRAFORM_LAND>::Do(DC_EXEC | DC_AUTO | DC_NO_WATER,
|
||||
tile, Chance16(1, 16) ? cur_slope : cur_slope ^ SLOPE_ELEVATED, 0, {});
|
||||
tile, Chance16(1, 16) ? cur_slope : cur_slope ^ SLOPE_ELEVATED, false);
|
||||
}
|
||||
if (res.Failed() && Chance16(1, 3)) {
|
||||
/* We can consider building on the slope, though. */
|
||||
|
@ -974,13 +974,13 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool TerraformTownTile(TileIndex tile, int edges, int dir)
|
||||
static bool TerraformTownTile(TileIndex tile, Slope edges, bool dir)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
|
||||
CommandCost r = Command<CMD_TERRAFORM_LAND>::Do(DC_AUTO | DC_NO_WATER, tile, edges, dir, {});
|
||||
CommandCost r = Command<CMD_TERRAFORM_LAND>::Do(DC_AUTO | DC_NO_WATER, tile, edges, dir);
|
||||
if (r.Failed() || r.GetCost() >= (_price[PR_TERRAFORM] + 2) * 8) return false;
|
||||
Command<CMD_TERRAFORM_LAND>::Do(DC_AUTO | DC_NO_WATER | DC_EXEC, tile, edges, dir, {});
|
||||
Command<CMD_TERRAFORM_LAND>::Do(DC_AUTO | DC_NO_WATER | DC_EXEC, tile, edges, dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -994,8 +994,8 @@ static void LevelTownLand(TileIndex tile)
|
|||
if (tileh == SLOPE_FLAT) return;
|
||||
|
||||
/* First try up, then down */
|
||||
if (!TerraformTownTile(tile, ~tileh & SLOPE_ELEVATED, 1)) {
|
||||
TerraformTownTile(tile, tileh & SLOPE_ELEVATED, 0);
|
||||
if (!TerraformTownTile(tile, ~tileh & SLOPE_ELEVATED, true)) {
|
||||
TerraformTownTile(tile, tileh & SLOPE_ELEVATED, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1737,7 +1737,7 @@ static bool GrowTown(Town *t)
|
|||
for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) {
|
||||
/* Only work with plain land that not already has a house */
|
||||
if (!IsTileType(tile, MP_HOUSE) && IsTileFlat(tile)) {
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile, 0, 0, {}).Succeeded()) {
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile).Succeeded()) {
|
||||
RoadType rt = GetTownRoadType(t);
|
||||
Command<CMD_BUILD_ROAD>::Do(DC_EXEC | DC_AUTO, tile, GenRandomRoadBits(), rt, DRD_NONE, t->index);
|
||||
cur_company.Restore();
|
||||
|
@ -2280,7 +2280,7 @@ HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
|
|||
*/
|
||||
static inline void ClearMakeHouseTile(TileIndex tile, Town *t, byte counter, byte stage, HouseID type, byte random_bits)
|
||||
{
|
||||
[[maybe_unused]] CommandCost cc = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_AUTO | DC_NO_WATER, tile, 0, 0, {});
|
||||
[[maybe_unused]] CommandCost cc = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_AUTO | DC_NO_WATER, tile);
|
||||
assert(cc.Succeeded());
|
||||
|
||||
IncreaseBuildingCount(t, type);
|
||||
|
@ -2337,7 +2337,7 @@ static inline bool CanBuildHouseHere(TileIndex tile, bool noslope)
|
|||
if (IsBridgeAbove(tile)) return false;
|
||||
|
||||
/* can we clear the land? */
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile, 0, 0, {}).Succeeded();
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile).Succeeded();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2955,7 +2955,7 @@ CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id)
|
|||
/* Non-oil rig stations are always a problem. */
|
||||
if (!(st->facilities & FACIL_AIRPORT) || st->airport.type != AT_OILRIG) return CMD_ERROR;
|
||||
/* We can only automatically delete oil rigs *if* there's no vehicle on them. */
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, st->airport.tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, st->airport.tile);
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
}
|
||||
|
@ -2971,7 +2971,7 @@ CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id)
|
|||
* tile was already deleted earlier in the loop. */
|
||||
for (TileIndex current_tile = 0; current_tile < MapSize(); ++current_tile) {
|
||||
if (IsTileType(current_tile, MP_TUNNELBRIDGE) && TestTownOwnsBridge(current_tile, t)) {
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
}
|
||||
|
@ -3014,7 +3014,7 @@ CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id)
|
|||
break;
|
||||
}
|
||||
if (try_clear) {
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
}
|
||||
|
@ -3090,7 +3090,7 @@ static CommandCost TownActionRoadRebuild(Town *t, DoCommandFlag flags)
|
|||
static bool TryClearTile(TileIndex tile)
|
||||
{
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
CommandCost r = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_NONE, tile, 0, 0, {});
|
||||
CommandCost r = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_NONE, tile);
|
||||
cur_company.Restore();
|
||||
return r.Succeeded();
|
||||
}
|
||||
|
@ -3162,7 +3162,7 @@ static CommandCost TownActionBuildStatue(Town *t, DoCommandFlag flags)
|
|||
|
||||
if (flags & DC_EXEC) {
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, statue_data.best_position, 0, 0, {});
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, statue_data.best_position);
|
||||
cur_company.Restore();
|
||||
BuildObject(OBJECT_STATUE, statue_data.best_position, _current_company, t);
|
||||
SetBit(t->statues, _current_company); // Once found and built, "inform" the Town.
|
||||
|
@ -3767,7 +3767,7 @@ static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, int z
|
|||
}
|
||||
}
|
||||
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
/** Tile callback functions for a town */
|
||||
|
|
|
@ -462,7 +462,7 @@ CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
|
|||
switch (GetRawClearGround(current_tile)) {
|
||||
case CLEAR_FIELDS:
|
||||
case CLEAR_ROCKS: {
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
break;
|
||||
|
@ -883,7 +883,7 @@ void InitializeTrees()
|
|||
|
||||
static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex tile_end, TileIndex ti
|
|||
bool allow_on_slopes = (_settings_game.construction.build_on_slopes && transport_type != TRANSPORT_WATER);
|
||||
|
||||
/* Try and clear the start landscape */
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_start, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_start);
|
||||
if (ret.Failed()) return ret;
|
||||
cost = ret;
|
||||
|
||||
|
@ -420,7 +420,7 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex tile_end, TileIndex ti
|
|||
cost.AddCost(terraform_cost_north);
|
||||
|
||||
/* Try and clear the end landscape */
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_end, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_end);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
|
||||
|
@ -492,7 +492,7 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex tile_end, TileIndex ti
|
|||
default:
|
||||
not_valid_below:;
|
||||
/* try and clear the middle landscape */
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
break;
|
||||
|
@ -663,7 +663,7 @@ CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, TransportT
|
|||
|
||||
if (HasTileWaterGround(start_tile)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, start_tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, start_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
/* XXX - do NOT change 'ret' in the loop, as it is used as the price
|
||||
|
@ -723,7 +723,7 @@ CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, TransportT
|
|||
if (HasTileWaterGround(end_tile)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||
|
||||
/* Clear the tile in any case */
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, end_tile, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, end_tile);
|
||||
if (ret.Failed()) return_cmd_error(STR_ERROR_UNABLE_TO_EXCAVATE_LAND);
|
||||
cost.AddCost(ret);
|
||||
|
||||
|
@ -755,7 +755,7 @@ CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, TransportT
|
|||
assert(coa_index < UINT_MAX); // more than 2**32 cleared areas would be a bug in itself
|
||||
coa = nullptr;
|
||||
|
||||
ret = Command<CMD_TERRAFORM_LAND>::Do(flags, end_tile, end_tileh & start_tileh, 0, {});
|
||||
ret = Command<CMD_TERRAFORM_LAND>::Do(flags, end_tile, end_tileh & start_tileh, false);
|
||||
_cleared_object_areas[(uint)coa_index].first_tile = old_first_tile;
|
||||
if (ret.Failed()) return_cmd_error(STR_ERROR_UNABLE_TO_EXCAVATE_LAND);
|
||||
cost.AddCost(ret);
|
||||
|
@ -1837,7 +1837,7 @@ static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner
|
|||
if (tt == TRANSPORT_RAIL) {
|
||||
/* Since all of our vehicles have been removed, it is safe to remove the rail
|
||||
* bridge / tunnel. */
|
||||
[[maybe_unused]] CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile, 0, 0, {});
|
||||
[[maybe_unused]] CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile);
|
||||
assert(ret.Succeeded());
|
||||
} else {
|
||||
/* In any other case, we can safely reassign the ownership to OWNER_NONE. */
|
||||
|
@ -2028,7 +2028,7 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag
|
|||
if (res.Succeeded() && (z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
||||
}
|
||||
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
}
|
||||
|
||||
extern const TileTypeProcs _tile_type_tunnelbridge_procs = {
|
||||
|
|
|
@ -121,13 +121,13 @@ CommandCost CmdBuildShipDepot(DoCommandFlag flags, TileIndex tile, Axis axis)
|
|||
CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_DEPOT_SHIP]);
|
||||
|
||||
bool add_cost = !IsWaterTile(tile);
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_AUTO, tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_AUTO, tile);
|
||||
if (ret.Failed()) return ret;
|
||||
if (add_cost) {
|
||||
cost.AddCost(ret);
|
||||
}
|
||||
add_cost = !IsWaterTile(tile2);
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_AUTO, tile2, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_AUTO, tile2);
|
||||
if (ret.Failed()) return ret;
|
||||
if (add_cost) {
|
||||
cost.AddCost(ret);
|
||||
|
@ -305,13 +305,13 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
|
|||
|
||||
/* middle tile */
|
||||
WaterClass wc_middle = HasTileWaterGround(tile) ? GetWaterClass(tile) : WATER_CLASS_CANAL;
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
|
||||
/* lower tile */
|
||||
if (!IsWaterTile(tile - delta)) {
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile - delta, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile - delta);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
cost.AddCost(_price[PR_BUILD_CANAL]);
|
||||
|
@ -323,7 +323,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
|
|||
|
||||
/* upper tile */
|
||||
if (!IsWaterTile(tile + delta)) {
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile + delta, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile + delta);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
cost.AddCost(_price[PR_BUILD_CANAL]);
|
||||
|
@ -473,7 +473,7 @@ CommandCost CmdBuildCanal(DoCommandFlag flags, TileIndex tile, TileIndex start_t
|
|||
/* Outside the editor, prevent building canals over your own or OWNER_NONE owned canals */
|
||||
if (water && IsCanal(current_tile) && _game_mode != GM_EDITOR && (IsTileOwner(current_tile, _current_company) || IsTileOwner(current_tile, OWNER_NONE))) continue;
|
||||
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile, 0, 0, {});
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
if (!water) cost.AddCost(ret);
|
||||
|
@ -1128,7 +1128,7 @@ void DoFloodTile(TileIndex target)
|
|||
FALLTHROUGH;
|
||||
|
||||
case MP_CLEAR:
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, target, 0, 0, {}).Succeeded()) {
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, target).Succeeded()) {
|
||||
MakeShore(target);
|
||||
MarkTileDirtyByTile(target);
|
||||
flooded = true;
|
||||
|
@ -1143,7 +1143,7 @@ void DoFloodTile(TileIndex target)
|
|||
FloodVehicles(target);
|
||||
|
||||
/* flood flat tile */
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, target, 0, 0, {}).Succeeded()) {
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, target).Succeeded()) {
|
||||
MakeSea(target);
|
||||
MarkTileDirtyByTile(target);
|
||||
flooded = true;
|
||||
|
@ -1195,7 +1195,7 @@ static void DoDryUp(TileIndex tile)
|
|||
case MP_WATER:
|
||||
assert(IsCoast(tile));
|
||||
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile, 0, 0, {}).Succeeded()) {
|
||||
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile).Succeeded()) {
|
||||
MakeClear(tile, CLEAR_GRASS, 3);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ static void ChangeTileOwner_Water(TileIndex tile, Owner old_owner, Owner new_own
|
|||
}
|
||||
|
||||
/* Remove depot */
|
||||
if (IsShipDepot(tile)) Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile, 0, 0, {});
|
||||
if (IsShipDepot(tile)) Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile);
|
||||
|
||||
/* Set owner of canals and locks ... and also canal under dock there was before.
|
||||
* Check if the new owner after removing depot isn't OWNER_WATER. */
|
||||
|
@ -1374,7 +1374,7 @@ static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, int
|
|||
/* Canals can't be terraformed */
|
||||
if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
||||
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile, 0, 0, {});
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ CommandCost CmdBuildBuoy(DoCommandFlag flags, TileIndex tile)
|
|||
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_WAYPOINT_BUOY]);
|
||||
if (!IsWaterTile(tile)) {
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_AUTO, tile, 0, 0, {});
|
||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_AUTO, tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue