From de6b906afcc3f59b3bf4e58d87c097ac90f89ab1 Mon Sep 17 00:00:00 2001 From: Freddy Date: Sat, 10 Mar 2018 16:26:39 +0100 Subject: [PATCH] Remove magic numbers in misc_follow --- qcsrc/common/triggers/misc/follow.qc | 6 +++--- qcsrc/common/triggers/misc/follow.qh | 1 + qcsrc/common/triggers/spawnflags.qh | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/triggers/misc/follow.qc b/qcsrc/common/triggers/misc/follow.qc index 63db2c18f..87619ca71 100644 --- a/qcsrc/common/triggers/misc/follow.qc +++ b/qcsrc/common/triggers/misc/follow.qc @@ -29,10 +29,10 @@ void follow_init(entity this) objerror(this, "follow: could not find target/killtarget"); return; } - else if(this.spawnflags & 1) + else if(this.spawnflags & FOLLOW_ATTACH) { // attach - if(this.spawnflags & 2) + if(this.spawnflags & FOLLOW_LOCAL) { setattachment(dst, src, this.message); } @@ -46,7 +46,7 @@ void follow_init(entity this) } else { - if(this.spawnflags & 2) + if(this.spawnflags & FOLLOW_LOCAL) { set_movetype(dst, MOVETYPE_FOLLOW); dst.aiment = src; diff --git a/qcsrc/common/triggers/misc/follow.qh b/qcsrc/common/triggers/misc/follow.qh index 6f70f09be..7c39519e1 100644 --- a/qcsrc/common/triggers/misc/follow.qh +++ b/qcsrc/common/triggers/misc/follow.qh @@ -1 +1,2 @@ #pragma once +#include "../spawnflags.qh" diff --git a/qcsrc/common/triggers/spawnflags.qh b/qcsrc/common/triggers/spawnflags.qh index 7eac49917..8c32ef9c9 100644 --- a/qcsrc/common/triggers/spawnflags.qh +++ b/qcsrc/common/triggers/spawnflags.qh @@ -67,6 +67,10 @@ const int PROJECT_ON_TARGET2NORMAL = BIT(1); const int PROJECT_ON_TARGET3NORMAL = BIT(2); const int PROJECT_ON_TARGET4NORMAL = BIT(3); +// follow +const int FOLLOW_ATTACH = BIT(0); +const int FOLLOW_LOCAL = BIT(1); + // platforms const int PLAT_LOW_TRIGGER = BIT(0); const int PLAT_CRUSH = BIT(2); -- 2.39.2