From bcbae17d9c5cfb756c28edd108906b179f7368a0 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 30 Nov 2014 17:50:34 +0100 Subject: [PATCH] Fix Coop Bug in RHANGAR1 when friendly fire was off In 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. 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. --- src/g_cmds.c | 11 +++++------ src/savegame/tables/gamefunc_decs.h | 1 - src/savegame/tables/gamefunc_list.h | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/g_cmds.c b/src/g_cmds.c index 326b45a..ee19bd2 100644 --- a/src/g_cmds.c +++ b/src/g_cmds.c @@ -8,11 +8,10 @@ #include "header/local.h" #include "monster/misc/player.h" -char * -ClientTeam(edict_t *ent) +static char * +ClientTeam(edict_t *ent, char* value) { char *p; - static char value[512]; value[0] = 0; @@ -59,10 +58,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; } diff --git a/src/savegame/tables/gamefunc_decs.h b/src/savegame/tables/gamefunc_decs.h index 5065b72..3a89a62 100644 --- a/src/savegame/tables/gamefunc_decs.h +++ b/src/savegame/tables/gamefunc_decs.h @@ -1427,7 +1427,6 @@ extern void ValidateSelectedItem ( edict_t * ent ) ; extern void SelectPrevItem ( edict_t * ent , int itflags ) ; extern void SelectNextItem ( edict_t * ent , int itflags ) ; extern qboolean OnSameTeam ( edict_t * ent1 , edict_t * ent2 ) ; -extern char * ClientTeam ( edict_t * ent ) ; extern void GetChaseTarget ( edict_t * ent ) ; extern void ChasePrev ( edict_t * ent ) ; extern void ChaseNext ( edict_t * ent ) ; diff --git a/src/savegame/tables/gamefunc_list.h b/src/savegame/tables/gamefunc_list.h index 22934ee..f3a2809 100644 --- a/src/savegame/tables/gamefunc_list.h +++ b/src/savegame/tables/gamefunc_list.h @@ -1428,7 +1428,6 @@ {"SelectPrevItem", (byte *)SelectPrevItem}, {"SelectNextItem", (byte *)SelectNextItem}, {"OnSameTeam", (byte *)OnSameTeam}, -{"ClientTeam", (byte *)ClientTeam}, {"GetChaseTarget", (byte *)GetChaseTarget}, {"ChasePrev", (byte *)ChasePrev}, {"ChaseNext", (byte *)ChaseNext},