summaryrefslogtreecommitdiff
path: root/src/tree_cmd.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-11-21 23:03:44 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commit58cff7b081ce9ea4b5314cf8324ca60607389d15 (patch)
tree0d46a0522d5fbbb1039e1e31e07557ee1ad9befb /src/tree_cmd.cpp
parentc6d7b98808575f31103121528565ed252a3cfc6c (diff)
downloadopenttd-58cff7b081ce9ea4b5314cf8324ca60607389d15.tar.xz
Codechange: Un-bitstuff the remaining on-map commands.
Diffstat (limited to 'src/tree_cmd.cpp')
-rw-r--r--src/tree_cmd.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 123255dd4..c98758062 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -382,25 +382,23 @@ void GenerateTrees()
* Plant a tree.
* @param flags type of operation
* @param tile end tile of area-drag
- * @param p1 tree type, TREE_INVALID means random.
- * @param p2 start tile of area-drag of tree plantation
- * @param text unused
+ * @param start_tile start tile of area-drag of tree plantation
+ * @param tree_to_plant tree type, TREE_INVALID means random.
* @return the cost of this operation or an error
*/
-CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
+CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, byte tree_to_plant)
{
StringID msg = INVALID_STRING_ID;
CommandCost cost(EXPENSES_OTHER);
- const byte tree_to_plant = GB(p1, 0, 8); // We cannot use Extract as min and max are climate specific.
- if (p2 >= MapSize()) return CMD_ERROR;
+ if (start_tile >= MapSize()) return CMD_ERROR;
/* Check the tree type within the current climate */
if (tree_to_plant != TREE_INVALID && !IsInsideBS(tree_to_plant, _tree_base_by_landscape[_settings_game.game_creation.landscape], _tree_count_by_landscape[_settings_game.game_creation.landscape])) return CMD_ERROR;
Company *c = (_game_mode != GM_EDITOR) ? Company::GetIfValid(_current_company) : nullptr;
int limit = (c == nullptr ? INT32_MAX : GB(c->tree_limit, 16, 16));
- TileArea ta(tile, (TileIndex)p2);
+ TileArea ta(tile, start_tile);
for (TileIndex current_tile : ta) {
switch (GetTileType(current_tile)) {
case MP_TREES: