Merge pull request #2731 from gearsix/getplants-fixes

getplants fixes
develop
Myk 2023-01-29 10:55:39 -08:00 committed by GitHub
commit 4e1fc1cdd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes ## Fixes
-@ ``Screen``: allow `gui/launcher` and `gui/quickcmd` to launch themselves without hanging the game -@ ``Screen``: allow `gui/launcher` and `gui/quickcmd` to launch themselves without hanging the game
-@ Fix issues with clicks "passing through" some DFHack window elements, like scrollbars -@ Fix issues with clicks "passing through" some DFHack window elements, like scrollbars
- `getplants`: tree are now designated correctly
## Misc Improvements ## Misc Improvements
- A new cross-compile build script was added for building the Windows files from a Linux Docker builder (see the Compile instructions in the docs) - A new cross-compile build script was added for building the Windows files from a Linux Docker builder (see the Compile instructions in the docs)
@ -47,6 +48,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `gui/quickcmd`: now has it's own global keybinding for your convenience: Ctrl-Shift-A - `gui/quickcmd`: now has it's own global keybinding for your convenience: Ctrl-Shift-A
- Many DFHack windows can now be unfocused by clicking somewhere not over the tool window. This has the same effect as pinning previously did, but without the extra clicking. - Many DFHack windows can now be unfocused by clicking somewhere not over the tool window. This has the same effect as pinning previously did, but without the extra clicking.
- `overlay`: overlay widgets can now specify a default enabled state if they are not already set in the player's overlay config file - `overlay`: overlay widgets can now specify a default enabled state if they are not already set in the player's overlay config file
- `getplants`: ID values will now be accepted regardless of case
-@ New borders for DFHack tool windows -- tell us what you think! -@ New borders for DFHack tool windows -- tell us what you think!
## Documentation ## Documentation

@ -7,6 +7,7 @@
#include "PluginManager.h" #include "PluginManager.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "TileTypes.h" #include "TileTypes.h"
#include "MiscUtils.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/map_block_column.h" #include "df/map_block_column.h"
@ -321,9 +322,9 @@ bool designate(const df::plant *plant, bool farming) {
} }
} }
if ((!farming || seedSource) && bool istree = (tileMaterial(Maps::getTileBlock(plant->pos)->tiletype[plant->pos.x % 16][plant->pos.y % 16]) == tiletype_material::TREE);
ripe(plant->pos.x, plant->pos.y, plant_raw->growths[i]->timing_1, plant_raw->growths[i]->timing_2) && bool isripe = ripe(plant->pos.x, plant->pos.y, plant_raw->growths[i]->timing_1, plant_raw->growths[i]->timing_2);
!picked(plant, i)) if ((!farming || seedSource) && (istree || isripe) && !picked(plant, i))
{ {
return Designations::markPlant(plant); return Designations::markPlant(plant);
} }
@ -395,7 +396,7 @@ command_result df_getplants (color_ostream &out, vector <string> & parameters)
} }
} }
else else
plantNames.insert(parameters[i]); plantNames.insert(toUpper(parameters[i]));
} }
if (treesonly && shrubsonly) if (treesonly && shrubsonly)
{ {
@ -428,7 +429,7 @@ command_result df_getplants (color_ostream &out, vector <string> & parameters)
// plantSelections[i] = selectablePlant(out, plant, farming); // plantSelections[i] = selectablePlant(out, plant, farming);
plantSelections[i] = selectablePlant(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); plantNames.erase(plant->id);
// plantSelections[i] = selectablePlant(out, plant, farming); // plantSelections[i] = selectablePlant(out, plant, farming);