So I thinked during christmas on the "perfect" function.cpp and research.cpp system. Of course it's just ideas right now and it will be too much work for myself alone (but not that much). But we can talk about it. At start, it won't change anything in game experience. But as I look at it closer, it will totally improve the ease of maintenance of the code and new changes (new research, new structure, new whatever body, range, AI upgrade) in such a way it can be easily understandable by everyone.
So right now we have function objects looking like this :
psWhatAffected[ playernum ]->SomeParamName
all theses objects come with there own "load" and "upgrade" function that basically all do the same fu**** stuff. The only thing that change is the number of SomeParamNames that each psWhat_affected possess. But as it's all hardcoded at the other end, we really don't care how many object there is. So I suggest :
psFunction[ playernum ][ WhatAffected_Specify_SomeParamName ]
That name : WhatAffected_Specify_SomeParamName would be listed in a enum (like I did in tweak.c). This way we'll get a single "load" and a single "upgrade" function that goes with all parameters. All lines in function.txt will look the same :
Trigger, WhatAffected_Specify_SomeParamName, mode, value, player_no
exemples:
Code: Select all
init, Research__power, set, 32,64
init, Droid__armor, set, 100, 64
Research_DroidVtolArmour_Mk3, Droid_Vtol_KineticArmour, multiply, 105 (1.05),32
there would be more then one of theses "function.txt" (init > mod > map > faction) each of which running on the same versatile syntax.
I don't know if all of this is very clear. I might forget something important. That's why we talk first

