I have been thinking of adding bIsHuman to Unit Info. The reason is that we have two main categories of units, those, which immigrate/are born/educated and those, which are build. If we look at the data, getting the type mean checking all sorts of different settings and that is prone to be buggy. I want a simple bool to check as it is easier to code and executes faster and being that simple, it is less likely to be buggy.
I want to do the same trick here as with cargo yields. This mean all humans are first, then followed by all non-humans. This will allow human sized unit arrays, meaning schools will not have to store if they can teach catapults, ship or stuff like that. Also if we need to loop all human unit types, but know it it will do nothing to non-humans, we can stop the loop at the end of the humans. This will increase performance and save memory.
Naturally making assumptions like this requires the DLL to assert if the XML file doesn't apply to the rules, just like any other assumption that the DLL does about XML.
I wrote earlier about splitting units into two XML files. I think it would be better to simply use this bool because merging multiple XML files into a single array at runtime can be done (I know how to do it), but it requires more coding. Keeping the simple one array, one XML file simplifies the XML reading code.
I'm busy with CivEffects right now and don't plan to do anything unit related before next release. However since next release will also be the base for other XML based mods, I'm thinking of adding this bool now without actually using it in the DLL.
This is part of my current design strategy, which is to ensure the needed tags are in XML before they split into multiple mods. This allows coding the DLL without modifying the XML files. Ideally all future DLL updates will only add optional XML tags to avoid breaking other mods (or at least minimizing the need for mandatory XML updates). This requires a bit of planing ahead to figure out which mandatory tags to add right now.
Note: while I call it humans, it will apply to human behavior, which mean in this sense space aliens, androids and other similar units could be considered humans as they take up citizen professions and stuff like that.
Is this a concept we can agree on?