summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2015-01-08 00:42:15 +0100
committerenneract <trem.redman@gmail.com>2015-01-08 00:42:15 +0100
commit96bede71e66823dc28a57935e48e4cc7b17f55af (patch)
tree26dbd475a40bdf1d3412d5a7d5c9ad23a16c8bd5
parent96f8e06ec9aa117bb8dd7e8d671d93e3884cb98f (diff)
Fix various linking errors and segfaults.
-rw-r--r--src/game/g_admin.c7
-rw-r--r--src/game/g_buildable.c4
-rw-r--r--src/game/g_combat.c14
-rw-r--r--src/game/g_team.c13
-rw-r--r--src/game/g_weapon.c15
5 files changed, 23 insertions, 30 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index b6e115b..6beac1c 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -3421,7 +3421,7 @@ qboolean G_admin_score_info( gentity_t *ent )
char name[ MAX_NAME_LENGTH ];
g_admin_admin_t *target;
namelog_t *match;
- int newscore;
+ int newscore = 0;
if( trap_Argc() < 2 )
{
@@ -3704,7 +3704,6 @@ static char *fates[] =
qboolean G_admin_slap( gentity_t *ent )
{
- int pids[ MAX_CLIENTS ];
int pid;
char name[ MAX_NAME_LENGTH ], *reason, err[ MAX_STRING_CHARS ];
int minargc;
@@ -3763,12 +3762,12 @@ qboolean G_admin_slap( gentity_t *ent )
if( vic->health <= 1 )
{
vic->flags |= FL_NO_KNOCKBACK;
- vic->enemy = &g_entities[ pids[ 0 ] ];
+ vic->enemy = ent;
vic->die( vic, ent, ent, 25, MOD_SLAP );
}
else if( vic->pain )
{
- vic->pain( vic, &g_entities[ pids[ 0 ] ], 2 );
+ vic->pain( vic, ent, 2 );
}
return qtrue;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index d132890..51946a0 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -729,7 +729,7 @@ G_IsCreepHere
simple wrapper to G_FindCreep to check if a location has creep
================
*/
-static qboolean G_IsCreepHere( vec3_t origin )
+qboolean G_IsCreepHere( vec3_t origin )
{
gentity_t dummy;
@@ -5137,7 +5137,7 @@ static void G_LayoutBuildItem( buildable_t buildable, vec3_t origin,
G_SpawnBuildable( builder, buildable );
}
-static void G_LayoutForceBuildItem( buildable_t buildable, vec3_t origin,
+void G_LayoutForceBuildItem( buildable_t buildable, vec3_t origin,
vec3_t angles, vec3_t origin2, vec3_t angles2 )
{
gentity_t *builder;
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index a9c3999..65bd8d5 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -1411,16 +1411,14 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
targ->health = targ->health - take;
if( targ->client )
+ {
targ->client->ps.stats[ STAT_HEALTH ] = targ->health;
- //turn off cloak if it is already activated and if the target is damaged
- if( targ->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )
- {
- if( targ->client->cloakActivated )
- {
- if( !( targ->client->cloakReady ) )
- targ->client->ps.eFlags &= ~EF_MOVER_STOP;
- }
+ //turn off cloak if it is already activated and if the target is damaged
+ if( targ->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS &&
+ targ->client->cloakActivated &&
+ !targ->client->cloakReady )
+ targ->client->ps.eFlags &= ~EF_MOVER_STOP;
}
}
diff --git a/src/game/g_team.c b/src/game/g_team.c
index 246c072..fd62600 100644
--- a/src/game/g_team.c
+++ b/src/game/g_team.c
@@ -206,6 +206,11 @@ void G_LeaveTeamReal( gentity_t *self, qboolean reset_score )
if( ent->client->ps.stats[ STAT_STATE ] & SS_POISONED &&
ent->client->lastPoisonClient == self )
ent->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
+
+ // cure infection
+ if( ent->client->ps.stats[ STAT_STATE ] & SS_INFECTED &&
+ ent->client->lastInfectionClient == self )
+ ent->client->ps.stats[ STAT_STATE ] &= ~SS_INFECTED;
}
else if( ent->s.eType == ET_MISSILE && ent->r.ownerNum == self->s.number )
G_FreeEntity( ent );
@@ -213,14 +218,6 @@ void G_LeaveTeamReal( gentity_t *self, qboolean reset_score )
// cut all relevant zap beams
G_ClearPlayerZapEffects( self );
-
- // cure infection
- if( ent->client->ps.stats[ STAT_STATE ] & SS_INFECTED &&
- ent->client->lastInfectionClient == self )
- ent->client->ps.stats[ STAT_STATE ] &= ~SS_INFECTED;
-
- else if( ent->s.eType == ET_MISSILE && ent->r.ownerNum == self->s.number )
- G_FreeEntity( ent );
G_namelog_update_score( self->client );
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 2aa9563..5779aec 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -1476,19 +1476,18 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target )
// the zap chains only through living entities
if( target->health > 0 )
{
- if (target->client->ps.stats[ STAT_TEAM ] != TEAM_ALIENS)
- G_Damage( target, creator, creator, forward,
- target->s.origin, LEVEL2_AREAZAP_DMG,
- DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE,
- MOD_LEVEL2_ZAP );
+ if( !target->client || target->client->ps.stats[ STAT_TEAM ] != TEAM_ALIENS )
+ G_Damage( target, creator, creator, forward, target->s.origin, LEVEL2_AREAZAP_DMG,
+ DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, MOD_LEVEL2_ZAP );
G_FindZapChainTargets( zap );
for( i = 1; i < zap->numTargets; i++ )
{
- if (zap->targets[ i ]->client->ps.stats[ STAT_TEAM ] != TEAM_ALIENS)
- G_Damage( zap->targets[ i ], target, zap->creator, forward, target->s.origin,
- LEVEL2_AREAZAP_DMG * ( 1 - pow( (zap->distances[ i ] /
+ if( !zap->targets[ i ]->client ||
+ zap->targets[ i ]->client->ps.stats[ STAT_TEAM ] != TEAM_ALIENS )
+ G_Damage( zap->targets[ i ], target, zap->creator, forward, target->s.origin,
+ LEVEL2_AREAZAP_DMG * ( 1 - pow( (zap->distances[ i ] /
LEVEL2_AREAZAP_CHAIN_RANGE ), LEVEL2_AREAZAP_CHAIN_FALLOFF ) ) + 1,
DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE,
MOD_LEVEL2_ZAP );