Skip to content

Commit

Permalink
Add back apiVersionLoaded
Browse files Browse the repository at this point in the history
  • Loading branch information
GameChaos committed Oct 29, 2024
1 parent 1b76c20 commit d57dfa5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/kz/mappingapi/kz_mappingapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static_global struct
{
CUtlVectorFixed<KZCourseDescriptor, KZ_MAX_COURSE_COUNT> courseDescriptors;
i32 mapApiVersion;
bool apiVersionLoaded;
bool fatalFailure;

CUtlVectorFixed<KzTrigger, 2048> triggers;
Expand Down Expand Up @@ -477,11 +478,16 @@ void KZ::mapapi::Init()

void KZ::mapapi::OnCreateLoadingSpawnGroupHook(const CUtlVector<const CEntityKeyValues *> *pKeyValues)
{
g_mappingApi = {};
if (!pKeyValues)
{
return;
}

if (g_mappingApi.apiVersionLoaded)
{
return;
}

for (i32 i = 0; i < pKeyValues->Count(); i++)
{
auto ekv = (*pKeyValues)[i];
Expand All @@ -494,6 +500,7 @@ void KZ::mapapi::OnCreateLoadingSpawnGroupHook(const CUtlVector<const CEntityKey
if (KZ_STREQI(classname, "worldspawn"))
{
// We only care about the first spawn group's worldspawn because the rest might use prefabs compiled outside of mapping API.
g_mappingApi.apiVersionLoaded = true;
g_mappingApi.mapApiVersion = ekv->GetInt("timer_mapping_api_version", KZ_NO_MAPAPI_VERSION);
// NOTE(GameChaos): When a new mapping api version comes out, this will change
// for backwards compatibility.
Expand Down

0 comments on commit d57dfa5

Please sign in to comment.