summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-04-01 22:13:39 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-04-02 20:24:42 +0200
commit9015268746ed9052a9dc83839b2834b5feeab166 (patch)
tree6516c0acb2833e27bd3911672a68d0117b818739
parent4c7ff677593ea5a56326ec5a43814291f36bd452 (diff)
downloadmana-client-0.6.1.tar.gz
mana-client-0.6.1.tar.bz2
mana-client-0.6.1.tar.xz
mana-client-0.6.1.zip
Fixed problems with using the last emotev0.6.1
The tmwa/BeingHandler was adjusting the effect id rather than the emote id, causing it to not find the last emote (and the rest of the emotes only worked correctly because the effect ids were consecutive in the same order as the emote ids). Furthermore, the EmoteShortcutContainer refused to draw the icon for the last emote due to an off-by-one error in dealing with the 1-adjusted emote ids used by the EmoteShortcut class. Also cleaned up some old remains of a player ignore strategy that used to use the two balloon emotes (this had been their original purpose). Reviewed-by: Erik Schilling
-rw-r--r--NEWS1
-rw-r--r--data/help/changes.txt1
-rw-r--r--src/being.h2
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp5
-rw-r--r--src/net/tmwa/beinghandler.cpp5
-rw-r--r--src/playerrelations.cpp3
-rw-r--r--src/resources/emotedb.cpp6
-rw-r--r--src/resources/emotedb.h4
8 files changed, 12 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 4f7971c4..c655caea 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
- Made it easier to click beings that are next to other beings
- Removed NPC trade messages from chat (again)
- Fixed swapping of ring and necklace equipment slots
+- Fixed problems with using the last emote
- Fixed drawing order of particles
- Fixed manaserv-enabled builds
- Fixed category of mana.desktop file
diff --git a/data/help/changes.txt b/data/help/changes.txt
index a4a148cd..a080b2d7 100644
--- a/data/help/changes.txt
+++ b/data/help/changes.txt
@@ -7,6 +7,7 @@
- Made it easier to click beings that are next to other beings
- Removed NPC trade messages from chat (again)
- Fixed swapping of ring and necklace equipment slots
+ - Fixed problems with using the last emote
- Fixed drawing order of particles
- Fixed manaserv-enabled builds
- Fixed category of mana.desktop file
diff --git a/src/being.h b/src/being.h
index 84c159b7..0287dc6e 100644
--- a/src/being.h
+++ b/src/being.h
@@ -31,11 +31,9 @@
#include <guichan/color.hpp>
#include <map>
-#include <set>
#include <string>
#include <vector>
-#define FIRST_IGNORE_EMOTE 14
#define STATUS_EFFECTS 32
#define SPEECH_TIME 500
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 1230e47a..3105a762 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -60,7 +60,7 @@ EmoteShortcutContainer::EmoteShortcutContainer():
mEmoteImg.push_back(EmoteDB::get(i)->sprite);
}
- mMaxItems = EmoteDB::getLast() < MAX_ITEMS ? EmoteDB::getLast() : MAX_ITEMS;
+ mMaxItems = std::min(EmoteDB::getLast(), MAX_ITEMS);
mBoxHeight = mBackgroundImg->getHeight();
mBoxWidth = mBackgroundImg->getWidth();
@@ -97,11 +97,10 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
g->drawText(key, emoteX + 2, emoteY + 2, gcn::Graphics::LEFT);
int emoteId = emoteShortcut->getEmote(i);
- if (emoteId > 0 && emoteId <= EmoteDB::getLast())
+ if (emoteId > 0 && emoteId <= EmoteDB::getLast() + 1)
{
mEmoteImg[emoteId - 1]->draw(g, emoteX + 2, emoteY + 10);
}
-
}
if (mEmoteMoved)
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index c94e08df..b7d84685 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -427,9 +427,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
if (player_relations.hasPermission(dstBeing, PlayerRelation::EMOTE))
{
- const int fx = EmoteDB::get(msg.readInt8())->effect;
- //TODO: figure out why the -1 is needed
- effectManager->trigger(fx - 1, dstBeing);
+ const int fx = EmoteDB::get(msg.readInt8() - 1)->effect;
+ effectManager->trigger(fx, dstBeing);
}
break;
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 89cd7250..47bc1913 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -31,8 +31,7 @@
#include "utils/gettext.h"
#define PLAYER_IGNORE_STRATEGY_NOP "nop"
-#define PLAYER_IGNORE_STRATEGY_EMOTE0 "emote0"
-#define DEFAULT_IGNORE_STRATEGY PLAYER_IGNORE_STRATEGY_EMOTE0
+#define DEFAULT_IGNORE_STRATEGY PLAYER_IGNORE_STRATEGY_NOP
#define NAME "name" // constant for xml serialisation
#define RELATION "relation" // constant for xml serialisation
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index 6a001078..00721ac4 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -45,7 +45,7 @@ void EmoteDB::load()
unload();
mUnknown.name = "unknown";
- mUnknown.effect = 0;
+ mUnknown.effect = -1;
mUnknown.sprite = new ImageSprite(
ResourceManager::getInstance()->getImage("graphics/sprites/error.png"));
@@ -91,7 +91,7 @@ void EmoteDB::load()
const int width = XML::getProperty(emoteNode, "width", 0);
const int height = XML::getProperty(emoteNode, "height", 0);
- if (imageName.empty() || !(width > 0) || !(height > 0))
+ if (imageName.empty() || width <= 0 || height <= 0)
{
logger->log("Emote Database: Warning: Emote with bad imageset values");
delete currentEmote;
@@ -150,7 +150,7 @@ const Emote *EmoteDB::get(int id)
}
}
-const int &EmoteDB::getLast()
+int EmoteDB::getLast()
{
return mLastEmote;
}
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h
index 1324fb7e..a1e991ec 100644
--- a/src/resources/emotedb.h
+++ b/src/resources/emotedb.h
@@ -48,9 +48,9 @@ namespace EmoteDB
const Emote *get(int id);
- const int &getLast();
+ int getLast();
typedef Emotes::iterator EmotesIterator;
}
-#endif
+#endif // EMOTE_DB_H