Open 2010kohtep opened 5 years ago
Fixed, will be in next beta update.
Fixed in beta 'Exe build: 11:12:36 May 21 2019 (8244)'.
Closing as fixed.
Unfortunately it looks like CZ:DS and likely some other games rely on this bug being present and it's a bit difficult to test for this without playing through every single scene of every single game. I'm going to revert this in PEntityOfEntIndex
to avoid causing crashes in places using the returned entity unchecked and revisit actually fixing it later.
For mods using this that want the fixed behaviour, I did add a parallel function to the engine interface, PEntityOfEntIndexAllEntities
. This function properly checks the [1, svs.maxclients]
range and can be used while PEntityOfEntIndex
has this issue.
This has been updated in beta 8279.
@mikela-valve Here's all I found in CZ:DS Beta 8265: Recoil: Crashes the game after helicopter takedown scene (after CS:CZ logo) Fastline: Crashes the game after the tram explosion (after CS:CZ logo) Run!: Crashes the game upon loading the mission's first map. Truth in Chaos & Rise Hard: Crashes the game after the end of conversation with gaurds (when the next map loading screen hits) Other missions are playing good without crashes. Still we need someone to confirm if this happens in other Single player titles (HL, OF, BS etc..) Since I don't own any of these unfortunately :\
@mikela-valve so right after
int (*pfnCheckParm)( const char *pchCmdLineToken, char **ppnext );
is
edict_t* (*PEntityOfEntIndexAllEntities)(int iEntIndex);
in enginefuncs_t?
And this will be live once the next beta is promoted to release?
Thanks @CS-PRO1.
@tschumann That's correct (though it will be pfnPEntityOfEntIndexAllEntities
). I'll update eiface.h when the update is released.
PEntityOfEntIndex
function has a condition that prevents the last player from being returned. This is because the player index starts at 1, since the map is already located at index 0 and therefore we must perform a check in the range1 .. sv::maxplayers
.The solution is to replace the
>=
check with>
to allow the last player to be checked.