diff --git a/code/game/g_fx.c b/code/game/g_fx.c index a5560b2..6f2ef34 100644 --- a/code/game/g_fx.c +++ b/code/game/g_fx.c @@ -1058,11 +1058,11 @@ void fx_torpedo_think(gentity_t *ent) { ent->use = fx_torpedo_use; } -void fx_torpedo_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { - if(!Q_stricmp(ent->swapname, activator->target)) { +void fx_torpedo_use(gentity_t *ent, /*@unused@*/ gentity_t *other, gentity_t *activator) { + if(Q_stricmp(ent->swapname, activator->target) == 0) { ent->flags ^= FL_LOCKED; } else { - if(ent->flags & FL_LOCKED){ + if((ent->flags & FL_LOCKED) != 0){ trap_SendServerCommand(activator-g_entities, va("print \"^1Torpedo launcher is offline.\n\"")); G_AddEvent(ent, EV_GENERAL_SOUND, ent->n00bCount); return; @@ -1079,7 +1079,7 @@ void fx_torpedo_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { } G_AddEvent(ent, EV_FX_TORPEDO, ent->spawnflags); - ent->use = 0; + ent->use = NULL; ent->think = fx_torpedo_think; ent->nextthink = level.time + ent->wait; } @@ -1089,8 +1089,15 @@ void fx_torpedo_link(gentity_t *ent) { vec3_t dir; gentity_t *target = NULL; - target = G_Find(target, FOFS(targetname), ent->target); - if(!target) { + if(ent->target != NULL && ent->target[0] != 0) { + target = G_Find(target, FOFS(targetname), ent->target); + } else { + DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] fx_torpedo_link: ent->target is NULL\n");); + G_FreeEntity(ent); + return; + } + + if(target == NULL) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] Could not find target %s for fx_torpedo at %s!\n", ent->target, vtos(ent->s.origin));); G_FreeEntity(ent); return; diff --git a/code/game/g_local.h b/code/game/g_local.h index 70cc58d..62d6e0d 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -761,7 +761,7 @@ qboolean G_SpawnString( const char* key, const char* defaultString, /*@out@*/ ch * \param[out] out The result. * \return Success or fail. */ -qboolean G_SpawnFloat( const char* key, const char* defaultString, float* out ); +qboolean G_SpawnFloat( const char* key, const char* defaultString, /*@out@*/ float* out ); /** * \brief Get a int for a custom entity key. @@ -771,7 +771,7 @@ qboolean G_SpawnFloat( const char* key, const char* defaultString, float* out ); * \param[out] out The result. * \return Success or fail. */ -qboolean G_SpawnInt( const char* key, const char* defaultString, int* out ); +qboolean G_SpawnInt( const char* key, const char* defaultString, /*@out@*/ int* out ); /** * \brief Get a vector for a custom entity key. @@ -781,7 +781,7 @@ qboolean G_SpawnInt( const char* key, const char* defaultString, int* out ); * \param[out] out The result. * \return Success or fail. */ -qboolean G_SpawnVector( const char* key, const char* defaultString, float* out ); +qboolean G_SpawnVector( const char* key, const char* defaultString, /*@out@*/ float* out ); /** * \brief Spawn all entities from the entity string.