mirror of https://github.com/OpenTTD/OpenTTD.git
Change: [Script] Allow GS to terraform/plant trees as deity.
This commit is contained in:
parent
d683ec0183
commit
6f4d498ea9
|
@ -252,7 +252,7 @@
|
|||
|
||||
/* static */ bool ScriptTile::RaiseTile(TileIndex tile, Slope slope)
|
||||
{
|
||||
EnforceCompanyModeValid(false);
|
||||
EnforceDeityOrCompanyModeValid(false);
|
||||
EnforcePrecondition(false, tile < ScriptMap::GetMapSize());
|
||||
|
||||
return ScriptObject::Command<CMD_TERRAFORM_LAND>::Do(tile, (::Slope)slope, true);
|
||||
|
@ -260,7 +260,7 @@
|
|||
|
||||
/* static */ bool ScriptTile::LowerTile(TileIndex tile, Slope slope)
|
||||
{
|
||||
EnforceCompanyModeValid(false);
|
||||
EnforceDeityOrCompanyModeValid(false);
|
||||
EnforcePrecondition(false, tile < ScriptMap::GetMapSize());
|
||||
|
||||
return ScriptObject::Command<CMD_TERRAFORM_LAND>::Do(tile, (::Slope)slope, false);
|
||||
|
@ -268,7 +268,7 @@
|
|||
|
||||
/* static */ bool ScriptTile::LevelTiles(TileIndex start_tile, TileIndex end_tile)
|
||||
{
|
||||
EnforceCompanyModeValid(false);
|
||||
EnforceDeityOrCompanyModeValid(false);
|
||||
EnforcePrecondition(false, start_tile < ScriptMap::GetMapSize());
|
||||
EnforcePrecondition(false, end_tile < ScriptMap::GetMapSize());
|
||||
|
||||
|
@ -285,7 +285,7 @@
|
|||
|
||||
/* static */ bool ScriptTile::PlantTree(TileIndex tile)
|
||||
{
|
||||
EnforceCompanyModeValid(false);
|
||||
EnforceDeityOrCompanyModeValid(false);
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_PLANT_TREE>::Do(tile, tile, TREE_INVALID, false);
|
||||
|
@ -293,7 +293,7 @@
|
|||
|
||||
/* static */ bool ScriptTile::PlantTreeRectangle(TileIndex tile, SQInteger width, SQInteger height)
|
||||
{
|
||||
EnforceCompanyModeValid(false);
|
||||
EnforceDeityOrCompanyModeValid(false);
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, width >= 1 && width <= 20);
|
||||
EnforcePrecondition(false, height >= 1 && height <= 20);
|
||||
|
|
|
@ -418,7 +418,6 @@ public:
|
|||
* @param tile The tile to raise.
|
||||
* @param slope Corners to raise (SLOPE_xxx).
|
||||
* @pre tile < ScriptMap::GetMapSize().
|
||||
* @game @pre ScriptCompanyMode::IsValid().
|
||||
* @exception ScriptError::ERR_AREA_NOT_CLEAR
|
||||
* @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE
|
||||
* @exception ScriptTile::ERR_TILE_TOO_HIGH
|
||||
|
@ -435,7 +434,6 @@ public:
|
|||
* @param tile The tile to lower.
|
||||
* @param slope Corners to lower (SLOPE_xxx).
|
||||
* @pre tile < ScriptMap::GetMapSize().
|
||||
* @game @pre ScriptCompanyMode::IsValid().
|
||||
* @exception ScriptError::ERR_AREA_NOT_CLEAR
|
||||
* @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE
|
||||
* @exception ScriptTile::ERR_TILE_TOO_LOW
|
||||
|
@ -451,7 +449,6 @@ public:
|
|||
* @param end_tile The opposite corner of the rectangle.
|
||||
* @pre start_tile < ScriptMap::GetMapSize().
|
||||
* @pre end_tile < ScriptMap::GetMapSize().
|
||||
* @game @pre ScriptCompanyMode::IsValid().
|
||||
* @exception ScriptError::ERR_AREA_NOT_CLEAR
|
||||
* @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE
|
||||
* @return True if one or more tiles were leveled.
|
||||
|
@ -475,7 +472,6 @@ public:
|
|||
* Create a random tree on a tile.
|
||||
* @param tile The tile to build a tree on.
|
||||
* @pre ScriptMap::IsValidTile(tile).
|
||||
* @game @pre ScriptCompanyMode::IsValid().
|
||||
* @return True if and only if a tree was added on the tile.
|
||||
*/
|
||||
static bool PlantTree(TileIndex tile);
|
||||
|
@ -488,7 +484,6 @@ public:
|
|||
* @pre ScriptMap::IsValidTile(tile).
|
||||
* @pre width >= 1 && width <= 20.
|
||||
* @pre height >= 1 && height <= 20.
|
||||
* @game @pre ScriptCompanyMode::IsValid().
|
||||
* @return True if and only if a tree was added on any of the tiles in the rectangle.
|
||||
*/
|
||||
static bool PlantTreeRectangle(TileIndex tile, SQInteger width, SQInteger height);
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
std::tuple<CommandCost, Money, TileIndex> CmdTerraformLand(DoCommandFlag flags, TileIndex tile, Slope slope, bool dir_up);
|
||||
std::tuple<CommandCost, Money, TileIndex> 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
|
||||
DEF_CMD_TRAIT(CMD_TERRAFORM_LAND, CmdTerraformLand, CMD_DEITY | CMD_ALL_TILES | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
|
||||
DEF_CMD_TRAIT(CMD_LEVEL_LAND, CmdLevelLand, CMD_DEITY | CMD_ALL_TILES | CMD_AUTO | CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) // test run might clear tiles multiple times, in execution that only happens once
|
||||
|
||||
CommandCallback CcPlaySound_EXPLOSION;
|
||||
void CcTerraform(Commands cmd, const CommandCost &result, Money, TileIndex tile);
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
|
||||
CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, uint8_t tree_to_plant, bool diagonal);
|
||||
|
||||
DEF_CMD_TRAIT(CMD_PLANT_TREE, CmdPlantTree, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
|
||||
DEF_CMD_TRAIT(CMD_PLANT_TREE, CmdPlantTree, CMD_DEITY | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
|
||||
|
||||
#endif /* TREE_CMD_H */
|
||||
|
|
Loading…
Reference in New Issue