diff --git a/MatchBot/MatchAdmin.cpp b/MatchBot/MatchAdmin.cpp index 760df91..4557fde 100644 --- a/MatchBot/MatchAdmin.cpp +++ b/MatchBot/MatchAdmin.cpp @@ -48,7 +48,7 @@ void CMatchAdmin::ServerActivate() this->m_Data.insert(std::make_pair(Info.Auth, Info)); } } - catch (int ErrorCode) + catch (...) { // Catch for erros //gpMetaUtilFuncs->pfnLogConsole(PLID, "[%s][%s] %s", __func__, MB_ADMIN_LIST_FILE, lpMemScript->GetError().c_str()); diff --git a/MatchBot/MatchBot.cpp b/MatchBot/MatchBot.cpp index ff78903..78fc46e 100644 --- a/MatchBot/MatchBot.cpp +++ b/MatchBot/MatchBot.cpp @@ -1152,58 +1152,58 @@ void CMatchBot::RoundEnd(int winStatus, ScenarioEventEndRound event, float tmDel // Update Game Name void CMatchBot::UpdateGameName() { - // // Game Name - // static char GameDesc[32]; + // Game Name + static char GameDesc[32]; - // // If has CSGameRules loaded - // if (g_pGameRules) - // { - // // Store original game description - // if (this->m_GameDesc.empty()) - // { - // // Get default game name - // if (CSGameRules()->GetGameDescription()) - // { - // this->m_GameDesc = CSGameRules()->GetGameDescription(); - // } - // else - // { - // this->m_GameDesc = "Counter-Strike"; - // } - // } - - // // If is enabled - // if (this->m_GameName && this->m_GameName->value) - // { - // // Get match state - // auto State = gMatchBot.GetState(); - - // // If is not running, set default name - // if (State == STATE_DEAD) - // { - // // Restore default game name - // Q_strncpy(GameDesc, this->m_GameDesc.c_str(), sizeof(GameDesc)); - // } - // else if (State == STATE_WARMUP || State == STATE_START) - // { - // // Set game name from state name - // Q_strncpy(GameDesc, gMatchBot.GetState(State), sizeof(GameDesc)); - // } - // else if (State >= STATE_FIRST_HALF && State <= STATE_END) - // { - // // Format game name with teams and scores - // Q_snprintf(GameDesc, sizeof(GameDesc), "%s %d : %d %s", gMatchBot.GetTeam(TERRORIST, true), gMatchBot.GetScore(TERRORIST), gMatchBot.GetScore(CT), gMatchBot.GetTeam(CT, true)); - // } - // } - // else - // { - // // Restore default game name - // Q_strncpy(GameDesc, this->m_GameDesc.c_str(), sizeof(GameDesc)); - // } - - // // Set - // CSGameRules()->m_GameDesc = GameDesc; - // } + // If has CSGameRules loaded + if (g_pGameRules) + { + // Store original game description + if (this->m_GameDesc.empty()) + { + // Get default game name + if (CSGameRules()->GetGameDescription()) + { + this->m_GameDesc = CSGameRules()->GetGameDescription(); + } + else + { + this->m_GameDesc = "Counter-Strike"; + } + } + + // If is enabled + if (this->m_GameName && this->m_GameName->value) + { + // Get match state + auto State = gMatchBot.GetState(); + + // If is not running, set default name + if (State == STATE_DEAD) + { + // Restore default game name + Q_strncpy(GameDesc, this->m_GameDesc.c_str(), sizeof(GameDesc)); + } + else if (State == STATE_WARMUP || State == STATE_START) + { + // Set game name from state name + Q_strncpy(GameDesc, gMatchBot.GetState(State), sizeof(GameDesc)); + } + else if (State >= STATE_FIRST_HALF && State <= STATE_END) + { + // Format game name with teams and scores + Q_snprintf(GameDesc, sizeof(GameDesc), "%s %d : %d %s", gMatchBot.GetTeam(TERRORIST, true), gMatchBot.GetScore(TERRORIST), gMatchBot.GetScore(CT), gMatchBot.GetTeam(CT, true)); + } + } + else + { + // Restore default game name + Q_strncpy(GameDesc, this->m_GameDesc.c_str(), sizeof(GameDesc)); + } + + // Set + CSGameRules()->m_GameDesc = GameDesc; + } } // Start vote map diff --git a/MatchBot/MatchCommand.cpp b/MatchBot/MatchCommand.cpp index f6ccdee..09bbdf9 100644 --- a/MatchBot/MatchCommand.cpp +++ b/MatchBot/MatchCommand.cpp @@ -39,7 +39,7 @@ void CMatchCommand::ServerActivate() this->m_Data[Name] = {Index, Name, Flag}; } } - catch (int ErrorCode) + catch (...) { // Catch for erros //gpMetaUtilFuncs->pfnLogConsole(PLID, "[%s][%s] %s", __func__, MB_COMMANDS_FILE, lpMemScript->GetError().c_str()); diff --git a/MatchBot/MatchCvarMenu.cpp b/MatchBot/MatchCvarMenu.cpp index 1c3dade..5fadb97 100644 --- a/MatchBot/MatchCvarMenu.cpp +++ b/MatchBot/MatchCvarMenu.cpp @@ -67,7 +67,7 @@ void CMatchCvarMenu::ServerActivate() } } } - catch (int ErrorCode) + catch (...) { // Catch for erros //gpMetaUtilFuncs->pfnLogConsole(PLID, "[%s][%s] %s", __func__, MB_CVAR_MENU_FILE, lpMemScript->GetError().c_str()); diff --git a/MatchBot/MatchLanguage.cpp b/MatchBot/MatchLanguage.cpp index 8cb8c82..615de23 100644 --- a/MatchBot/MatchLanguage.cpp +++ b/MatchBot/MatchLanguage.cpp @@ -58,7 +58,7 @@ void CMatchLanguage::Load() } } } - catch (int ErrorCode) + catch (...) { // Catch for erros // gpMetaUtilFuncs->pfnLogConsole(PLID, "[%s][%s] %s", __func__, MB_LANGUAGE_FILE, lpMemScript->GetError().c_str()); diff --git a/MatchBot/MatchUtil.cpp b/MatchBot/MatchUtil.cpp index 521863f..d42e172 100644 --- a/MatchBot/MatchUtil.cpp +++ b/MatchBot/MatchUtil.cpp @@ -30,7 +30,7 @@ cvar_t* CMatchUtil::CvarRegister(const char* Name, const char* Value) { this->m_CvarData[Name].name = Name; - this->m_CvarData[Name].string = strdup(Value); + this->m_CvarData[Name].string = _strdup(Value); this->m_CvarData[Name].flags = (FCVAR_SERVER | FCVAR_PROTECTED | FCVAR_SPONLY | FCVAR_UNLOGGED); @@ -584,7 +584,7 @@ std::map CMatchUtil::GetMapList(bool CurrentMap) } } } - catch (int ErrorCode) + catch (...) { // Catch for erros //gpMetaUtilFuncs->pfnLogConsole(PLID, "[%s][%s] %s", __func__, MB_MAP_LIST_FILE, lpMemScript->GetError().c_str());