MCPcopy Create free account
hub / github.com/ddnet/ddnet / LoadMapSettings

Method LoadMapSettings

src/game/server/gamecontext.cpp:4587–4621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4585}
4586
4587void CGameContext::LoadMapSettings()
4588{
4589 IMap *pMap = Map();
4590 int Start, Num;
4591 pMap->GetType(MAPITEMTYPE_INFO, &Start, &Num);
4592 for(int i = Start; i < Start + Num; i++)
4593 {
4594 int ItemId;
4595 CMapItemInfoSettings *pItem = (CMapItemInfoSettings *)pMap->GetItem(i, nullptr, &ItemId);
4596 int ItemSize = pMap->GetItemSize(i);
4597 if(!pItem || ItemId != 0)
4598 continue;
4599
4600 if(ItemSize < (int)sizeof(CMapItemInfoSettings))
4601 break;
4602 if(!(pItem->m_Settings > -1))
4603 break;
4604
4605 int Size = pMap->GetDataSize(pItem->m_Settings);
4606 char *pSettings = (char *)pMap->GetData(pItem->m_Settings);
4607 char *pNext = pSettings;
4608 while(pNext < pSettings + Size)
4609 {
4610 int StrSize = str_length(pNext) + 1;
4611 Console()->ExecuteLine(pNext, IConsole::CLIENT_ID_GAME);
4612 pNext += StrSize;
4613 }
4614 pMap->UnloadData(pItem->m_Settings);
4615 break;
4616 }
4617
4618 char aBuf[IO_MAX_PATH_LENGTH];
4619 str_format(aBuf, sizeof(aBuf), "maps/%s.map.cfg", g_Config.m_SvMap);
4620 Console()->ExecuteFile(aBuf, IConsole::CLIENT_ID_NO_GAME);
4621}
4622
4623void CGameContext::OnSnap(int ClientId, bool GlobalSnap, bool RecordingDemo)
4624{

Callers

nothing calls this directly

Calls 11

MapFunction · 0.85
str_lengthFunction · 0.85
str_formatFunction · 0.85
ExecuteFileMethod · 0.80
GetTypeMethod · 0.45
GetItemMethod · 0.45
GetItemSizeMethod · 0.45
GetDataSizeMethod · 0.45
GetDataMethod · 0.45
ExecuteLineMethod · 0.45
UnloadDataMethod · 0.45

Tested by

no test coverage detected