Bazaar developer reference

CvPreGame::loadSlotHints(FDataStream &, bool)

Defined in
CvPreGame.cpp, line 579
Hook name
CivHooks::CvPreGame_loadSlotHints

Hooks

static bool BeforeCvPreGame_loadSlotHints(FDataStream& loadFrom, bool bReadVersion);static void AfterCvPreGame_loadSlotHints(FDataStream& loadFrom, bool bReadVersion);static void ReplaceCvPreGame_loadSlotHints(void (*original)(FDataStream&, bool), FDataStream& loadFrom, bool bReadVersion);CivRegisterBefore<CivHooks::CvPreGame_loadSlotHints>(host, &BeforeCvPreGame_loadSlotHints);CivRegisterAfter<CivHooks::CvPreGame_loadSlotHints>(host, &AfterCvPreGame_loadSlotHints);CivRegisterReplace<CivHooks::CvPreGame_loadSlotHints>(host, &ReplaceCvPreGame_loadSlotHints);

Code

579void loadSlotHints(FDataStream& loadFrom, bool bReadVersion)580{581	uint uiVersion = 0;582	if(bReadVersion)583		loadFrom >> uiVersion;584585	GameSpeedTypes	gameSpeed;586	WorldSizeTypes	worldSize;587	CvString		mapScriptName;588	std::vector<CivilizationTypes>	civilizations;589	std::vector<CvString> nicknames;590	std::vector<TeamTypes> teamTypes;591	std::vector<SlotStatus> slotStatus;592	std::vector<SlotClaim> slotClaims;593	std::vector<HandicapTypes> handicapTypes;594	std::vector<CvString> civilizationKeys;595	std::vector<CvString> leaderKeys;596597	loadSlotsHelper(loadFrom, uiVersion, gameSpeed, worldSize, mapScriptName, civilizations, nicknames, slotStatus, slotClaims, teamTypes, handicapTypes, civilizationKeys, leaderKeys);598599	s_gameSpeed = gameSpeed;600	s_worldSize = worldSize;601	s_mapScriptName = mapScriptName;602	if (uiVersion >= 3)603	{604		// Set the civilizations and leaders from the key values605		if (civilizationKeys.size() > 0)606		{607			for (uint i = 0; i < civilizationKeys.size(); ++i)	608				setCivilizationKey((PlayerTypes)i, civilizationKeys[i]);609		}610		else611			// Fall back to using the indices.  This shouldn't happen.612			s_civilizations = civilizations;613614		if (leaderKeys.size() > 0)615		{616			for (uint i = 0; i < leaderKeys.size(); ++i)	617				setLeaderKey((PlayerTypes)i, leaderKeys[i]);618		}619	}620	else621	{622		// Civilization saved as indices, not a good idea.623		s_civilizations = civilizations;624	}625626	s_nicknames = nicknames;627	s_teamTypes = teamTypes;628	s_slotStatus = slotStatus;629	s_slotClaims = slotClaims;630631	// The slots hints handicaps may be invalid, only copy them over if they are not632	if(handicapTypes.size() == MAX_PLAYERS)633		s_handicaps = handicapTypes;634635	size_t i;636	for(i = 0; i < s_nicknames.size(); ++i)637	{638		PlayerTypes p = static_cast<PlayerTypes>(i);639		setNickname(p, s_nicknames[i]); // fix display names640	}641642	ReseatConnectedPlayers();643}

Calls

Called by