From 115685046a326c62e7d94a96473002145e5d30f8 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Thu, 13 Jun 2024 13:27:49 +0200 Subject: [PATCH] - [NEW] actor::getLast() --- source/actor.cpp | 8 ++++++++ source/actor.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/source/actor.cpp b/source/actor.cpp index 190fddd..3d4ee2b 100644 --- a/source/actor.cpp +++ b/source/actor.cpp @@ -23,6 +23,14 @@ namespace actor return first; } + actor_t *getLast() + { + if (!first) return nullptr; + actor_t *last = first; + while(last->next) last = last->next; + return last; + } + actor_t *getSelected() { return selected; diff --git a/source/actor.h b/source/actor.h index 24bd1b0..89ce291 100644 --- a/source/actor.h +++ b/source/actor.h @@ -20,6 +20,7 @@ #define FLAG_NOEDITOR 1024 // No es seleccionable a l'editor (son les portes) #define FLAG_SENSIBLE 6 // PUSHABLE or REACTIVE +#define FLAG_IGNORE 1025 // HERO or NOEDITOR // Direcció de espenta #define PUSH_NONE 0 @@ -80,6 +81,9 @@ namespace actor // Torna el primer actor de la llista actor_t *getFirst(); + // Torna l'últim actor de la llista + actor_t *getLast(); + // Torna el actor seleccionat a l'editor actor_t *getSelected();