summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-03 11:31:39 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-03 11:37:00 +0200
commit91242cdfe50922e7258a04743bd940956c0453da (patch)
tree85e66499c7a12920ec2309142e839abd74bee53b
parent1bc515864c9f317562b3edb0267a3cc4db5737ad (diff)
downloadmana-91242cdfe50922e7258a04743bd940956c0453da.tar.gz
mana-91242cdfe50922e7258a04743bd940956c0453da.tar.bz2
mana-91242cdfe50922e7258a04743bd940956c0453da.tar.xz
mana-91242cdfe50922e7258a04743bd940956c0453da.zip
Moved mIsGM from Being to Player and made isGM() const
-rw-r--r--src/being.cpp1
-rw-r--r--src/being.h6
-rw-r--r--src/gui/minimap.cpp4
-rw-r--r--src/net/ea/beinghandler.cpp4
-rw-r--r--src/player.cpp8
-rw-r--r--src/player.h15
6 files changed, 20 insertions, 18 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d4242df0..d719635b 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -87,7 +87,6 @@ Being::Being(int id, int job, Map *map):
mSpriteDirection(DIRECTION_DOWN),
#endif
mMap(NULL),
- mIsGM(false),
mParticleEffects(config.getValue("particleeffects", 1)),
mEquippedWeapon(NULL),
#ifdef TMWSERV_SUPPORT
diff --git a/src/being.h b/src/being.h
index daedcf33..a870ff0b 100644
--- a/src/being.h
+++ b/src/being.h
@@ -287,11 +287,6 @@ class Being : public Sprite
#endif
/**
- * Triggers whether or not to show the name as a GM name.
- */
- virtual void setGM() { mIsGM = true; }
-
- /**
* Performs being logic.
*/
virtual void logic();
@@ -568,7 +563,6 @@ class Being : public Sprite
Map *mMap; /**< Map on which this being resides */
std::string mName; /**< Name of character */
SpriteIterator mSpriteIterator;
- bool mIsGM;
bool mParticleEffects; /**< Whether to display particles or not */
/** Engine-related infos about weapon. */
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index b4a70d18..bae599a8 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -170,7 +170,7 @@ void Minimap::draw(gcn::Graphics *graphics)
for (Beings::const_iterator bi = beings.begin(), bi_end = beings.end();
bi != bi_end; ++bi)
{
- Being *being = (*bi);
+ const Being *being = (*bi);
int dotSize = 2;
switch (being->getType())
@@ -185,7 +185,7 @@ void Minimap::draw(gcn::Graphics *graphics)
dotSize = 3;
}
- if (static_cast<Player*>(being)->isGM())
+ if (static_cast<const Player*>(being)->isGM())
type = Palette::GM_NAME;
graphics->setColor(guiPalette->getColor(type));
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 1f5f79c7..29ed733a 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -503,8 +503,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
}
gmstatus = msg.readInt16();
- if (gmstatus & 0x80)
- dstBeing->setGM();
+ if ((gmstatus & 0x80) && dstBeing->getType() == Being::PLAYER)
+ static_cast<Player*>(dstBeing)->setGM();
if (msg.getId() == SMSG_PLAYER_UPDATE_1)
{
diff --git a/src/player.cpp b/src/player.cpp
index e1dc3806..d082719a 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -38,9 +38,11 @@
#include "utils/strprintf.h"
Player::Player(int id, int job, Map *map):
- Being(id, job, map)
+ Being(id, job, map),
+ mName(0),
+ mIsGM(false),
+ mInParty(false)
{
- mName = NULL;
}
Player::~Player()
@@ -50,7 +52,7 @@ Player::~Player()
void Player::setName(const std::string &name)
{
- if (mName == NULL)
+ if (!mName)
{
if (mIsGM)
{
diff --git a/src/player.h b/src/player.h
index 53b70b1d..dfcca310 100644
--- a/src/player.h
+++ b/src/player.h
@@ -62,7 +62,12 @@ class Player : public Being
/**
* Whether or not this player is a GM.
*/
- bool isGM() { return mIsGM; }
+ bool isGM() const { return mIsGM; }
+
+ /**
+ * Triggers whether or not to show the name as a GM name.
+ */
+ virtual void setGM() { mIsGM = true; }
/**
* Sets the hair style and color for this player.
@@ -90,7 +95,7 @@ class Player : public Being
/**
* Adds a guild to the player.
*/
- Guild* addGuild(short guildId, short rights);
+ Guild *addGuild(short guildId, short rights);
/**
* Removers a guild from the player.
@@ -100,12 +105,12 @@ class Player : public Being
/**
* Returns a pointer to the specified guild.
*/
- Guild* getGuild(const std::string &guildName);
+ Guild *getGuild(const std::string &guildName);
/**
* Returns a pointer to the guild with matching id.
*/
- Guild* getGuild(int id);
+ Guild *getGuild(int id);
/**
* Get number of guilds the player belongs to.
@@ -146,6 +151,8 @@ class Player : public Being
FlashText *mName;
+ bool mIsGM;
+
private:
bool mInParty;
};