From d3eb9d6fe7d3777b23985063312410ef80fbe00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Mon, 23 May 2022 22:35:21 +0200 Subject: [PATCH] Use std::vector instead of array --- src/game/server/gamecontext.cpp | 8 ++++---- src/game/server/gamecontext.h | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index ffa4380ca..461eb01e9 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -1770,15 +1770,15 @@ void CGameContext::CensorMessage(char *pCensoredMessage, const char *pMessage, i { str_copy(pCensoredMessage, pMessage, Size); - for(int i = 0; i < m_aCensorlist.size(); i++) + for(auto &Item : m_vCensorlist) { char *pCurLoc = pCensoredMessage; do { - pCurLoc = (char *)str_utf8_find_nocase(pCurLoc, m_aCensorlist[i].c_str()); + pCurLoc = (char *)str_utf8_find_nocase(pCurLoc, Item.c_str()); if(pCurLoc) { - memset(pCurLoc, '*', m_aCensorlist[i].length()); + memset(pCurLoc, '*', Item.length()); pCurLoc++; } } while(pCurLoc); @@ -3304,7 +3304,7 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/) char *pLine; while((pLine = LineReader.Get())) { - m_aCensorlist.add(pLine); + m_vCensorlist.emplace_back(pLine); } io_close(File); } diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 93bd530d8..ad4ccf634 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -11,8 +11,6 @@ #include #include -#include - #include "eventhandler.h" //#include "gamecontroller.h" #include "game/generated/protocol.h" @@ -74,7 +72,7 @@ class CGameContext : public IGameServer CNetObjHandler m_NetObjHandler; CTuningParams m_Tuning; CTuningParams m_aTuningList[NUM_TUNEZONES]; - array m_aCensorlist; + std::vector m_vCensorlist; bool m_TeeHistorianActive; CTeeHistorian m_TeeHistorian;