summaryrefslogtreecommitdiff
path: root/tree_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-10 07:15:58 +0000
committertron <tron@openttd.org>2006-04-10 07:15:58 +0000
commit81e6d68f95e7dea5c0d7dd105d67980d64af71e0 (patch)
treef8613338e934555520fd9b45b411e8a946c5be7a /tree_cmd.c
parent6926bd55fd4f1d36745082b668b052c1b6691ad8 (diff)
downloadopenttd-81e6d68f95e7dea5c0d7dd105d67980d64af71e0.tar.xz
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
Remove DoCommandByTile(), because now it does the same as DoCommand()
Diffstat (limited to 'tree_cmd.c')
-rw-r--r--tree_cmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tree_cmd.c b/tree_cmd.c
index 114554d12..7b38f6358 100644
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -124,14 +124,16 @@ void GenerateTrees(void)
}
/** Plant a tree.
- * @param x,y start tile of area-drag of tree plantation
+ * @param tile start tile of area-drag of tree plantation
* @param p1 tree type, -1 means random.
* @param p2 end tile of area-drag
*/
-int32 CmdPlantTree(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
+int32 CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
StringID msg = INVALID_STRING_ID;
int32 cost;
+ int ex;
+ int ey;
int sx, sy, x, y;
if (p2 >= MapSize()) return CMD_ERROR;
@@ -141,10 +143,10 @@ int32 CmdPlantTree(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_OTHER);
// make sure sx,sy are smaller than ex,ey
+ ex = TileX(tile);
+ ey = TileY(tile);
sx = TileX(p2);
sy = TileY(p2);
- ex /= TILE_SIZE;
- ey /= TILE_SIZE;
if (ex < sx) intswap(ex, sx);
if (ey < sy) intswap(ey, sy);