diff options
author | tron <tron@openttd.org> | 2006-03-23 20:47:56 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-23 20:47:56 +0000 |
commit | 541703a2f6687fcb7d9f4d1453f84d80b67cd58c (patch) | |
tree | 5fe90832d23bf4493a9bb128090d8109bf163cc1 /clear_cmd.c | |
parent | 6d4e7d565da547888f0cf5a0fdff038924b3a9a4 (diff) | |
download | openttd-541703a2f6687fcb7d9f4d1453f84d80b67cd58c.tar.xz |
(svn r4073) Add functions to make and test for (most) unmovable tiles
Diffstat (limited to 'clear_cmd.c')
-rw-r--r-- | clear_cmd.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/clear_cmd.c b/clear_cmd.c index 364e7733b..e11565b75 100644 --- a/clear_cmd.c +++ b/clear_cmd.c @@ -13,6 +13,7 @@ #include "tunnel_map.h" #include "variables.h" #include "table/sprites.h" +#include "unmovable_map.h" typedef struct TerraformerHeightMod { TileIndex tile; @@ -379,18 +380,16 @@ int32 CmdPurchaseLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (!EnsureNoVehicle(tile)) return CMD_ERROR; - if (IsTileType(tile, MP_UNMOVABLE) && _m[tile].m5 == 3 && - IsTileOwner(tile, _current_player)) + if (IsOwnedLandTile(tile) && IsTileOwner(tile, _current_player)) { return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT); + } cost = DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); if (CmdFailed(cost)) return CMD_ERROR; if (flags & DC_EXEC) { - ModifyTile(tile, - MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, - 3 /* map5 */ - ); + MakeOwnedLand(tile, _current_player); + MarkTileDirtyByTile(tile); } return cost + _price.purchase_land * 10; @@ -435,7 +434,7 @@ int32 CmdSellLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2) tile = TileVirtXY(x, y); - if (!IsTileType(tile, MP_UNMOVABLE) || _m[tile].m5 != 3) return CMD_ERROR; + if (!IsOwnedLandTile(tile)) return CMD_ERROR; if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER) return CMD_ERROR; |