2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 15:45:46 +03:00

HLTV: Closed #657

HLDS: Moved check to limit of leafs into SV_SpawnServer function.
This commit is contained in:
s1lent 2019-07-30 23:20:05 +07:00
parent 0c8d3d76ac
commit a0926eda44
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
4 changed files with 15 additions and 29 deletions

View File

@ -175,12 +175,7 @@ byte *BSPModel::DecompressVis(unsigned char *in)
return m_novis;
}
int row = (m_model.numleafs + 7) / 8;
if (row < 0 || row > MODEL_MAX_PVS) {
m_System->Errorf("BSPModel::DecompressVis: oversized m_model.numleafs: %i\n", m_model.numleafs);
}
DecompressPVS(in, decompressed, row);
DecompressPVS(in, decompressed, (m_model.numleafs + 7) / 8);
return decompressed;
}

View File

@ -47,18 +47,8 @@ unsigned char *Mod_DecompressVis(unsigned char *in, model_t *model)
{
return mod_novis;
}
#ifdef REHLDS_FIXES
CM_DecompressPVS(in, decompressed, (model->numleafs + 7) / 8);
#else
int row = (model->numleafs + 7) / 8;
if (row < 0 || row > MODEL_MAX_PVS)
{
Sys_Error("%s: oversized model->numleafs: %i", __func__, model->numleafs);
}
CM_DecompressPVS(in, decompressed, row);
#endif
return decompressed;
}

View File

@ -1036,18 +1036,7 @@ void Mod_LoadLeafs(lump_t *l)
loadmodel->leafs = out;
loadmodel->numleafs = count;
#ifdef REHLDS_FIXES
// Originally check was called only in singleplayer mode, that is why this "if" here (see Mod_LeafPVS, gPVS is not NULL for multiplayer)
if (g_psvs.maxclients <= 1)
{
int row = (loadmodel->numleafs + 7) / 8;
if (row < 0 || row > MODEL_MAX_PVS)
{
Sys_Error("%s: oversized loadmodel->numleafs: %i", __func__, loadmodel->numleafs);
}
}
#endif
for (i = 0; i < count; i++, in++, out++)
{
for (j = 0; j < 3; j++)

View File

@ -6041,6 +6041,18 @@ int SV_SpawnServer(qboolean bIsDemo, char *server, char *startspot)
return 0;
}
#ifdef REHLDS_FIXES
// Originally check was called only in singleplayer mode, that is why this "if" here (see Mod_LeafPVS, gPVS is not NULL for multiplayer)
if (g_psvs.maxclients <= 1)
{
int row = (g_psv.worldmodel->numleafs + 7) / 8;
if (row < 0 || row > MODEL_MAX_PVS)
{
Sys_Error("%s: oversized g_psv.worldmodel->numleafs: %i", __func__, g_psv.worldmodel->numleafs);
}
}
#endif
Sequence_OnLevelLoad(server);
ContinueLoadingProgressBar("Server", 4, 0.0);
if (gmodinfo.clientcrccheck)
@ -6168,7 +6180,7 @@ void SV_LoadEntities(void)
Con_Printf("Using default entities...\n");
}
#endif // REHLDS_FIXES
ED_LoadFromFile(g_psv.worldmodel->entities);
}