bool CExtraProcessor::ProcessCommand(void) { try { if( Operation == Operation_GetServerInfo ) { GetServerInfo(); return(true); } if( Operation == Operation_ShutdownServer ) { ShutdownServer(); return(true); } if( Operation == Operation_GetServerErrors ) { GetServerErrors(); return(true); } if( Operation == Operation_RegisterClient ) { RegisterClient(); return(true); } if( Operation == Operation_UnregisterClient ) { UnregisterClient(); return(true); } } catch(std::exception& e) { CMD_ERROR_FROM_EXCEPTION(Command,"unable process the request",e); return(false); } CSmallString error; error << "operation " << Operation.GetStringForm() << " is not implemented"; CMD_ERROR(Command,error); return(false); }
void WSServer::RegisterPlayer(ClientID client, Player& player) { auto i = m_mapPlayerToClient.find(&player); if (i != m_mapPlayerToClient.end()) if (UnregisterClient(i->second, true)) UnregisterPlayer(i->second); m_mapPlayerToClient[&player] = client; m_mapClientToPlayer[client] = &player; m_players.insert(&player); std::cout << "INFO: Client registered: " << client << " -> " << player.GetName() << std::endl; m_controller.OnPlayerConnected(player); }
bool CABFProcessor::ProcessCommand(void) { try { if(Operation == Operation_GetServerInfo) { GetServerInfo(); return(true); } if(Operation == OperationPMF_FlushServerData) { FlushServerData(); return(true); } if(Operation == Operation_RegisterClient) { RegisterClient(); return(true); } if(Operation == Operation_UnregisterClient) { UnregisterClient(); return(true); } if(Operation == OperationPMF_GetInitialData) { GetInitialData(); return(true); } if(Operation == OperationPMF_ExchangeData) { ExchangeData(); return(true); } if(Operation == OperationPMF_GetData) { GetData(); return(true); } } catch(std::exception& e) { CMD_ERROR_FROM_EXCEPTION(Command,"unable process the request",e); return(false); } CSmallString error; error << "operation " << Operation.GetStringForm() << " is not implemented"; CMD_ERROR(Command,error); return(false); }