Hi all,
I am kinda stuck at a simple battle simulator game I am programming. Id appreciate someone more experienced helping me out.
The question is:
I have a system something like this:
int main() ----> mapManager.loadMap(), mapManager.prontMap(), ....... , mapManager.battle()
MapManager has a soldiers vector, which holds all the fighting Soldier objects for both armies
Soldier class handles the invidual AI (A star algorithm)
My question is, how can I reach the soldiers vector (which is in MapManager class) from my Soldier class.
The only solution I see: Since I created the MapManager mapManager object in main(), I have to pass the pointer of that object to battle(mapManager) -> Soldier.update(mapManager) so I can access mapManager.soldiers in my Soldier::update(). But this feels really bad practice.
How should I do this? Is there a way to directly reach the mapManager.soldiers vector without passing that one object through a pipeline of functions?
Thank you in advance!
Odion