I'm creating an rts game. I'm looking for a way to store unit data. I thought, I'll make a struct for all the required data, and make a multidemensional array of them (one dimension is the different players, the other is the units). The length in both direction is fixed at the start, but not beforehand. The settings define how many players, and the maximum number of units.
The dimensions are known to every script, since they all are in the same class.
OnInit, OnEvent,OnAI and OnLoop do all need to access this data.
device->run() is an command from the irrlicht library, that's not giving any problems.
De definitions of the functions are in main.h, they all have that one included:
#define FAIL0 "Loading XML failed"
#define filename "settings/config.cfg"
#define meshfilename "saves/save1/descr.xml"
/* global variables here */
/* Constructor and main loop */
/* all functions and function dependants */
int OnAddUnit(int id,int player, irr::core::vector3df(pos), irr::core::vector3df(rot));
int OnRemUnit(int id, int player);
If you need other code to help, please ask. It's going to be open source anyway.
At the moment, only unittype is defined, unittype has the same problem as the unit-array, this is an array containing settings of all the possible types of units. This way, I save on loading files to see those things.