//********************************************************* bool Turn(QueueType & pQueue, VecSetType & squadSetVec, MapSquadType & squadMap, ArsenalType & arsenal){ bool over= false; Player * p; p= pQueue.front(); pQueue.pop(); p->ResetMomentum(); if( p->IsHuman()) { HumanTurn(squadMap, arsenal, p); } else { BugTurn(squadMap, arsenal, p); } pQueue.push(p); DeletePlayers(pQueue, squadSetVec, squadMap); over= CheckOver(squadSetVec); return over; }
//********************************************************* void End(QueueType & pQueue, ArsenalType & arsenal, MapSquadType & squadMap, VecSetType & squadSetVec){ GameOver(pQueue, squadSetVec, squadMap, arsenal); int qSize= pQueue.size(); Player * p; for (int i= 0; i < qSize; i++) { p= pQueue.front(); pQueue.pop(); delete p; } return; }
//********************************************************* bool DeletePlayers(QueueType & pQueue, VecSetType & squadSetVec, MapSquadType & squadMap){ Player * p; int qSize= pQueue.size(); bool del= false; for (int i= 0; i < qSize; i++) { p= pQueue.front(); pQueue.pop(); if (p->IsDead()) { if (squadSetVec[squadMap[p->Name()]].count(p->Name())) { squadSetVec[squadMap[p->Name()]].erase(p->Name()); del= true; } //PrintVectorOfSquads(cout , squadSetVec); } pQueue.push(p); } return del; }