Exemplo n.º 1
0
	void TankFactory::updateAllTankStatus(float time){
		for (TankIterator t = tankList.begin(); t != tankList.end();){ //t shouldn't be increment in for loop, may cause program crashes.
				Tank* tank = *t;             
				tank->update(time);
				if (tank->ifExplodeFinished())
				{	
					if(tank->getType() != TANK_PLAYER){
						//delete tank
						destroyTank(tank);
						Tank* tmp = tank;
						t++;
						tankList.remove(tmp);
					}else{
						destroyTank(tank);
						Tank* tmp = tank;
						t++;
						tankList.remove(tmp);
						rebornPlayer();
					}	
				}
				else
				{
					t++;
				}
		}
	}