From e4414471dd10c3afebc49f3cc7c51f76852b08e0 Mon Sep 17 00:00:00 2001 From: Max Maton Date: Tue, 3 Sep 2019 22:50:58 +0200 Subject: [PATCH] Add: Allow GameScript to demolish without a company This allows GameScripts to shrink towns as well as grow them. --- src/command.cpp | 2 +- src/script/api/ai_changelog.hpp | 3 +++ src/script/api/script_tile.cpp | 1 - src/script/api/script_tile.hpp | 1 - 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/command.cpp b/src/command.cpp index 2a0e264736..c4d3fa7ce1 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -216,7 +216,7 @@ static const Command _command_proc_table[] = { DEF_CMD(CmdRemoveRailroadTrack, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_RAILROAD_TRACK DEF_CMD(CmdBuildSingleRail, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_SINGLE_RAIL DEF_CMD(CmdRemoveSingleRail, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_SINGLE_RAIL - DEF_CMD(CmdLandscapeClear, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LANDSCAPE_CLEAR + DEF_CMD(CmdLandscapeClear, CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LANDSCAPE_CLEAR DEF_CMD(CmdBuildBridge, CMD_DEITY | CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_BRIDGE DEF_CMD(CmdBuildRailStation, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_RAIL_STATION DEF_CMD(CmdBuildTrainDepot, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_TRAIN_DEPOT diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp index 5aacf8e8c8..7258cf74e5 100644 --- a/src/script/api/ai_changelog.hpp +++ b/src/script/api/ai_changelog.hpp @@ -35,6 +35,9 @@ * \li AIEngine::HasPowerOnRoad * \li AIRoadTypeList::RoadTypeList * + * Other changes: + * \li AITile::DemolishTile works without a selected company + * * \b 1.9.0 * * API additions: diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp index 3d10b7d515..0f62406668 100644 --- a/src/script/api/script_tile.cpp +++ b/src/script/api/script_tile.cpp @@ -262,7 +262,6 @@ /* static */ bool ScriptTile::DemolishTile(TileIndex tile) { - EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY); EnforcePrecondition(false, ::IsValidTile(tile)); return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR); diff --git a/src/script/api/script_tile.hpp b/src/script/api/script_tile.hpp index f4a2f0970e..2aa23bf24d 100644 --- a/src/script/api/script_tile.hpp +++ b/src/script/api/script_tile.hpp @@ -445,7 +445,6 @@ public: * Destroy everything on the given tile. * @param tile The tile to demolish. * @pre ScriptMap::IsValidTile(tile). - * @game @pre Valid ScriptCompanyMode active in scope. * @exception ScriptError::ERR_AREA_NOT_CLEAR * @return True if and only if the tile was demolished. */