From a93722a53e2d50466dfd5512c4a6a1c3dfc60fb1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 28 Jan 2012 21:00:12 +0300 Subject: Add support for processing player statuses in evol server. --- src/being.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index 39d0bd450..9edfaad7b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2517,26 +2517,31 @@ void Being::saveComment(const std::string &name, resman->saveTextFile(dir, "comment.txt", name + "\n" + comment); } +void Being::setState(Uint8 state) +{ + mAdvanced = true; + bool shop = (state & FLAG_SHOP); + bool away = (state & FLAG_AWAY); + bool inactive = (state & FLAG_INACTIVE); + bool needUpdate = (shop != mShop || away != mAway + || inactive != mInactive); + + mShop = shop; + mAway = away; + mInactive = inactive; + + if (needUpdate) + { + updateName(); + addToCache(); + } +} + void Being::setEmote(Uint8 emotion, int emote_time) { if ((emotion & FLAG_SPECIAL) == FLAG_SPECIAL) { - mAdvanced = true; - bool shop = (emotion & FLAG_SHOP); - bool away = (emotion & FLAG_AWAY); - bool inactive = (emotion & FLAG_INACTIVE); - bool needUpdate = (shop != mShop || away != mAway - || inactive != mInactive); - - mShop = shop; - mAway = away; - mInactive = inactive; - - if (needUpdate) - { - updateName(); - addToCache(); - } + setState(emotion); } else { -- cgit v1.2.3-70-g09d2