From 3918acc66e8f6678804be860cb81be37a50e172a Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Wed, 4 Jan 2012 22:09:13 +0200 Subject: [PATCH] Improve the tag counting macro --- qcsrc/client/damage.qc | 4 ++-- qcsrc/common/util.qh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 9130f972a..ffa11e0b6 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -304,8 +304,8 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum, float ent FOR_EACH_TAG(self) { // go through all tags on the player model, choose the one closest to the damage origin - if(!closest || vlen(hitorg - gettaginfo(self, i)) <= vlen(hitorg - gettaginfo(self, closest))) - closest = i; + if(!closest || vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, closest))) + closest = tagnum; } gettaginfo(self, closest); // set gettaginfo_name diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index f4f8970d5..311f402e7 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -281,6 +281,6 @@ entity ReadCSQCEntity() void Shutdown(); #ifndef MENUQC -// loop that goes through all the bones of a model -#define FOR_EACH_TAG(v) for(i = 1, gettaginfo(v, i);; i++, gettaginfo(v, i)) if not(gettaginfo_name) break; else +// loops through the tags of model v using counter tagnum +#define FOR_EACH_TAG(v) float tagnum; for(tagnum = 1, gettaginfo(v, tagnum);; tagnum++, gettaginfo(v, tagnum)) if not(gettaginfo_name) break; else #endif -- 2.39.2