engine: return early with 0 from cansee() if either sector is >= MAXSECTORS.

Previously, only the <0 condition was checked. However, the passed sectnums
could be >= MAXSECTORS (at least in C-CON), for example when issuing 'canseespr'
on a sprite not in the game world.

git-svn-id: https://svn.eduke32.com/eduke32@3603 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-03-24 18:55:18 +00:00
parent 3a1c590572
commit 7faffdc674

View file

@ -11165,8 +11165,10 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in
int16_t pendingsectnum;
vec3_t pendingvec;
// invalid sectnums can happen, for example if the player is using noclip
if (sect1 < 0 || sect2 < 0)
// Negative sectnums can happen, for example if the player is using noclip.
// MAXSECTORS can happen from C-CON, e.g. canseespr with a sprite not in
// the game world.
if ((unsigned)sect1 >= MAXSECTORS || (unsigned)sect2 >= MAXSECTORS)
return 0;
Bmemset(&pendingvec, 0, sizeof(vec3_t)); // compiler-happy