void TServerConnectState::Update(nel::TGameTime deltaTime) { TGameState::Update(deltaTime); IClient* client = (IClient*)Application->RetrieveInterface(IID_IClient); assert(client); client->Process(); switch (progress) { case SHOULDCONNECT: ConnectToServer(); progress = CONNECTING; break; case CONNECTING: if (client->IsConnected()) progress = CONNECTED; break; case CONNECTED: if (client->IsInLobby()) { progress = INLOBBY; Owner->SetNextState(SID_Lobby); } break; case INLOBBY: break; }; }
void CForwardManager::UnhookServer(HLTVServerWrapper *wrapper) { IServer *server = wrapper->GetBaseServer(); if (m_bHasClientConnectOffset) SH_REMOVE_MANUALHOOK(CHLTVServer_ConnectClient, server, SH_MEMBER(this, &CForwardManager::OnSpectatorConnect), false); if (m_bHasGetChallengeTypeOffset) SH_REMOVE_MANUALHOOK(CHLTVServer_GetChallengeType, server, SH_MEMBER(this, &CForwardManager::OnGetChallengeType), false); // Unhook all connected clients as well. for (int i = 0; i < server->GetClientCount(); i++) { IClient *client = server->GetClient(i); if (client->IsConnected()) UnhookClient(client); } }
void CForwardManager::HookServer(HLTVServerWrapper *wrapper) { IServer *server = wrapper->GetBaseServer(); if (m_bHasClientConnectOffset) SH_ADD_MANUALHOOK(CHLTVServer_ConnectClient, server, SH_MEMBER(this, &CForwardManager::OnSpectatorConnect), false); if (m_bHasGetChallengeTypeOffset) SH_ADD_MANUALHOOK(CHLTVServer_GetChallengeType, server, SH_MEMBER(this, &CForwardManager::OnGetChallengeType), false); // Hook all already connected clients as well for late loading for (int i = 0; i < server->GetClientCount(); i++) { IClient *client = server->GetClient(i); if (client->IsConnected()) { HookClient(client); // Ip and password unknown :( // Could add more gamedata to fetch it if people really lateload the extension and expect it to work :B wrapper->GetClient(i + 1)->Initialize("", "", client); } } }