Пример #1
0
bool CScreenJoin::PreState_Startup()
{
	IServerDirectory *pServerDir = g_pClientMultiplayerMgr->GetServerDir();
	// Make a serverdir if we don't have one
	// Note : Find a way to put this back in the game client shell!!!  It has to be
	// here right now so that we can delete it when we start up a server..
	// NYI NYI NYI
	if (!pServerDir)
	{
		pServerDir = Factory_Create_IServerDirectory_Titan();
		g_pClientMultiplayerMgr->SetServerDir(pServerDir);
		// Set the game's name
		pServerDir->SetGameName("TheOperative2");
		// Set the version
		pServerDir->SetVersion(g_pVersionMgr->GetBuild());
		// Set up the packet header
		CAutoMessage cMsg;
		cMsg.Writeuint8(11); // CMSG_MESSAGE
		cMsg.Writeuint8(MID_MULTIPLAYER_SERVERDIR);
		pServerDir->SetNetHeader(*cMsg.Read());
	}

	// Load the default CD key
	if (pServerDir->GetCDKey(&m_sCurCDKey))
		m_pCDKeyCtrl->SetString(1,m_sCurCDKey.c_str());

	bool bResult = true;
	bResult &= pServerDir->QueueRequest(IServerDirectory::eRequest_MOTD);
	bResult &= pServerDir->QueueRequest(IServerDirectory::eRequest_Version);
	if (!bResult)
	{
		ChangeState(eState_Error);
		return false;
	}

	// Set the CD key
	pServerDir->SetCDKey(m_sCurCDKey.c_str());

	bResult &= pServerDir->QueueRequest(IServerDirectory::eRequest_Validate_CDKey);
	if (!bResult)
	{
		ChangeState(eState_ChangeCDKey);
		return false;
	}

	return bResult;
}
Пример #2
0
LTRESULT CTO2GameServerShell::OnServerInitialized()
{
	LTRESULT nResult = CGameServerShell::OnServerInitialized();

	// Don't do anything special if we're playing single-player
	if (!IsMultiplayerGame( ))
	{
		SetServerDir(0);
		return nResult;
	}

	IServerDirectory *pServerDir = Factory_Create_IServerDirectory_Titan( false, *g_pLTServer, NULL );
	if( !pServerDir )
	{	
		ASSERT( !"ServerDir is NULL!" );
		return LT_ERROR;
	}
	SetServerDir(pServerDir);

	// Set the game's name
	pServerDir->SetGameName(g_pVersionMgr->GetNetGameName());
	// Set the version
	pServerDir->SetVersion(g_pVersionMgr->GetNetVersion());
	pServerDir->SetRegion(g_pVersionMgr->GetNetRegion());
	// Set up the network messaging header
	CAutoMessage cMsg;
	cMsg.Writeuint8(0xD); // SMSG_MESSAGE
	cMsg.Writeuint8(MID_MULTIPLAYER_SERVERDIR);
	pServerDir->SetNetHeader(*cMsg.Read());

	StartupInfo_Titan startupInfo;
	startupInfo.m_sGameSpyName = "nolf2";
	// Obfuscate the secret key a little.
	startupInfo.m_sGameSpySecretKey = "g";
	startupInfo.m_sGameSpySecretKey += "3";
	startupInfo.m_sGameSpySecretKey += "F";
	startupInfo.m_sGameSpySecretKey += "o";
	startupInfo.m_sGameSpySecretKey += "6";
	startupInfo.m_sGameSpySecretKey += "x";
	cMsg.Writeuint32(( uint32 )&startupInfo );
	pServerDir->SetStartupInfo( *cMsg.Read( ));

	return nResult;
}