raystuttgart
Civ4Col Modder
Hi guys,
I have no idea why or how this really happened but a huge amount of Trait Modifiers is "bypassing" this central methods:
(I was most likely also contributing to this mess over the years.)
To explain, the method centrally collects the single modifiers from the Traits and stores an according attribute in the Player object.
Thus later the "functional code" does not need to loop the Traits every time it needs a modifier but can instead directly read from the attribute in the Player object.
Using "processTrait" would have several benefits:
A code refactoring might be a good idea and would probably also result in a performance improvement.
@Nightinggale
What is your opinion on this? Personally I know it will be tedious effort, but I think it might be worth it.
Should we clean it up and have all Trait modifiers handled and stored by "process Trait"?
I have no idea why or how this really happened but a huge amount of Trait Modifiers is "bypassing" this central methods:
(I was most likely also contributing to this mess over the years.)
Code:
void CvPlayer:processTrait(TraitTypes eTrait, int iChange)
To explain, the method centrally collects the single modifiers from the Traits and stores an according attribute in the Player object.
Thus later the "functional code" does not need to loop the Traits every time it needs a modifier but can instead directly read from the attribute in the Player object.
Using "processTrait" would have several benefits:
- The code using those modifiers get cleaner by reading it from a central space (instead of looping)
- The code using those modifiers gets a lot more performant by reading a single value (instead of looping)
A code refactoring might be a good idea and would probably also result in a performance improvement.
@Nightinggale
What is your opinion on this? Personally I know it will be tedious effort, but I think it might be worth it.
Should we clean it up and have all Trait modifiers handled and stored by "process Trait"?