Open Mira-Chronos opened 2 years ago
Well, in ideal sense all this info should be encapsulated in some kind of "rules" class. (much like game.ini
is a 'rules' class, where it dictates what kind of units/structures/etc there are in the game).
This 'rules' class is loaded once (on startup). So I don't mind at this moment it to be global and access it where needed. Alternatively we can pass it in every class (via constructor) if required.
At the moment I would not bother too much about these globals. There are bigger fish to fry ... like #386 :)
Let's go to migrate to SDL2 ...
@pbomta @stefanhendriks I have problem !
I rewrite HousesInfo #498 and PreviewMap ##496 I was fun, but local, just little files impacted for the work.
Yet, i would like to do the same thing with sStructureInfo, sUnitInfo, sUpgradeInfo, sSpecialInfo, sBulletInfo, sParticleInfo, reinforcements ---> I have in mind to suppress this global variables and encapsulate in class. Group all the methods on these objects in the class, avoiding creating too many dependencies.
But problem appears when we use a variable that is used almost everywhere? easy reinforcements - > 8 files sUpgradeInfo -> 10 files
complicated sSpecialInfo -> 11 files sUnitInfo -> 18 files sStructureInfo -> 21 files.
For objects that currently use these global variables:
Here, how should I do?
And to pass object, shall i use smart pointer (i like it) ?