Use std::vector<std::string> instead of array

This commit is contained in:
Robert Müller 2022-05-23 22:35:21 +02:00
parent 0f097a0490
commit d3eb9d6fe7
2 changed files with 5 additions and 7 deletions

View file

@ -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);
}

View file

@ -11,8 +11,6 @@
#include <game/mapbugs.h>
#include <game/voting.h>
#include <base/tl/array.h>
#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<std::string> m_aCensorlist;
std::vector<std::string> m_vCensorlist;
bool m_TeeHistorianActive;
CTeeHistorian m_TeeHistorian;