mirror of
https://github.com/yquake2/ctf.git
synced 2024-11-10 06:31:34 +00:00
One entity shooting another should work even if friendly fire is off
In rogue's RHANGAR1 the turret didn't blow up the ceiling when friendly fire was off, because in ClientTeam() both entities were set to "" (no team), but OnSameTeam() just did a strcmp() instead of checking this special case (no team). We check this now and thus it works. Hooray. I also refactored ClientTeam() to take the buffer instead of using a static one and to be static (it's only called by OnSameTeam() anyway).
This commit is contained in:
parent
ca84136e65
commit
e2b397d92c
1 changed files with 5 additions and 6 deletions
11
src/g_cmds.c
11
src/g_cmds.c
|
@ -27,11 +27,10 @@
|
|||
#include "header/local.h"
|
||||
#include "monster/player.h"
|
||||
|
||||
char *
|
||||
ClientTeam(edict_t *ent)
|
||||
static char *
|
||||
ClientTeam(edict_t *ent, char* value)
|
||||
{
|
||||
char *p;
|
||||
static char value[512];
|
||||
|
||||
value[0] = 0;
|
||||
|
||||
|
@ -68,10 +67,10 @@ OnSameTeam(edict_t *ent1, edict_t *ent2)
|
|||
return false;
|
||||
}
|
||||
|
||||
strcpy(ent1Team, ClientTeam(ent1));
|
||||
strcpy(ent2Team, ClientTeam(ent2));
|
||||
ClientTeam(ent1, ent1Team);
|
||||
ClientTeam(ent2, ent2Team);
|
||||
|
||||
if (strcmp(ent1Team, ent2Team) == 0)
|
||||
if (ent1Team[0] != '\0' && strcmp(ent1Team, ent2Team) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue