3 #include "stdafx.h" |
3 #include "stdafx.h" |
4 #include "openttd.h" |
4 #include "openttd.h" |
5 #include "bridge_map.h" |
5 #include "bridge_map.h" |
6 #include "heightmap.h" |
6 #include "heightmap.h" |
7 #include "clear_map.h" |
7 #include "clear_map.h" |
8 #include "date.h" |
|
9 #include "functions.h" |
|
10 #include "map.h" |
|
11 #include "player.h" |
8 #include "player.h" |
12 #include "spritecache.h" |
9 #include "spritecache.h" |
13 #include "table/sprites.h" |
10 #include "table/sprites.h" |
14 #include "tile.h" |
|
15 #include <stdarg.h> |
11 #include <stdarg.h> |
16 #include "viewport.h" |
12 #include "viewport_func.h" |
17 #include "command.h" |
13 #include "command_func.h" |
18 #include "landscape.h" |
14 #include "landscape.h" |
19 #include "vehicle.h" |
|
20 #include "variables.h" |
15 #include "variables.h" |
21 #include "void_map.h" |
16 #include "void_map.h" |
22 #include "water_map.h" |
17 #include "water_map.h" |
23 #include "tgp.h" |
18 #include "tgp.h" |
24 #include "genworld.h" |
19 #include "genworld.h" |
|
20 #include "tile_cmd.h" |
|
21 #include "core/alloc_func.hpp" |
|
22 #include "fios.h" |
|
23 #include "window_func.h" |
|
24 #include "functions.h" |
|
25 #include "date_func.h" |
|
26 #include "vehicle_func.h" |
25 |
27 |
26 extern const TileTypeProcs |
28 extern const TileTypeProcs |
27 _tile_type_clear_procs, |
29 _tile_type_clear_procs, |
28 _tile_type_rail_procs, |
30 _tile_type_rail_procs, |
29 _tile_type_road_procs, |
31 _tile_type_road_procs, |
520 * @param p1 unused |
522 * @param p1 unused |
521 * @param p2 unused |
523 * @param p2 unused |
522 */ |
524 */ |
523 CommandCost CmdLandscapeClear(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
525 CommandCost CmdLandscapeClear(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
524 { |
526 { |
525 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
|
526 |
|
527 return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags); |
527 return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags); |
528 } |
528 } |
529 |
529 |
530 /** Clear a big piece of landscape |
530 /** Clear a big piece of landscape |
531 * @param tile end tile of area dragging |
531 * @param tile end tile of area dragging |
533 * @param flags of operation to conduct |
533 * @param flags of operation to conduct |
534 * @param p2 unused |
534 * @param p2 unused |
535 */ |
535 */ |
536 CommandCost CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
536 CommandCost CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
537 { |
537 { |
538 CommandCost cost, ret, money; |
538 CommandCost ret, money; |
|
539 CommandCost cost(EXPENSES_CONSTRUCTION); |
539 int ex; |
540 int ex; |
540 int ey; |
541 int ey; |
541 int sx, sy; |
542 int sx, sy; |
542 int x, y; |
543 int x, y; |
543 bool success = false; |
544 bool success = false; |
544 |
545 |
545 if (p1 >= MapSize()) return CMD_ERROR; |
546 if (p1 >= MapSize()) return CMD_ERROR; |
546 |
|
547 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
|
548 |
547 |
549 /* make sure sx,sy are smaller than ex,ey */ |
548 /* make sure sx,sy are smaller than ex,ey */ |
550 ex = TileX(tile); |
549 ex = TileX(tile); |
551 ey = TileY(tile); |
550 ey = TileY(tile); |
552 sx = TileX(p1); |
551 sx = TileX(p1); |