void IGameController::ResetGame() { // reset the game for(int i=0; i<MOD_NUM_WORLDS; i++) { GameServer()->m_World[i].m_ResetRequested = true; } SetGameState(IGS_GAME_RUNNING); m_GameStartTick = Server()->Tick(); m_SuddenDeath = 0; int MatchNum = (str_length(g_Config.m_SvMaprotation) && g_Config.m_SvMatchesPerMap) ? g_Config.m_SvMatchesPerMap : 0; if(MatchNum == 0) m_MatchCount = 0; bool GameInfoChanged = (m_GameInfo.m_MatchCurrent != m_MatchCount+1) || (m_GameInfo.m_MatchNum != MatchNum) || (m_GameInfo.m_ScoreLimit != g_Config.m_SvScorelimit) || (m_GameInfo.m_TimeLimit != g_Config.m_SvTimelimit); m_GameInfo.m_MatchCurrent = m_MatchCount+1; m_GameInfo.m_MatchNum = MatchNum; m_GameInfo.m_ScoreLimit = g_Config.m_SvScorelimit; m_GameInfo.m_TimeLimit = g_Config.m_SvTimelimit; if(GameInfoChanged) UpdateGameInfo(-1); // do team-balancing DoTeamBalance(); }
void CMonitorPage::InvalidateMonitorData() { if (m_nJK == 0) { m_nJK = ::GetDbMgr()->GetOptInt(OPT_M_LASTJKZS); m_ServerMedicalTime = ::GetDbMgr()->GetOptInt(OPT_M_LASTTJTIME); if (m_nJK == 0 || m_ServerMedicalTime == 0) CalcJKZS(); } CString strServerMedicalTime; if (m_ServerMedicalTime) { tm *tm = ::_localtime32(&m_ServerMedicalTime); strServerMedicalTime.Format( "%04d/%02d/%02d %02d:%02d:%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); } else { strServerMedicalTime = "尚未体检"; } UpdateJKZS(m_nJK, strServerMedicalTime); UpdateServer(m_Servers, m_nServer); UpdateClient(&m_ClientInfo); UpdateGameInfo(&m_GameInfo); }
void IGameController::OnPlayerConnect(CPlayer *pPlayer) { int ClientID = pPlayer->GetCID(); pPlayer->Respawn(); char aBuf[128]; str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientID, Server()->ClientName(ClientID), pPlayer->GetTeam()); GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf); // update game info UpdateGameInfo(ClientID); }