void C4Network2Players::Init()
{
	// caution: In this call, only local players are joined
	// remote players may have been added already for runtime joins
	// not in replay
	if (Game.C4S.Head.Replay) return;
	// network only
	assert(::Network.isEnabled());
	// must init before game is running
	assert(!Game.IsRunning);
	if (::Network.isHost())
	{
		// host: Rejoin script players from savegame before joining local players so team distribution is done correctly
		// But prepare empty host list before recreation
		JoinLocalPlayer("", true);
		Game.PlayerInfos.CreateRestoreInfosForJoinedScriptPlayers(Game.RestorePlayerInfos);
		JoinLocalPlayer(Game.PlayerFilenames, false);
	}
	else
	{
		// Client: join the local player(s)
		JoinLocalPlayer(Game.PlayerFilenames, true);
	}
}
Esempio n. 2
0
void C4Network2Players::Init()
{
	// caution: In this call, only local players are joined
	// remote players may have been added already for runtime joins
	// not in replay
	if (Game.C4S.Head.Replay) return;
	// network only
	assert(::Network.isEnabled());
	// must init before game is running
	assert(!Game.IsRunning);
	// join the local player(s)
	JoinLocalPlayer(Game.PlayerFilenames, false);
	// host: Rejoin script players from savegame
	if (::Network.isHost())
		Game.PlayerInfos.CreateRestoreInfosForJoinedScriptPlayers(Game.RestorePlayerInfos);
}