From 6726b567a1224e22a9515fec5ec96b53c9b626ca Mon Sep 17 00:00:00 2001 From: gearsix Date: Fri, 27 Jan 2023 14:19:29 +0000 Subject: [PATCH] issue #2043 - `designate` now marks trees (regardless of if ripe). The `ripe` call was returning false on tree tiles, resulting in an inability to designate trees for chopping with `getplants`. This change adds a check to see if the tile is a tree or not and if it is, then the ripe check is ignored. --- plugins/getplants.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/getplants.cpp b/plugins/getplants.cpp index 485dff967..565316fa6 100644 --- a/plugins/getplants.cpp +++ b/plugins/getplants.cpp @@ -322,9 +322,9 @@ bool designate(const df::plant *plant, bool farming) { } } - if ((!farming || seedSource) && - ripe(plant->pos.x, plant->pos.y, plant_raw->growths[i]->timing_1, plant_raw->growths[i]->timing_2) && - !picked(plant, i)) + bool istree = (tileMaterial(Maps::getTileBlock(plant->pos)->tiletype[plant->pos.x % 16][plant->pos.y % 16]) == tiletype_material::TREE); + bool isripe = ripe(plant->pos.x, plant->pos.y, plant_raw->growths[i]->timing_1, plant_raw->growths[i]->timing_2); + if ((!farming || seedSource) && (istree || isripe) && !picked(plant, i)) { return Designations::markPlant(plant); } @@ -429,7 +429,7 @@ command_result df_getplants (color_ostream &out, vector & parameters) // plantSelections[i] = selectablePlant(out, plant, farming); plantSelections[i] = selectablePlant(plant, farming); } - else if (plantNames.find(plant->id) != plantNames.end()) + else if (plantNames.find(plant->id) != plantNames.end()) { plantNames.erase(plant->id); // plantSelections[i] = selectablePlant(out, plant, farming);