dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Make getplants plugin case-insensitive

Open Bumber64 opened this issue 3 years ago • 5 comments

The "getplants" command requires the plant types to be inputted in all capital letters. It would be more convenient to allow them to be inputted with any capitalization, as with the "exterminate" script.

Bumber64 avatar Mar 22 '21 01:03 Bumber64

Hello I'm a beginner I want to contribute on this one. Can you give me some more pointers about it.

K-ash-ish avatar Mar 22 '21 08:03 K-ash-ish

Sure! This is a C++ tool, so you'll need to be able to compile DFHack to test it. Our compilation docs are here: https://docs.dfhack.org/en/stable/docs/Compile.html You'll also need an installation of Dwarf Fortress to install into, ideally 0.47.05.

As for implementation: we have a toLower() in MiscUtils.h that works on strings, so you could probably do this by normalizing the contents of plantNames to lowercase when names are added: https://github.com/DFHack/dfhack/blob/d5d41cd374fdda6093f3be8b5b23f97e7af6c380/plugins/getplants.cpp#L398 and when they are checked: https://github.com/DFHack/dfhack/blob/d5d41cd374fdda6093f3be8b5b23f97e7af6c380/plugins/getplants.cpp#L431-L433

Documentation on how to use getplants is here: https://docs.dfhack.org/en/stable/docs/Plugins.html#getplants

lethosor avatar Mar 23 '21 22:03 lethosor

Thank you so much. I'll try my best to do it.

K-ash-ish avatar Mar 24 '21 06:03 K-ash-ish

Hi! Is this done? If not I would like to take a shot

Lyqst avatar Apr 05 '22 01:04 Lyqst

Hi! Is this done? If not I would like to take a shot

The last comment on this bug is more than a year old. You are welcome to take ownership of it and submit a PR. Thanks!

myk002 avatar Apr 05 '22 02:04 myk002