From: Freddy Date: Sat, 10 Mar 2018 15:26:39 +0000 (+0100) Subject: Remove magic numbers in misc_follow X-Git-Tag: xonotic-v0.8.5~2176^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=de6b906afcc3f59b3bf4e58d87c097ac90f89ab1;p=xonotic%2Fxonotic-data.pk3dir.git Remove magic numbers in misc_follow --- 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);