glest-source
glest-source copied to clipboard
need error checking for morph skill:speed
This happened in a scenario.
If a large number is used in the morph skill (
When the unit goes to morph, the status goes to 0 and never changes.
As you can see from this screenshot, the morph speed is altered (because the data type can't hold the number that large).
some error checking needs to be put in place to make sure values used are smaller than the storage space.
It's safe to assume that this bug affects all the variables used in the xml data files, not just the speed setting for the morph skill.
We'll use 99999 as the largest allowed number, so
if speed > 99999 or < 0
This will also need to be added to the code that validates scenarios from the command line (--validate-scenario=)
Relevant sections of code to look at.
https://github.com/ZetaGlest/zetaglest-source/blob/51e29e4c383c116152f6ffa84653f562a9af7293/source/glest_game/types/skill_type.cpp#L1111
https://github.com/ZetaGlest/zetaglest-source/blob/51e29e4c383c116152f6ffa84653f562a9af7293/source/shared_lib/sources/xml/xml_parser.cpp#L901-L904
I'm not sure yet where best to stick any kind of error-checking.
So far, I think in this function would be the best spot to do the error check
https://github.com/ZetaGlest/zetaglest-source/blob/51e29e4c383c116152f6ffa84653f562a9af7293/source/glest_game/types/skill_type.cpp#L1892-L1897