From 8a313b5cf306214963ce97165960d48b2e02ed80 Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 5 Oct 2015 12:27:14 +1100 Subject: [PATCH] Nades: check return of Nade_TrailEffect --- qcsrc/client/weapons/projectile.qc | 3 ++- qcsrc/common/nades.qh | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 07228885d..c83dc0551 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -326,7 +326,8 @@ void Ent_Projectile() if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) { setmodel(self, MDL_PROJECTILE_NADE); - self.traileffect = _particleeffectnum(Nade_TrailEffect(self.cnt, self.team)); + string trail = Nade_TrailEffect(self.cnt, self.team); + if (trail) self.traileffect = _particleeffectnum(trail); break; } error("Received invalid CSQC projectile, can't work with this!"); diff --git a/qcsrc/common/nades.qh b/qcsrc/common/nades.qh index ba189c9bf..1ec1b9ec7 100644 --- a/qcsrc/common/nades.qh +++ b/qcsrc/common/nades.qh @@ -112,8 +112,13 @@ entity Nade_FromProjectile(float proj) return NADE_TYPE_Null; } -string Nade_TrailEffect(float proj, float nade_team) +string Nade_TrailEffect(int proj, float nade_team) { + switch (proj) + { + case PROJECTILE_NADE: return EFFECT_NADE_TRAIL(nade_team).eent_eff_name; + case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team).eent_eff_name; + } FOREACH(NADES, true, LAMBDA( for (int j = 0; j < 2; j++) { @@ -125,12 +130,7 @@ string Nade_TrailEffect(float proj, float nade_team) } } )); - switch (proj) - { - case PROJECTILE_NADE: return EFFECT_NADE_TRAIL(nade_team).eent_eff_name; - case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team).eent_eff_name; - } - return ""; + return string_null; } #ifdef SVQC -- 2.39.2