UFO:Alien Invasion
Development => Coding => Topic started by: Hoehrer on March 28, 2006, 07:40:07 pm
-
As the title says. How do i loop/search trough all available types of buildings?
The global var ....
extern building_t bmBuildings[MAX_BASES][MAX_BUILDINGS];
... stores them seperated by bases (and thus probably duplicates).
I suspect that i can use the prev/next entries in building_t somehow ...
struct building_s *prev;
struct building_s *next;is a
.. but how do i know where to start/stop?
Werner
-
the prev and next is currently not set:
building_t* entry;
for ( i = 0; i < numBuildings; i++ )
{
entry = &bmBuildings[0][i];
}
numBuildings is the global building count
and bmBuildings[0] means that you use the buildings from the first base.
the main data is the same at each base - but there may be different workers assigned and so on. the dynamic stuff is handled in each base.
-
Thanks, that helps alot :)
Now the only barrier i still need to break is the non-global numBuildings ... just need to find all the needed things.
Werner