Exemple #1
0
void CLobbyApp::SendGameInfo()
{
  ZGameServerInfoMsg* gameInfo = GetGameServerInfoMsg();
  SetVariableGameInfo();
  //must do endian so both side of network get correct numbers
  //gameinfo used on Unix and Intel boxes
  //note that doing this once will invalidate all numbers
  //so set gameInfo->info[0] numbers again.
  ZGameInstanceInfoMsgEndian( gameInfo->info );
  
  //send, usually to many Ip addresses which are Zone Web servers, so add this to your game configuration
  for (int i = 0; i < m_cReportServers; i++)
    ZGameInfoSendTo(m_rgulIP[i], 2000, GetGameServerInfoMsg(), sizeof(m_GameInfoBuf));

  //Imago 9/14
	if (m_fmServers.GetConnections()->GetCount() > 0) {
		int offset = 0;
		char * PostData = new char[BUFFSIZE];
		ZeroMemory(PostData,BUFFSIZE);
		ListConnections::Iterator iterCnxn(*m_fmServers.GetConnections());
		while (!iterCnxn.End()) {
			CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value());
			MissionList::Iterator iterMission(*pServerT->GetMissions());
			while (!iterMission.End()){
				CFLMission* mission = iterMission.Value();
				FMD_LS_LOBBYMISSIONINFO *info = mission->GetMissionInfo();
				if (info) {
					memcpy(PostData + offset, info, info->cbmsg);
					offset += info->cbmsg;
					iterMission.Next();
				}
			}
			iterCnxn.Next();
		}
		if (offset > 0) {
			 pHTTP settings;
			 Strcpy(settings.hdrs,"Content-Type: application/octet-stream\r\n");
			 Strcpy(settings.verb,"POST");
			 Strcpy(settings.uri,"/lobbyinfo.ashx");
			 Strcpy(settings.host,"allegiancezone.com");
			 ZeroMemory(settings.data,BUFFSIZE);
			 memcpy(settings.data,PostData,offset);
			 settings.size = offset;
			 DWORD lpExitCode;
			 GetExitCodeThread(m_threadPost,&lpExitCode);
			 if (lpExitCode != STILL_ACTIVE) {
				debugf("Creating post thread.\n");
				DWORD dum;
				m_threadPost = CreateThread(NULL, 0, PostThread, (void*)&settings, 0, &dum);
			 } else
				 debugf("Post thread was still running...\n");
		}
	}
}
void CLobbyApp::SendGameInfo()
{
	// BT - 7/15 - Send currently connected players to the CSS webservice.
	if (g_pLobbyApp->GetCssGameInfoEnabled() == true)
		SendGameInfoToCss();

	if (g_pLobbyApp->GetAzGameInfoEnabled() == true)
		SendGameInfoToAz();
	
  ZGameServerInfoMsg* gameInfo = GetGameServerInfoMsg();
  SetVariableGameInfo();
  //must do endian so both side of network get correct numbers
  //gameinfo used on Unix and Intel boxes
  //note that doing this once will invalidate all numbers
  //so set gameInfo->info[0] numbers again.
  ZGameInstanceInfoMsgEndian( gameInfo->info );
  
  //send, usually to many Ip addresses which are Zone Web servers, so add this to your game configuration
  for (int i = 0; i < m_cReportServers; i++)
    ZGameInfoSendTo(m_rgulIP[i], 2000, GetGameServerInfoMsg(), sizeof(m_GameInfoBuf));

  
}