Remove an obscure macro from trigger code that was hiding a simple targetname check
authorMario <mario.mario@y7mail.com>
Sat, 30 May 2020 11:46:40 +0000 (21:46 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 30 May 2020 11:46:40 +0000 (21:46 +1000)
12 files changed:
qcsrc/common/mapobjects/func/conveyor.qc
qcsrc/common/mapobjects/func/door.qc
qcsrc/common/mapobjects/func/door_secret.qc
qcsrc/common/mapobjects/func/pointparticles.qc
qcsrc/common/mapobjects/misc/laser.qc
qcsrc/common/mapobjects/misc/teleport_dest.qc
qcsrc/common/mapobjects/platforms.qc
qcsrc/common/mapobjects/target/speaker.qc
qcsrc/common/mapobjects/trigger/gravity.qc
qcsrc/common/mapobjects/trigger/multivibrator.qc
qcsrc/common/mapobjects/triggers.qc
qcsrc/common/mapobjects/triggers.qh

index 4c40598..3666dd3 100644 (file)
@@ -98,7 +98,7 @@ void conveyor_init(entity this)
        setthink(this, conveyor_think);
        this.nextthink = time;
        this.setactive = generic_netlinked_setactive;
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
        {
                // backwards compatibility
                this.use = generic_netlinked_legacy_use;
index e9fd04b..57faf51 100644 (file)
@@ -443,7 +443,7 @@ void LinkDoors(entity this)
 
                if (GetResource(this, RES_HEALTH))
                        return;
-               IFTARGETED
+               if(this.targetname && this.targetname != "")
                        return;
                if (this.items)
                        return;
@@ -511,7 +511,7 @@ void LinkDoors(entity this)
 
        if (GetResource(this, RES_HEALTH))
                return;
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
                return;
        if (this.items)
                return;
index c008e50..50593a4 100644 (file)
@@ -244,10 +244,7 @@ spawnfunc(func_door_secret)
        setblocked(this, secret_blocked);
        this.speed = 50;
        this.use = fd_secret_use;
-       IFTARGETED
-       {
-       }
-       else
+       if(!this.targetname || this.targetname == "")
                this.spawnflags |= DOOR_SECRET_YES_SHOOT;
 
        if (this.spawnflags & DOOR_SECRET_YES_SHOOT)
index 7de5a03..72ad355 100644 (file)
@@ -115,7 +115,7 @@ spawnfunc(func_pointparticles)
 
        Net_LinkEntity(this, (this.spawnflags & PARTICLES_VISCULLING), 0, pointparticles_SendEntity);
 
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
        {
                // backwards compatibility
                this.use = generic_netlinked_legacy_use;
index df88b75..403a468 100644 (file)
@@ -280,7 +280,7 @@ spawnfunc(misc_laser)
 
        this.setactive = laser_setactive;
 
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
        {
                // backwards compatibility
                this.use = laser_use;
index e7eedd5..7402726 100644 (file)
@@ -39,10 +39,7 @@ spawnfunc(info_teleport_destination)
        //setorigin(this, this.origin + '0 0 27');      // To fix a mappers' habit as old as Quake
        setorigin(this, this.origin);
 
-       IFTARGETED
-       {
-       }
-       else
+       if(!this.targetname || this.targetname == "")
        {
                objerror (this, "^3Teleport destination without a targetname");
                return; // don't link it to CSQC in this case!
index 832b25b..aae2089 100644 (file)
@@ -179,7 +179,7 @@ void plat_use(entity this, entity actor, entity trigger)
 
 void plat_reset(entity this)
 {
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
        {
                setorigin(this, this.pos1);
                this.state = STATE_UP;
index 11c9ad7..354f4ca 100644 (file)
@@ -91,7 +91,7 @@ spawnfunc(target_speaker)
 
        if(!this.atten)
        {
-               IFTARGETED
+               if(this.targetname && this.targetname != "")
                        this.atten = ATTEN_NORM;
                else
                        this.atten = ATTEN_STATIC;
@@ -102,7 +102,7 @@ spawnfunc(target_speaker)
        if(!this.volume)
                this.volume = 1;
 
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
        {
                if(this.spawnflags & SPEAKER_ACTIVATOR)
                        this.use = target_speaker_use_activator;
index 1ac0f87..4b9fb22 100644 (file)
@@ -100,7 +100,7 @@ spawnfunc(trigger_gravity)
 
        this.active = ACTIVE_ACTIVE;
        this.setactive = generic_setactive;
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
        {
                // legacy use
                this.use = trigger_gravity_use;
index 932fda1..34876ae 100644 (file)
@@ -72,7 +72,7 @@ spawnfunc(trigger_multivibrator)
        setthink(this, multivibrator_send_think);
        this.nextthink = max(1, time);
 
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
                multivibrator_reset(this);
 }
 #endif
index 27ffead..29b00d5 100644 (file)
@@ -43,7 +43,7 @@ void generic_netlinked_setactive(entity this, int act)
 
 void generic_netlinked_reset(entity this)
 {
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
        {
                if(this.spawnflags & START_ENABLED)
                {
index 797c976..73113b4 100644 (file)
@@ -8,8 +8,6 @@
 
 .float height;
 
-#define IFTARGETED if(this.targetname && this.targetname != "")
-
 .float lip;
 
 // used elsewhere (will fix)