Beispiel #1
0
void PlanetWars::NewTurn(uint16 iTurnNumber, const string& gameState, bool bInverted)
{
	m_iTurnNumber = iTurnNumber;
	m_iFleetCounter = 0;
	m_iRequestCounter = 0;

	Clear();

	ParseGameState(gameState, bInverted);
	m_fSize = sqrt(m_fWidth*m_fWidth+m_fHeight*m_fHeight);

	ComputeData();
}
Beispiel #2
0
// Loads a map from a test file. The text file contains a description of
// the starting state of a game. See the project wiki for a description of
// the file format. It should be called the Planet Wars Point-in-Time
// format. On success, return true. On failure, returns false.
bool Game::LoadMapFromFile(const std::string& mapFilename) {
	std::ifstream f(mapFilename.c_str());
	if(!f) return false;
	std::string s = std::string(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());
	return ParseGameState(s);
}