mirror of
https://github.com/yquake2/zaero.git
synced 2024-11-10 06:32:04 +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). The savegame table entry for this function was invalid, but it doesn't need to be saved anyway, so I just deleted it from the table.
This commit is contained in:
parent
3bcb10d734
commit
398aeff770
3 changed files with 6 additions and 7 deletions
11
src/g_cmds.c
11
src/g_cmds.c
|
@ -1,10 +1,10 @@
|
||||||
#include "header/local.h"
|
#include "header/local.h"
|
||||||
#include "monster/misc/player.h"
|
#include "monster/misc/player.h"
|
||||||
|
|
||||||
char *ClientTeam (edict_t *ent)
|
static char*
|
||||||
|
ClientTeam (edict_t *ent, char* value)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
static char value[512];
|
|
||||||
|
|
||||||
value[0] = 0;
|
value[0] = 0;
|
||||||
|
|
||||||
|
@ -33,11 +33,12 @@ qboolean OnSameTeam (edict_t *ent1, edict_t *ent2)
|
||||||
if (!((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS)))
|
if (!((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
strcpy (ent1Team, ClientTeam (ent1));
|
ClientTeam (ent1, ent1Team);
|
||||||
strcpy (ent2Team, ClientTeam (ent2));
|
ClientTeam (ent2, ent2Team);
|
||||||
|
|
||||||
if (strcmp(ent1Team, ent2Team) == 0)
|
if (ent1Team[1] != '\0' && strcmp(ent1Team, ent2Team) == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1260,7 +1260,6 @@ extern void ValidateSelectedItem ( edict_t * ent ) ;
|
||||||
extern void SelectPrevItem ( edict_t * ent , int itflags ) ;
|
extern void SelectPrevItem ( edict_t * ent , int itflags ) ;
|
||||||
extern void SelectNextItem ( edict_t * ent , int itflags ) ;
|
extern void SelectNextItem ( edict_t * ent , int itflags ) ;
|
||||||
extern qboolean OnSameTeam ( edict_t * ent1 , edict_t * ent2 ) ;
|
extern qboolean OnSameTeam ( edict_t * ent1 , edict_t * ent2 ) ;
|
||||||
extern char * ClientTeam ( edict_t * ent ) ;
|
|
||||||
extern void ai_run ( edict_t * self , float dist ) ;
|
extern void ai_run ( edict_t * self , float dist ) ;
|
||||||
extern qboolean ai_checkattack ( edict_t * self , float dist ) ;
|
extern qboolean ai_checkattack ( edict_t * self , float dist ) ;
|
||||||
extern void ai_fly_strafe ( edict_t * self , float dist ) ;
|
extern void ai_fly_strafe ( edict_t * self , float dist ) ;
|
||||||
|
|
|
@ -1260,7 +1260,6 @@
|
||||||
{"SelectPrevItem", (byte *)SelectPrevItem},
|
{"SelectPrevItem", (byte *)SelectPrevItem},
|
||||||
{"SelectNextItem", (byte *)SelectNextItem},
|
{"SelectNextItem", (byte *)SelectNextItem},
|
||||||
{"OnSameTeam", (byte *)OnSameTeam},
|
{"OnSameTeam", (byte *)OnSameTeam},
|
||||||
{"ClientTeam", (byte *)ClientTeam},
|
|
||||||
{"ai_run", (byte *)ai_run},
|
{"ai_run", (byte *)ai_run},
|
||||||
{"ai_checkattack", (byte *)ai_checkattack},
|
{"ai_checkattack", (byte *)ai_checkattack},
|
||||||
{"ai_fly_strafe", (byte *)ai_fly_strafe},
|
{"ai_fly_strafe", (byte *)ai_fly_strafe},
|
||||||
|
|
Loading…
Reference in a new issue