Subject: Re: Couple of questions
I made a similar function to GetNextVehicle (basically the "Next unit" button), that browses idle production buildings. Any hints how this could be merged to the "Next unit" button? I think I'll add an extra button for the time being
Quote:
//--------------------------------------------------
------------------------
/** Returns the next building that is in "waiting" status with empty queue -Nixx */
//--------------------------------------------------
------------------------
cBuilding *cPlayer::GetNextBuilding ()
{
cBuilding *b, *start;
bool next = false;
if ( Client->gameGUI.getSelBuilding() && Client->gameGUI.getSelBuilding()->owner == this )
{
start = Client->gameGUI.getSelBuilding();
next = true;
}
else
start = BuildingList;
if ( !start )
return NULL;
b = start;
do
{
if ( !next && !b->IsWorking && b->BuildList)
return b;
next = false;
if ( b->next )
b = b->next;
else
b = BuildingList;
}
while ( b != start );
return NULL;
}