diff options
-rw-r--r-- | src/game-server/actor.h | 3 | ||||
-rw-r--r-- | src/game-server/trigger.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/game-server/actor.h b/src/game-server/actor.h index 529d48c4..abc1e1d0 100644 --- a/src/game-server/actor.h +++ b/src/game-server/actor.h @@ -111,6 +111,9 @@ class Actor : public Thing void setPublicID(int id) { mPublicID = id; } + bool isPublicIdValid() const + { return (mPublicID > 0 && mPublicID != 65535); } + /** * Gets the way the actor blocks pathfinding for other actors. */ diff --git a/src/game-server/trigger.cpp b/src/game-server/trigger.cpp index 19ca3512..c4cec2f4 100644 --- a/src/game-server/trigger.cpp +++ b/src/game-server/trigger.cpp @@ -52,8 +52,9 @@ void TriggerArea::update() std::set<Actor*> insideNow; for (BeingIterator i(getMap()->getInsideRectangleIterator(mZone)); i; ++i) { - //skip garbage - if (!(*i) || (*i)->getPublicID() == 0) continue; + // Don't deal with unitialized actors. + if (!(*i) || !(*i)->isPublicIdValid()) + continue; // The BeingIterator returns the mapZones in touch with the rectangle // area. On the other hand, the beings contained in the map zones |