]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
func_door: merge door_use() and door_fire()
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 13 Oct 2022 11:46:33 +0000 (21:46 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 15 Sep 2023 07:11:44 +0000 (17:11 +1000)
Unnecessary tiny func is tiny and unnecessary (and suboptimal for perf).

qcsrc/common/mapobjects/func/door.qc

index c45298dfa84e8da3227767628cba0fadc02600a1..418bdda9aeb53558280e8e2b81bbc8f4442b3209 100644 (file)
@@ -213,10 +213,13 @@ bool door_check_keys(entity door, entity player)
        return false;
 }
 
-void door_fire(entity this, entity actor, entity trigger)
+void door_use(entity this, entity actor, entity trigger)
 {
-       if (this.owner != this)
-               objerror (this, "door_fire: this.owner != this");
+       //dprint("door_use (model: ");dprint(this.model);dprint(")\n");
+
+       if (!this.owner)
+               return;
+       this = this.owner;
 
        if (this.spawnflags & DOOR_TOGGLE)
        {
@@ -257,14 +260,6 @@ void door_fire(entity this, entity actor, entity trigger)
        } while ((e != this) && (e != NULL));
 }
 
-void door_use(entity this, entity actor, entity trigger)
-{
-       //dprint("door_use (model: ");dprint(this.model);dprint(")\n");
-
-       if (this.owner)
-               door_fire(this.owner, actor, trigger);
-}
-
 void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
        if(this.spawnflags & NOSPLASH)