Exemplo n.º 1
0
void GameDatabase::LoadGame(const size_t index, Game &game, 
							const GameObjectEnginePtr &engine, 
							ISerialize& stats)
{
	wxASSERT(mOffsets.size() > index);
	
	wxFileInputStream x(FilePath::Data(DataFileGames));
	wxDataInputStream games(x);

	// Seek to this position in the game file.
	x.SeekI(mOffsets[index]);

	// Read in the rulesets this game was using.
	wxUint32 size;
	games >> size;

	StringPairArray rulesets;
	rulesets.reserve(size);
	for(wxUint32 i = 0; i < size; ++i)
	{
		wxString module, ruleset;
		games >> module;
		games >> ruleset;

		rulesets.push_back(StringPair(module, ruleset));
	}

	games >> size;

	StringPairArray options;
	options.reserve(size);
	for(wxUint32 i = 0; i < size; ++i)
	{
		wxString module, ruleset;
		games >> module;
		games >> ruleset;

		options.push_back(StringPair(module, ruleset));
	}

	// Fire off the load event for any listeners to deal with it.
	if(engine)
	{
		Controller::get().Transmit(shEventLoadRulesets, rulesets);
		Controller::get().Transmit(shEventLoadOptions, options);

		// Immediately start up the game, too.
		Controller::get().Transmit(shEventStartGame, false);
	}

	game.load(games, engine);

	// Stats must always go at the end so we can ignore them while loading if
	// desired.
	stats.load(games);
}
Exemplo n.º 2
0
	virtual void dependencies(StringPairArray& array) const
	{
		array.push_back(std::make_pair(swCitiesRules, swCities));
	}
Exemplo n.º 3
0
	virtual void silent_dependencies(StringPairArray& array) const
	{
		array.push_back(std::make_pair(swStandardRules, swGold));
		array.push_back(std::make_pair(swVolcanoRules, swVolcano));
	}
Exemplo n.º 4
0
	virtual void dependencies(StringPairArray& array) const
	{
		array.push_back(std::make_pair(swSeafarersRules, swHiddenTiles));
		array.push_back(std::make_pair(swVolcanoRules, swVolcano));
	}