Beispiel #1
0
void PlayManager::newMap(Map* m)
{
	if(!m)
	{
		DeveloperConsole::writeLine("Invalid map.");
		return;
	}

	alivePlayerCount = m->playerCount();

	// Remove old map.
	delete currentMap;
	activePlayerIndex = 0;
	activePlayer = m->getPlayer(activePlayerIndex);
	currentMap = m;
	drawFog = true;
	

	Stats::setMapsize(m->width * Stats::getTilesize(), m->height * Stats::getTilesize());
	InputManager::clearCatchers();

	info = new InfoTab();
	InputManager::mainCursor = new GameCursor();	

	advanceTurn();

	SoundManager::stopMusic();
	SoundManager::loopMusic("Rumble_Army.mp3");
}
Creature& GameTurnTimer::nextCreatureTurn(void)
{
	if(m_actingCreatures.size() == 0) //may be able to remove
	{
		m_actingCreatures = getCreaturesCanMove();
	}

	std::vector<Creature*>::iterator creatureIt(m_actingCreatures.end() - 1);
	if((*creatureIt)->getActTurnRem() == 0)
		return **creatureIt;
	else //the last creature in the list cannot move anymore
	{
		m_actingCreatures.pop_back();
		while(m_actingCreatures.size() == 0) //if that was the last creature
		{
			advanceTurn();
			m_actingCreatures = getCreaturesCanMove();
		}
		creatureIt = m_actingCreatures.end() - 1;
		return **creatureIt;
	}
}