Skip to content

Commit

Permalink
Add: Allow GameScript to demolish without a company
Browse files Browse the repository at this point in the history
This allows GameScripts to shrink towns as well as grow them.
  • Loading branch information
thexa4 authored and nielsmh committed Sep 8, 2019
1 parent 9014633 commit e441447
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/script/api/ai_changelog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/script/api/script_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/script/api/script_tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ class ScriptTile : public ScriptObject {
* 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.
*/
Expand Down

0 comments on commit e441447

Please sign in to comment.