My statement on the unsuitability to mix floating point math with integer math was intended to be general, not referring to this specific code. Floating point results end up near the mathematically correct result (most of the time: there are exceptions), but can end up both above, spot on, and below. Applying truncation or rounding up to such values can give the wrong value, where "proper" rounding might work.
Ah, okay, now I see. Yes, of course, you are absolutely right.
The intention of the "Any" value for reanimation is "at least one of them", so it's good your results reflects that.
Good, so I'll leave it as is.
If I'd intended to say exactly one of them I'd probably have called it "Either".
I wanted to be sure, as I experienced first hand - also with my own code in multiple projects - how software grows and changes gradually until its current internal logic no longer fits the original designations of variables, classes or display labels that were named under the impression of their initial creation - a process often imperceptible for the one perpetrating it, kind of a temporary syndrome similar to mental blindness from staring to long on to something, the last days have been full of that at work actually.
It takes a lot discipline to stay ahead of that, notice it and change names accordingly.
I don't think there would be any reason for a player to want one or the other type of reanimation but exclude both of them, while I can see that players may want to ensure a challenge by requiring at least one of them.
As I only accidentally have encountered reanimation and thralling - which ended badly quit fast - I really wouldn't dare to guess what players that are actively looking for it might want
So I'll trust your judgement.
Okay, there are 2 more things I'd need to fix before merging makes sense, but I have this idea about how to make the merging/migration to the latest version of the code both easier and safer (if for any reason all/most of my work won't make it into the plugin):
I will open 3 or 4 pull requests against
your latest branch.
The first one contains a minimal change that should speed up the search without actually changing the logic.
The second one will change a little more code saving a lot of memory again without really changing any logic.
The third and if needed the fourth would both be an actually refactoring that would make the merging easier by reducing the amount of duplicated code at those places where I had to add to the code the most.
Apart from that I have to ask someone (you or lethosor?) how to handle the external dependency CRoaring/Roaring Bitmaps that I used as-is by putting the 3 files (roaring.h,~.hh,~.c) alongside the sources of embark-assistant.
Those files might make the linter scream also I'm unsure if it is fine to add external dependencies like that...
I'm willing to change the files to make them comply to the rules if necessary even if this means any future update of CRoaring brings some additional overhead.
Also some (performance) tests on Linux would be good.
Perhaps the most important question: Would you be okay with a
so fundamentally changed version of the plugin?
I actually never asked that question as I never have been really sure that it could be done (there is still a chance that some "minor" detail brings it all down).
I'm willing to co-maintain with what I know, added and changed, if that makes a difference.
But there are quite a lot of DF/dfhack internals that are beyond me.
And the time I actually can spend on this is limited.
So?