Exemple #1
0
bool REPLAY::StartPlaying(const std::string & replayfilename, std::ostream & error_output)
{
	GetReadyToPlay();

	//open the file
	std::ifstream replaystream(replayfilename.c_str(), std::ios::binary);
	if (!replaystream)
	{
		error_output << "Error loading replay file: " << replayfilename << std::endl;
		return false;
	}

	//load the header info from the file
	if (!LoadHeader(replaystream, error_output)) return false;

	//load all of the input/state frame chunks from the file until we hit the EOF
	while (Load(replaystream));

	return true;
}
Exemple #2
0
bool Replay::StartPlaying(const std::string & replayfilename, std::ostream & error_output)
{
	Reset();

	std::ifstream replaystream(replayfilename.c_str(), std::ios::binary);
	if (!replaystream)
	{
		error_output << "Error loading replay file: " << replayfilename << std::endl;
		return false;
	}

	if (!Load(replaystream, error_output))
		return false;

	for (size_t i = 0; i < carstate.size(); ++i)
	{
		carstate[i].Reset();
	}

	replaymode = PLAYING;

	return true;
}