fixes and annotations

This commit is contained in:
Walter Julius Hennecke 2013-05-26 23:16:48 +02:00
parent 683806fcfc
commit c5ffe4900b
2 changed files with 16 additions and 9 deletions

View file

@ -1058,11 +1058,11 @@ void fx_torpedo_think(gentity_t *ent) {
ent->use = fx_torpedo_use; ent->use = fx_torpedo_use;
} }
void fx_torpedo_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { void fx_torpedo_use(gentity_t *ent, /*@unused@*/ gentity_t *other, gentity_t *activator) {
if(!Q_stricmp(ent->swapname, activator->target)) { if(Q_stricmp(ent->swapname, activator->target) == 0) {
ent->flags ^= FL_LOCKED; ent->flags ^= FL_LOCKED;
} else { } else {
if(ent->flags & FL_LOCKED){ if((ent->flags & FL_LOCKED) != 0){
trap_SendServerCommand(activator-g_entities, va("print \"^1Torpedo launcher is offline.\n\"")); trap_SendServerCommand(activator-g_entities, va("print \"^1Torpedo launcher is offline.\n\""));
G_AddEvent(ent, EV_GENERAL_SOUND, ent->n00bCount); G_AddEvent(ent, EV_GENERAL_SOUND, ent->n00bCount);
return; 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); G_AddEvent(ent, EV_FX_TORPEDO, ent->spawnflags);
ent->use = 0; ent->use = NULL;
ent->think = fx_torpedo_think; ent->think = fx_torpedo_think;
ent->nextthink = level.time + ent->wait; ent->nextthink = level.time + ent->wait;
} }
@ -1089,8 +1089,15 @@ void fx_torpedo_link(gentity_t *ent) {
vec3_t dir; vec3_t dir;
gentity_t *target = NULL; gentity_t *target = NULL;
target = G_Find(target, FOFS(targetname), ent->target); if(ent->target != NULL && ent->target[0] != 0) {
if(!target) { 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));); 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); G_FreeEntity(ent);
return; return;

View file

@ -761,7 +761,7 @@ qboolean G_SpawnString( const char* key, const char* defaultString, /*@out@*/ ch
* \param[out] out The result. * \param[out] out The result.
* \return Success or fail. * \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. * \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. * \param[out] out The result.
* \return Success or fail. * \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. * \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. * \param[out] out The result.
* \return Success or fail. * \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. * \brief Spawn all entities from the entity string.