Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
SmileYzn committed Dec 18, 2024
1 parent b3fb98b commit 6851faa
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion MatchBot/MatchAdmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
102 changes: 51 additions & 51 deletions MatchBot/MatchBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion MatchBot/MatchCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion MatchBot/MatchCvarMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion MatchBot/MatchLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions MatchBot/MatchUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -584,7 +584,7 @@ std::map<int, std::string> 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());
Expand Down

0 comments on commit 6851faa

Please sign in to comment.