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

Method LoadMapSettings

src/game/client/gameclient.cpp:4661–4706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4659}
4660
4661void CGameClient::LoadMapSettings()
4662{
4663 m_MapBugs = CMapBugs::Create(Map()->BaseName(), Map()->Size(), Map()->Sha256());
4664
4665 // Reset Tunezones
4666 for(int TuneZone = 0; TuneZone < TuneZone::NUM; TuneZone++)
4667 {
4668 TuningList()[TuneZone] = CTuningParams::DEFAULT;
4669 TuningList()[TuneZone].Set("gun_curvature", 0);
4670 TuningList()[TuneZone].Set("gun_speed", 1400);
4671 TuningList()[TuneZone].Set("shotgun_curvature", 0);
4672 TuningList()[TuneZone].Set("shotgun_speed", 500);
4673 TuningList()[TuneZone].Set("shotgun_speeddiff", 0);
4674 }
4675
4676 // Load map tunings
4677 int Start, Num;
4678 Map()->GetType(MAPITEMTYPE_INFO, &Start, &Num);
4679 for(int i = Start; i < Start + Num; i++)
4680 {
4681 int ItemId;
4682 CMapItemInfoSettings *pItem = (CMapItemInfoSettings *)Map()->GetItem(i, nullptr, &ItemId);
4683 int ItemSize = Map()->GetItemSize(i);
4684 if(!pItem || ItemId != 0)
4685 continue;
4686
4687 if(ItemSize < (int)sizeof(CMapItemInfoSettings))
4688 break;
4689 if(!(pItem->m_Settings > -1))
4690 break;
4691
4692 int Size = Map()->GetDataSize(pItem->m_Settings);
4693 char *pSettings = (char *)Map()->GetData(pItem->m_Settings);
4694 char *pNext = pSettings;
4695 Console()->SetUnknownCommandCallback(UnknownMapSettingCallback, nullptr);
4696 while(pNext < pSettings + Size)
4697 {
4698 int StrSize = str_length(pNext) + 1;
4699 Console()->ExecuteLine(pNext, IConsole::CLIENT_ID_GAME);
4700 pNext += StrSize;
4701 }
4702 Console()->SetUnknownCommandCallback(IConsole::EmptyUnknownCommandCallback, nullptr);
4703 Map()->UnloadData(pItem->m_Settings);
4704 break;
4705 }
4706}
4707
4708void CGameClient::ConTuneParam(IConsole::IResult *pResult, void *pUserData)
4709{

Callers

nothing calls this directly

Calls 14

MapFunction · 0.85
str_lengthFunction · 0.85
BaseNameMethod · 0.45
SizeMethod · 0.45
Sha256Method · 0.45
SetMethod · 0.45
GetTypeMethod · 0.45
GetItemMethod · 0.45
GetItemSizeMethod · 0.45
GetDataSizeMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected