summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-09 00:11:54 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-09 17:54:12 +0200
commit1e1f619b9ae5aa26058c499c988f45d1fb1b6d53 (patch)
tree1fe58c53388054ced122b5327e33fc2851a0606a
parent30d4b0adf4f17f05d1d62fc3428c896ef1079b6b (diff)
downloadmana-1e1f619b9ae5aa26058c499c988f45d1fb1b6d53.tar.gz
mana-1e1f619b9ae5aa26058c499c988f45d1fb1b6d53.tar.bz2
mana-1e1f619b9ae5aa26058c499c988f45d1fb1b6d53.tar.xz
mana-1e1f619b9ae5aa26058c499c988f45d1fb1b6d53.zip
Moved Channels to Mana::Event::Channel
Acked-by: Jared Adams
-rw-r--r--src/actorsprite.cpp6
-rw-r--r--src/being.cpp10
-rw-r--r--src/being.h2
-rw-r--r--src/client.cpp12
-rw-r--r--src/client.h2
-rw-r--r--src/configuration.cpp2
-rw-r--r--src/event.cpp8
-rw-r--r--src/event.h47
-rw-r--r--src/game.cpp22
-rw-r--r--src/gui/chat.cpp10
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/gui.cpp6
-rw-r--r--src/gui/inventorywindow.cpp10
-rw-r--r--src/gui/inventorywindow.h2
-rw-r--r--src/gui/itemamount.cpp4
-rw-r--r--src/gui/ministatus.cpp9
-rw-r--r--src/gui/ministatus.h2
-rw-r--r--src/gui/npcdialog.cpp14
-rw-r--r--src/gui/npcdialog.h2
-rw-r--r--src/gui/skilldialog.cpp4
-rw-r--r--src/gui/skilldialog.h2
-rw-r--r--src/gui/statuswindow.cpp5
-rw-r--r--src/gui/statuswindow.h2
-rw-r--r--src/gui/viewport.cpp10
-rw-r--r--src/gui/viewport.h2
-rw-r--r--src/gui/widgets/itemcontainer.cpp6
-rw-r--r--src/item.cpp4
-rw-r--r--src/listener.cpp4
-rw-r--r--src/listener.h6
-rw-r--r--src/localplayer.cpp14
-rw-r--r--src/localplayer.h2
-rw-r--r--src/net/manaserv/chathandler.cpp6
-rw-r--r--src/net/manaserv/generalhandler.cpp10
-rw-r--r--src/net/manaserv/generalhandler.h2
-rw-r--r--src/net/manaserv/inventoryhandler.cpp6
-rw-r--r--src/net/manaserv/inventoryhandler.h2
-rw-r--r--src/net/manaserv/npchandler.cpp30
-rw-r--r--src/net/manaserv/playerhandler.cpp2
-rw-r--r--src/net/tmwa/chathandler.cpp12
-rw-r--r--src/net/tmwa/gamehandler.cpp6
-rw-r--r--src/net/tmwa/gamehandler.h2
-rw-r--r--src/net/tmwa/generalhandler.cpp6
-rw-r--r--src/net/tmwa/generalhandler.h2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp6
-rw-r--r--src/net/tmwa/inventoryhandler.h2
-rw-r--r--src/net/tmwa/npchandler.cpp24
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/playerinfo.cpp24
-rw-r--r--src/resources/theme.cpp6
-rw-r--r--src/resources/theme.h2
51 files changed, 194 insertions, 193 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index ea2b61c9..fdf6defd 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -62,7 +62,7 @@ ActorSprite::~ActorSprite()
// Notify listeners of the destruction.
Mana::Event event(Mana::Event::Destroyed);
event.setActor("source", this);
- event.trigger(CHANNEL_ACTORSPRITE);
+ event.trigger(Mana::Event::ActorSpriteChannel);
}
bool ActorSprite::draw(Graphics *graphics, int offsetX, int offsetY) const
@@ -259,7 +259,7 @@ void ActorSprite::updateStunMode(int oldMode, int newMode)
Mana::Event event(Mana::Event::Stun);
event.setInt("oldMode", oldMode);
event.setInt("newMode", newMode);
- event.trigger(CHANNEL_ACTORSPRITE);
+ event.trigger(Mana::Event::ActorSpriteChannel);
}
handleStatusEffect(StatusEffect::getStatusEffect(oldMode, false), -1);
@@ -273,7 +273,7 @@ void ActorSprite::updateStatusEffect(int index, bool newStatus)
Mana::Event event(Mana::Event::UpdateStatusEffect);
event.setInt("index", index);
event.setBool("newStatus", newStatus);
- event.trigger(CHANNEL_ACTORSPRITE);
+ event.trigger(Mana::Event::ActorSpriteChannel);
}
handleStatusEffect(StatusEffect::getStatusEffect(index, newStatus), index);
diff --git a/src/being.cpp b/src/being.cpp
index 53bcf7d3..fa9bd4f5 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -109,8 +109,8 @@ Being::Being(int id, Type type, int subtype, Map *map):
setShowName(true);
updateColors();
- listen(CHANNEL_CONFIG);
- listen(CHANNEL_CHAT);
+ listen(Mana::Event::ConfigChannel);
+ listen(Mana::Event::ChatChannel);
}
Being::~Being()
@@ -1226,9 +1226,9 @@ void Being::talkTo()
Net::getNpcHandler()->talk(mId);
}
-void Being::event(Channels channel, const Mana::Event &event)
+void Being::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_CHAT &&
+ if (channel == Mana::Event::ChatChannel &&
(event.getType() == Mana::Event::Being
|| event.getType() == Mana::Event::Player) &&
event.getInt("permissions") & PlayerRelation::SPEECH_FLOAT)
@@ -1243,7 +1243,7 @@ void Being::event(Channels channel, const Mana::Event &event)
catch (Mana::BadEvent badEvent)
{}
}
- else if (channel == CHANNEL_CONFIG &&
+ else if (channel == Mana::Event::ConfigChannel &&
event.getType() == Mana::Event::ConfigOptionChanged)
{
if (getType() == PLAYER && event.getString("option") == "visiblenames")
diff --git a/src/being.h b/src/being.h
index 7f6f8007..e3d42717 100644
--- a/src/being.h
+++ b/src/being.h
@@ -481,7 +481,7 @@ class Being : public ActorSprite, public Mana::Listener
void talkTo();
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
protected:
/**
diff --git a/src/client.cpp b/src/client.cpp
index 0752b70a..4fb76b4b 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -471,12 +471,12 @@ Client::Client(const Options &options):
// Initialize frame limiting
SDL_initFramerate(&mFpsManager);
- listen(CHANNEL_CONFIG);
+ listen(Mana::Event::ConfigChannel);
//TODO: fix having to fake a option changed event
Mana::Event fakeevent(Mana::Event::ConfigOptionChanged);
fakeevent.setString("option", "fpslimit");
- event(CHANNEL_CONFIG, fakeevent);
+ event(Mana::Event::ConfigChannel, fakeevent);
// Initialize PlayerInfo
PlayerInfo::init();
@@ -637,7 +637,7 @@ int Client::exec()
Mana::Event event(Mana::Event::StateChange);
event.setInt("oldState", mOldState);
event.setInt("newState", mState);
- event.trigger(CHANNEL_CLIENT);
+ event.trigger(Mana::Event::ClientChannel);
}
if (mOldState == STATE_GAME)
@@ -797,7 +797,7 @@ int Client::exec()
paths.init("paths.xml", true);
paths.setDefaultValues(getPathsDefaults());
- Mana::Event::trigger(CHANNEL_CLIENT, Mana::Event::LoadingDatabases);
+ Mana::Event::trigger(Mana::Event::ClientChannel, Mana::Event::LoadingDatabases);
// Load XML databases
ColorDB::load();
@@ -1072,9 +1072,9 @@ int Client::exec()
return 0;
}
-void Client::event(Channels channel, const Mana::Event &event)
+void Client::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_CONFIG &&
+ if (channel == Mana::Event::ConfigChannel &&
event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "fpslimit")
{
diff --git a/src/client.h b/src/client.h
index 8d2c23d5..ab89dcc2 100644
--- a/src/client.h
+++ b/src/client.h
@@ -185,7 +185,7 @@ public:
static const std::string &getScreenshotDirectory()
{ return instance()->mScreenshotDir; }
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
void action(const gcn::ActionEvent &event);
private:
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 33c0cb5a..59d8a024 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -40,7 +40,7 @@ void Configuration::setValue(const std::string &key, const std::string &value)
// Notify listeners
Mana::Event event(Mana::Event::ConfigOptionChanged);
event.setString("option", key);
- event.trigger(CHANNEL_CONFIG);
+ event.trigger(Mana::Event::ConfigChannel);
}
std::string ConfigurationObject::getValue(const std::string &key,
diff --git a/src/event.cpp b/src/event.cpp
index c8de2ffd..d1d12242 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -26,7 +26,7 @@
namespace Mana
{
-ListenMap Event::mBindings;
+Event::ListenMap Event::mBindings;
Event::~Event()
{
@@ -215,7 +215,7 @@ bool Event::hasActor(const std::string &key) const
// Triggers
-void Event::trigger(Channels channel, const Event &event)
+void Event::trigger(Channel channel, const Event &event)
{
ListenMap::iterator it = mBindings.find(channel);
@@ -232,12 +232,12 @@ void Event::trigger(Channels channel, const Event &event)
}
}
-void Event::bind(Listener *listener, Channels channel)
+void Event::bind(Listener *listener, Channel channel)
{
mBindings[channel].insert(listener);
}
-void Event::unbind(Listener *listener, Channels channel)
+void Event::unbind(Listener *listener, Channel channel)
{
mBindings[channel].erase(listener);
}
diff --git a/src/event.h b/src/event.h
index 22b76c6f..74a4e1f5 100644
--- a/src/event.h
+++ b/src/event.h
@@ -28,22 +28,6 @@
class ActorSprite;
class Item;
-enum Channels
-{
- CHANNEL_ACTORSPRITE,
- CHANNEL_ATTRIBUTES,
- CHANNEL_BUYSELL,
- CHANNEL_CHAT,
- CHANNEL_CLIENT,
- CHANNEL_CONFIG,
- CHANNEL_GAME,
- CHANNEL_ITEM,
- CHANNEL_NOTICES,
- CHANNEL_NPC,
- CHANNEL_STATUS,
- CHANNEL_STORAGE
-};
-
namespace Mana
{
@@ -57,14 +41,28 @@ enum BadEvent {
class Listener;
typedef std::set<Listener *> ListenerSet;
-typedef std::map<Channels, ListenerSet > ListenMap;
-
class VariableData;
typedef std::map<std::string, VariableData *> VariableMap;
class Event
{
public:
+ enum Channel
+ {
+ ActorSpriteChannel,
+ AttributesChannel,
+ BuySellChannel,
+ ChatChannel,
+ ClientChannel,
+ ConfigChannel,
+ GameChannel,
+ ItemChannel,
+ NoticesChannel,
+ NpcChannel,
+ StatusChannel,
+ StorageChannel
+ };
+
enum Type
{
Announcement,
@@ -286,19 +284,19 @@ public:
/**
* Sends this event to all classes listening to the given channel.
*/
- inline void trigger(Channels channel) const
+ inline void trigger(Channel channel) const
{ trigger(channel, *this); }
/**
* Sends the given event to all classes listening to the given channel.
*/
- static void trigger(Channels channel, const Event &event);
+ static void trigger(Channel channel, const Event &event);
/**
* Sends an empty event with the given name to all classes listening to the
* given channel.
*/
- static inline void trigger(Channels channel, Type type)
+ static inline void trigger(Channel channel, Type type)
{ trigger(channel, Mana::Event(type)); }
protected:
@@ -308,13 +306,13 @@ protected:
* Binds the given listener to the given channel. The listener will receive
* all events triggered on the channel.
*/
- static void bind(Listener *listener, Channels channel);
+ static void bind(Listener *listener, Channel channel);
/**
* Unbinds the given listener from the given channel. The listener will no
* longer receive any events from the channel.
*/
- static void unbind(Listener *listener, Channels channel);
+ static void unbind(Listener *listener, Channel channel);
/**
* Unbinds the given listener from all channels.
@@ -322,6 +320,7 @@ protected:
static void remove(Listener *listener);
private:
+ typedef std::map<Channel, ListenerSet > ListenMap;
static ListenMap mBindings;
Type mType;
@@ -333,6 +332,6 @@ private:
#define SERVER_NOTICE(message) { \
Mana::Event event(Mana::Event::ServerNotice); \
event.setString("message", message); \
-event.trigger(CHANNEL_NOTICES, event); }
+event.trigger(Mana::Event::NoticesChannel, event); }
#endif // EVENT_H
diff --git a/src/game.cpp b/src/game.cpp
index 787eadc9..5cc01f64 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -128,7 +128,7 @@ ChatTab *localChatTab = NULL;
*/
static void initEngines()
{
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::EnginesInitializing);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::EnginesInitializing);
actorSpriteManager = new ActorSpriteManager;
commandHandler = new CommandHandler;
@@ -138,7 +138,7 @@ static void initEngines()
particleEngine = new Particle(NULL);
particleEngine->setupEngine();
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::EnginesInitialized);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::EnginesInitialized);
}
/**
@@ -146,7 +146,7 @@ static void initEngines()
*/
static void createGuiWindows()
{
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsLoading);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsLoading);
setupWindow->clearWindowsForReset();
@@ -183,7 +183,7 @@ static void createGuiWindows()
NpcDialog::setup();
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsLoaded);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsLoaded);
}
#define del_0(X) { delete X; X = 0; }
@@ -193,7 +193,7 @@ static void createGuiWindows()
*/
static void destroyGuiWindows()
{
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsUnloading);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsUnloading);
del_0(localChatTab) // Need to do this first, so it can remove itself
del_0(chatWindow)
@@ -212,9 +212,9 @@ static void destroyGuiWindows()
del_0(specialsWindow)
del_0(socialWindow)
- Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll); // Cleanup remaining NPC dialogs
+ Mana::Event::trigger(Mana::Event::NpcChannel, Mana::Event::CloseAll); // Cleanup remaining NPC dialogs
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsUnloaded);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsUnloaded);
}
Game *Game::mInstance = 0;
@@ -266,12 +266,12 @@ Game::Game():
setupWindow->setInGame(true);
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::Constructed);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::Constructed);
}
Game::~Game()
{
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::Destructing);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::Destructing);
delete mWindowMenu;
@@ -289,7 +289,7 @@ Game::~Game()
mInstance = 0;
- Mana::Event::trigger(CHANNEL_GAME, Mana::Event::Destructed);
+ Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::Destructed);
}
static bool saveScreenshot()
@@ -992,5 +992,5 @@ void Game::changeMap(const std::string &mapPath)
Mana::Event event(Mana::Event::MapLoaded);
event.setString("mapPath", mapPath);
- event.trigger(CHANNEL_GAME);
+ event.trigger(Mana::Event::GameChannel);
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index fecf892a..17eb8af3 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -90,8 +90,8 @@ ChatWindow::ChatWindow():
mAutoComplete(new ChatAutoComplete),
mTmpVisible(false)
{
- listen(CHANNEL_CHAT);
- listen(CHANNEL_NOTICES);
+ listen(Mana::Event::ChatChannel);
+ listen(Mana::Event::NoticesChannel);
setWindowName("Chat");
@@ -375,14 +375,14 @@ void ChatWindow::mouseDragged(gcn::MouseEvent &event)
}
}
-void ChatWindow::event(Channels channel, const Mana::Event &event)
+void ChatWindow::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_NOTICES)
+ if (channel == Mana::Event::NoticesChannel)
{
if (event.getType() == Mana::Event::ServerNotice)
localChatTab->chatLog(event.getString("message"), BY_SERVER);
}
- else if (channel == CHANNEL_CHAT)
+ else if (channel == Mana::Event::ChatChannel)
{
if (event.getType() == Mana::Event::Whisper)
{
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 211e7da7..4ec2a179 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -158,7 +158,7 @@ class ChatWindow : public Window,
void mousePressed(gcn::MouseEvent &event);
void mouseDragged(gcn::MouseEvent &event);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
/**
* Scrolls the chat window
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 02fc2a96..09ad6207 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -113,7 +113,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "unequip" && mSelected > -1)
{
Item *item = mEquipment->getEquipment(mSelected);
- item->doEvent(EVENT_DOUNEQUIP);
+ item->doEvent(Mana::Event::DoUnequip);
setSelected(-1);
}
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 500a2d74..b8ce7989 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -57,9 +57,9 @@ class GuiConfigListener : public Mana::Listener
mGui(g)
{}
- void event(Channels channel, const Mana::Event &event)
+ void event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_CONFIG)
+ if (channel == Mana::Event::ConfigChannel)
{
if (event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "customcursor")
@@ -141,7 +141,7 @@ Gui::Gui(Graphics *graphics):
// Initialize mouse cursor and listen for changes to the option
setUseCustomCursor(config.getBoolValue("customcursor"));
mConfigListener = new GuiConfigListener(this);
- mConfigListener->listen(CHANNEL_CONFIG);
+ mConfigListener->listen(Mana::Event::ConfigChannel);
}
Gui::~Gui()
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 39a9cf6e..7a8d5f09 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -61,7 +61,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
mFilterText(new TextField),
mSplit(false)
{
- listen(CHANNEL_ATTRIBUTES);
+ listen(Mana::Event::AttributesChannel);
setWindowName(isMainInventory() ? "Inventory" : "Storage");
setupWindow->registerWindowForReset(this);
@@ -270,7 +270,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::INVENTORY);
event.setInt("destination", Inventory::STORAGE);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
}
else
{
@@ -279,7 +279,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::STORAGE);
event.setInt("destination", Inventory::INVENTORY);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
}
}
}
@@ -385,12 +385,12 @@ void InventoryWindow::close()
{
Mana::Event event(Mana::Event::DoCloseInventory);
event.setInt("type", mInventory->getType());
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
scheduleDelete();
}
}
-void InventoryWindow::event(Channels channel, const Mana::Event &event)
+void InventoryWindow::event(Mana::Event::Channel channel, const Mana::Event &event)
{
if (event.getType() == Mana::Event::UpdateAttribute)
{
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 2ea59001..c1f6ec57 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -116,7 +116,7 @@ class InventoryWindow : public Window,
bool isMainInventory() { return mInventory->isMainInventory(); }
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
private:
/**
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 7d3931bf..7782466d 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -59,7 +59,7 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
event.setInt("amount", amount);
event.setInt("source", Inventory::INVENTORY);
event.setInt("destination", Inventory::STORAGE);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
}
break;
case StoreRemove:
@@ -69,7 +69,7 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
event.setInt("amount", amount);
event.setInt("source", Inventory::STORAGE);
event.setInt("destination", Inventory::INVENTORY);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
}
break;
default:
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 8093a893..5791b4fb 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -47,7 +47,7 @@ extern volatile int tick_time;
MiniStatusWindow::MiniStatusWindow():
Popup("MiniStatus")
{
- listen(CHANNEL_ATTRIBUTES);
+ listen(Mana::Event::AttributesChannel);
mHpBar = new ProgressBar(0, 100, 20, Theme::PROG_HP);
StatusWindow::updateHPBar(mHpBar);
@@ -119,9 +119,10 @@ void MiniStatusWindow::drawIcons(Graphics *graphics)
}
}
-void MiniStatusWindow::event(Channels channel, const Mana::Event &event)
+void MiniStatusWindow::event(Mana::Event::Channel channel,
+ const Mana::Event &event)
{
- if (channel == CHANNEL_ATTRIBUTES)
+ if (channel == Mana::Event::AttributesChannel)
{
if (event.getType() == Mana::Event::UpdateAttribute)
{
@@ -140,7 +141,7 @@ void MiniStatusWindow::event(Channels channel, const Mana::Event &event)
}
}
}
- else if (channel == CHANNEL_ACTORSPRITE)
+ else if (channel == Mana::Event::ActorSpriteChannel)
{
if (event.getType() == Mana::Event::UpdateStatusEffect)
{
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index 9dfcaeae..88d2d88a 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -45,7 +45,7 @@ class MiniStatusWindow : public Popup, public Mana::Listener
void drawIcons(Graphics *graphics);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
void logic(); // Updates icons
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 799054ba..8322a735 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -55,7 +55,7 @@ typedef std::map<int, NpcDialog*> NpcDialogs;
class NpcEventListener : public Mana::Listener
{
public:
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
NpcDialog *getDialog(int id, bool make = true);
@@ -143,7 +143,7 @@ NpcDialog::NpcDialog(int npcId)
setVisible(true);
requestFocus();
- listen(CHANNEL_CONFIG);
+ listen(Mana::Event::ConfigChannel);
PlayerInfo::setNPCInteractionCount(PlayerInfo::getNPCInteractionCount()
+ 1);
}
@@ -387,9 +387,9 @@ void NpcDialog::setVisible(bool visible)
}
}
-void NpcDialog::event(Channels channel, const Mana::Event &event)
+void NpcDialog::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel != CHANNEL_CONFIG)
+ if (channel != Mana::Event::ConfigChannel)
return;
if (event.getType() == Mana::Event::ConfigOptionChanged &&
@@ -436,7 +436,7 @@ void NpcDialog::setup()
npcListener = new NpcEventListener();
- npcListener->listen(CHANNEL_NPC);
+ npcListener->listen(Mana::Event::NpcChannel);
}
void NpcDialog::buildLayout()
@@ -506,10 +506,10 @@ void NpcDialog::buildLayout()
mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
}
-void NpcEventListener::event(Channels channel,
+void NpcEventListener::event(Mana::Event::Channel channel,
const Mana::Event &event)
{
- if (channel != CHANNEL_NPC)
+ if (channel != Mana::Event::NpcChannel)
return;
if (event.getType() == Mana::Event::Message)
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index d0131d0e..7923cfa3 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -145,7 +145,7 @@ class NpcDialog : public Window, public gcn::ActionListener,
void setVisible(bool visible);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
/**
* Returns the first active instance. Useful for pushing user
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index dfded635..95324e98 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -212,7 +212,7 @@ private:
SkillDialog::SkillDialog():
Window(_("Skills"))
{
- listen(CHANNEL_ATTRIBUTES);
+ listen(Mana::Event::AttributesChannel);
setWindowName("Skills");
setCloseButton(true);
@@ -280,7 +280,7 @@ void SkillDialog::update()
}
}
-void SkillDialog::event(Channels channel, const Mana::Event &event)
+void SkillDialog::event(Mana::Event::Channel channel, const Mana::Event &event)
{
if (event.getType() == Mana::Event::UpdateAttribute)
{
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index 874b4437..b6d1d4ae 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -49,7 +49,7 @@ class SkillDialog : public Window, public gcn::ActionListener, public Mana::List
~SkillDialog();
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
/**
* Called when receiving actions from widget.
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index a37c30ba..b124a883 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -96,7 +96,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener
StatusWindow::StatusWindow():
Window(player_node->getName())
{
- listen(CHANNEL_ATTRIBUTES);
+ listen(Mana::Event::AttributesChannel);
setWindowName("Status");
setupWindow->registerWindowForReset(this);
@@ -217,7 +217,8 @@ StatusWindow::StatusWindow():
mLvlLabel->adjustSize();
}
-void StatusWindow::event(Channels channel, const Mana::Event &event)
+void StatusWindow::event(Mana::Event::Channel channel,
+ const Mana::Event &event)
{
if (event.getType() == Mana::Event::UpdateAttribute)
{
diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h
index 103111a7..6a08fd09 100644
--- a/src/gui/statuswindow.h
+++ b/src/gui/statuswindow.h
@@ -48,7 +48,7 @@ class StatusWindow : public Window, public Mana::Listener
*/
StatusWindow();
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
void updateAttrs();
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index d9693863..3ec88102 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -71,8 +71,8 @@ Viewport::Viewport():
setFocusable(true);
- listen(CHANNEL_CONFIG);
- listen(CHANNEL_ACTORSPRITE);
+ listen(Mana::Event::ConfigChannel);
+ listen(Mana::Event::ActorSpriteChannel);
}
Viewport::~Viewport()
@@ -584,9 +584,9 @@ void Viewport::hideBeingPopup()
mBeingPopup->setVisible(false);
}
-void Viewport::event(Channels channel, const Mana::Event &event)
+void Viewport::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_ACTORSPRITE
+ if (channel == Mana::Event::ActorSpriteChannel
&& event.getType() == Mana::Event::Destroyed)
{
ActorSprite *actor = event.getActor("source");
@@ -597,7 +597,7 @@ void Viewport::event(Channels channel, const Mana::Event &event)
if (mHoverItem == actor)
mHoverItem = 0;
}
- else if (channel == CHANNEL_CONFIG &&
+ else if (channel == Mana::Event::ConfigChannel &&
event.getType() == Mana::Event::ConfigOptionChanged)
{
const std::string option = event.getString("option");
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index f4db806b..eec09478 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -171,7 +171,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
void shakeScreenStop()
{ mShakeEffects.clear(); }
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
private:
/**
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 5b6788fa..59f7934e 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -349,7 +349,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", index);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
}
selectNone();
}
@@ -421,7 +421,7 @@ void ItemContainer::keyAction()
Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
setSelectedIndex(mHighlightedIndex);
}
// If the highlight is on an item then select it.
@@ -437,7 +437,7 @@ void ItemContainer::keyAction()
Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
selectNone();
}
}
diff --git a/src/item.cpp b/src/item.cpp
index 2043038b..3dff9228 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -76,7 +76,7 @@ void Item::doEvent(Mana::Event::Type eventName)
{
Mana::Event event(eventName);
event.setItem("item", this);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
}
void Item::doEvent(Mana::Event::Type eventName, int amount)
@@ -84,7 +84,7 @@ void Item::doEvent(Mana::Event::Type eventName, int amount)
Mana::Event event(eventName);
event.setItem("item", this);
event.setInt("amount", amount);
- event.trigger(CHANNEL_ITEM);
+ event.trigger(Mana::Event::ItemChannel);
}
bool Item::isEquippable() const
diff --git a/src/listener.cpp b/src/listener.cpp
index f9acac95..b156baf7 100644
--- a/src/listener.cpp
+++ b/src/listener.cpp
@@ -30,12 +30,12 @@ Listener::~Listener()
Event::remove(this);
}
-void Listener::listen(Channels channel)
+void Listener::listen(Event::Channel channel)
{
Event::bind(this, channel);
}
-void Listener::ignore(Channels channel)
+void Listener::ignore(Event::Channel channel)
{
Event::unbind(this, channel);
}
diff --git a/src/listener.h b/src/listener.h
index 84b613eb..a61e0883 100644
--- a/src/listener.h
+++ b/src/listener.h
@@ -33,11 +33,11 @@ class Listener
public:
virtual ~Listener();
- void listen(Channels channel);
+ void listen(Event::Channel channel);
- void ignore(Channels channel);
+ void ignore(Event::Channel channel);
- virtual void event(Channels channel, const Event &event) = 0;
+ virtual void event(Event::Channel channel, const Event &event) = 0;
};
} // namespace Mana
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 1e1d5de0..1ed65cd6 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -85,7 +85,7 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mAfkTime(0),
mAwayMode(false)
{
- listen(CHANNEL_ATTRIBUTES);
+ listen(Mana::Event::AttributesChannel);
mAwayListener = new AwayListener();
@@ -93,8 +93,8 @@ LocalPlayer::LocalPlayer(int id, int subtype):
setShowName(config.getValue("showownname", 1));
- listen(CHANNEL_CONFIG);
- listen(CHANNEL_ACTORSPRITE);
+ listen(Mana::Event::ConfigChannel);
+ listen(Mana::Event::ActorSpriteChannel);
}
LocalPlayer::~LocalPlayer()
@@ -1105,9 +1105,9 @@ void LocalPlayer::addMessageToQueue(const std::string &message, int color)
mMessages.push_back(MessagePair(message, color));
}
-void LocalPlayer::event(Channels channel, const Mana::Event &event)
+void LocalPlayer::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_ACTORSPRITE)
+ if (channel == Mana::Event::ActorSpriteChannel)
{
if (event.getType() == Mana::Event::Destroyed)
{
@@ -1120,7 +1120,7 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event)
mTarget = 0;
}
}
- else if (channel == CHANNEL_ATTRIBUTES)
+ else if (channel == Mana::Event::AttributesChannel)
{
if (event.getType() == Mana::Event::UpdateAttribute)
{
@@ -1133,7 +1133,7 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event)
}
}
}
- else if (channel == CHANNEL_CONFIG)
+ else if (channel == Mana::Event::ConfigChannel)
{
if (event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "showownname")
diff --git a/src/localplayer.h b/src/localplayer.h
index b1a41697..0f66c55f 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -212,7 +212,7 @@ class LocalPlayer : public Being
void addMessageToQueue(const std::string &message,
int color = UserPalette::EXP_INFO);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
/**
* Tells the engine wether to check
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 07836c88..021dddf0 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -174,7 +174,7 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg)
event.setInt("permissions", player_relations
.checkPermissionSilently(being->getName(),
PlayerRelation::SPEECH_LOG | PlayerRelation::SPEECH_FLOAT));
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
}
void ChatHandler::handleEnterChannelResponse(Net::MessageIn &msg)
@@ -237,7 +237,7 @@ void ChatHandler::handlePrivateMessage(Net::MessageIn &msg)
Mana::Event event(Mana::Event::Whisper);
event.setString("nick", userNick);
event.setString("message", chatMsg);
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
}
void ChatHandler::handleAnnouncement(Net::MessageIn &msg)
@@ -245,7 +245,7 @@ void ChatHandler::handleAnnouncement(Net::MessageIn &msg)
std::string chatMsg = msg.readString();
Mana::Event event(Mana::Event::Announcement);
event.setString("message", chatMsg);
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
}
void ChatHandler::handleChatMessage(Net::MessageIn &msg)
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index f40b2bc2..e5e7ef95 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -91,8 +91,8 @@ GeneralHandler::GeneralHandler():
generalHandler = this;
- listen(CHANNEL_CLIENT);
- listen(CHANNEL_GAME);
+ listen(Mana::Event::ClientChannel);
+ listen(Mana::Event::GameChannel);
}
void GeneralHandler::load()
@@ -171,10 +171,10 @@ void GeneralHandler::clearHandlers()
clearNetworkHandlers();
}
-void GeneralHandler::event(Channels channel,
+void GeneralHandler::event(Mana::Event::Channel channel,
const Mana::Event &event)
{
- if (channel == CHANNEL_CLIENT)
+ if (channel == Mana::Event::ClientChannel)
{
if (event.getType() == Mana::Event::StateChange)
{
@@ -192,7 +192,7 @@ void GeneralHandler::event(Channels channel,
Attributes::informItemDB();
}
}
- else if (channel == CHANNEL_GAME)
+ else if (channel == Mana::Event::GameChannel)
{
if (event.getType() == Mana::Event::GuiWindowsLoaded)
{
diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h
index c8671ec1..20c4c338 100644
--- a/src/net/manaserv/generalhandler.h
+++ b/src/net/manaserv/generalhandler.h
@@ -46,7 +46,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener
void clearHandlers();
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
protected:
MessageHandlerPtr mBeingHandler;
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index 56280f40..0fd57225 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -52,7 +52,7 @@ InventoryHandler::InventoryHandler()
handledMessages = _messages;
inventoryHandler = this;
- listen(CHANNEL_ITEM);
+ listen(Mana::Event::ItemChannel);
}
void InventoryHandler::handleMessage(Net::MessageIn &msg)
@@ -108,10 +108,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
}
}
-void InventoryHandler::event(Channels channel,
+void InventoryHandler::event(Mana::Event::Channel channel,
const Mana::Event &event)
{
- if (channel == CHANNEL_ITEM)
+ if (channel == Mana::Event::ItemChannel)
{
Item *item = event.getItem("item");
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
index bb68ceeb..5577e431 100644
--- a/src/net/manaserv/inventoryhandler.h
+++ b/src/net/manaserv/inventoryhandler.h
@@ -66,7 +66,7 @@ class InventoryHandler : public MessageHandler, Net::InventoryHandler,
void handleMessage(Net::MessageIn &msg);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
bool canSplit(const Item *item);
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp
index 91e57c72..2642067c 100644
--- a/src/net/manaserv/npchandler.cpp
+++ b/src/net/manaserv/npchandler.cpp
@@ -75,7 +75,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
event->setString("choice" + toString(count), msg.readString());
}
event->setInt("choiceCount", count);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case GPMSG_NPC_NUMBER:
@@ -84,43 +84,43 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
event->setInt("min", msg.readInt32());
event->setInt("max", msg.readInt32());
event->setInt("default", msg.readInt32());
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case GPMSG_NPC_STRING:
event = new Mana::Event(Mana::Event::StringInput);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case GPMSG_NPC_POST:
event = new Mana::Event(Mana::Event::Post);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case GPMSG_NPC_ERROR:
event = new Mana::Event(Mana::Event::End);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case GPMSG_NPC_MESSAGE:
event = new Mana::Event(Mana::Event::Message);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getUnreadLength()));
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
delete event;
event = new Mana::Event(Mana::Event::Next);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case GPMSG_NPC_CLOSE:
event = new Mana::Event(Mana::Event::Close);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
}
@@ -171,7 +171,7 @@ void NpcHandler::talk(int npcId)
Mana::Event event(Mana::Event::TalkSent);
event.setInt("npcId", npcId);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::nextDialog(int npcId)
@@ -182,7 +182,7 @@ void NpcHandler::nextDialog(int npcId)
Mana::Event event(Mana::Event::NextSent);
event.setInt("npcId", npcId);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::closeDialog(int npcId)
@@ -193,7 +193,7 @@ void NpcHandler::closeDialog(int npcId)
Mana::Event event(Mana::Event::CloseSent);
event.setInt("npcId", npcId);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::menuSelect(int npcId, int choice)
@@ -206,7 +206,7 @@ void NpcHandler::menuSelect(int npcId, int choice)
Mana::Event event(Mana::Event::MenuSent);
event.setInt("npcId", npcId);
event.setInt("choice", choice);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::integerInput(int npcId, int value)
@@ -219,7 +219,7 @@ void NpcHandler::integerInput(int npcId, int value)
Mana::Event event(Mana::Event::IntegerInputSent);
event.setInt("npcId", npcId);
event.setInt("value", value);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::stringInput(int npcId, const std::string &value)
@@ -232,7 +232,7 @@ void NpcHandler::stringInput(int npcId, const std::string &value)
Mana::Event event(Mana::Event::StringInputSent);
event.setInt("npcId", npcId);
event.setString("value", value);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::sendLetter(int npcId, const std::string &recipient,
@@ -247,7 +247,7 @@ void NpcHandler::sendLetter(int npcId, const std::string &recipient,
event.setInt("npcId", npcId);
event.setString("recipient", recipient);
event.setString("text", text);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
} // namespace ManaServ
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index d3c8822b..96d01e41 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -65,7 +65,7 @@ void RespawnRequestListener::action(const gcn::ActionEvent &event)
{
Net::getPlayerHandler()->respawn();
- Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll);
+ Mana::Event::trigger(Mana::Event::NpcChannel, Mana::Event::CloseAll);
}
PlayerHandler::PlayerHandler()
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 5dc1206f..a992b1a2 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -86,7 +86,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
event.setString("nick", nick);
event.setString("error", strprintf(_("Whisper could "
"not be sent, %s is offline."), nick.c_str()));
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
}
break;
case 0x02:
@@ -95,7 +95,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
event.setString("nick", nick);
event.setString("error", strprintf(_("Whisper could "
"not be sent, ignored by %s."), nick.c_str()));
- event.Event::trigger(CHANNEL_CHAT);
+ event.Event::trigger(Mana::Event::ChatChannel);
}
break;
}
@@ -118,7 +118,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
Mana::Event event(Mana::Event::Whisper);
event.setString("nick", nick);
event.setString("message", chatMsg);
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
}
}
else
@@ -180,7 +180,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
event.setString("nick", sender_name);
event.setInt("beingId", beingId);
event.setInt("permissions", perms);
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
break;
}
@@ -213,13 +213,13 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
event.setInt("permissions", player_relations.getDefault()
& (PlayerRelation::SPEECH_LOG
| PlayerRelation::SPEECH_FLOAT));
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
}
else
{
Mana::Event event(Mana::Event::Announcement);
event.setString("message", chatMsg);
- event.trigger(CHANNEL_CHAT);
+ event.trigger(Mana::Event::ChatChannel);
}
break;
}
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index 3063c044..79686953 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -58,7 +58,7 @@ GameHandler::GameHandler()
handledMessages = _messages;
gameHandler = this;
- listen(CHANNEL_GAME);
+ listen(Mana::Event::GameChannel);
}
void GameHandler::handleMessage(Net::MessageIn &msg)
@@ -105,9 +105,9 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
}
}
-void GameHandler::event(Channels channel, const Mana::Event &event)
+void GameHandler::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_GAME)
+ if (channel == Mana::Event::GameChannel)
{
if (event.getType() == Mana::Event::EnginesInitialized)
{
diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h
index 18317445..858f16b3 100644
--- a/src/net/tmwa/gamehandler.h
+++ b/src/net/tmwa/gamehandler.h
@@ -41,7 +41,7 @@ class GameHandler : public MessageHandler, public Net::GameHandler,
void handleMessage(Net::MessageIn &msg);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
void connect();
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 7000c96c..d4374d4a 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -108,7 +108,7 @@ GeneralHandler::GeneralHandler():
setStatsList(stats);
- listen(CHANNEL_GAME);
+ listen(Mana::Event::GameChannel);
}
GeneralHandler::~GeneralHandler()
@@ -217,10 +217,10 @@ void GeneralHandler::clearHandlers()
mNetwork->clearHandlers();
}
-void GeneralHandler::event(Channels channel,
+void GeneralHandler::event(Mana::Event::Channel channel,
const Mana::Event &event)
{
- if (channel == CHANNEL_GAME)
+ if (channel == Mana::Event::GameChannel)
{
if (event.getType() == Mana::Event::GuiWindowsLoaded)
{
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index 722c3215..d7b5f743 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -51,7 +51,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler,
void clearHandlers();
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
protected:
MessageHandlerPtr mAdminHandler;
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 5ab6af08..6bba2afd 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -110,7 +110,7 @@ InventoryHandler::InventoryHandler()
mStorage = 0;
mStorageWindow = 0;
- listen(CHANNEL_ITEM);
+ listen(Mana::Event::ItemChannel);
}
InventoryHandler::~InventoryHandler()
@@ -431,10 +431,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
}
}
-void InventoryHandler::event(Channels channel,
+void InventoryHandler::event(Mana::Event::Channel channel,
const Mana::Event &event)
{
- if (channel == CHANNEL_ITEM)
+ if (channel == Mana::Event::ItemChannel)
{
if (event.getType() == Mana::Event::DoCloseInventory)
{
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index dfbefaa8..8edb34ad 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -133,7 +133,7 @@ class InventoryHandler : public MessageHandler, public Net::InventoryHandler,
void handleMessage(Net::MessageIn &msg);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
bool canSplit(const Item *item);
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 85b3b284..a55a3183 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -86,42 +86,42 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
event = new Mana::Event(Mana::Event::Menu);
event->setInt("id", npcId);
parseMenu(event, msg.readString(msg.getLength() - 8));
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case SMSG_NPC_MESSAGE:
event = new Mana::Event(Mana::Event::Message);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getLength() - 8));
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case SMSG_NPC_CLOSE:
// Show the close button
event = new Mana::Event(Mana::Event::Close);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case SMSG_NPC_NEXT:
// Show the next button
event = new Mana::Event(Mana::Event::Next);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case SMSG_NPC_INT_INPUT:
// Request for an integer
event = new Mana::Event(Mana::Event::IntegerInput);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
case SMSG_NPC_STR_INPUT:
// Request for a string
event = new Mana::Event(Mana::Event::StringInput);
event->setInt("id", npcId);
- event->trigger(CHANNEL_NPC);
+ event->trigger(Mana::Event::NpcChannel);
break;
}
@@ -179,7 +179,7 @@ void NpcHandler::talk(int npcId)
Mana::Event event(Mana::Event::TalkSent);
event.setInt("npcId", npcId);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::nextDialog(int npcId)
@@ -189,7 +189,7 @@ void NpcHandler::nextDialog(int npcId)
Mana::Event event(Mana::Event::NextSent);
event.setInt("npcId", npcId);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::closeDialog(int npcId)
@@ -199,7 +199,7 @@ void NpcHandler::closeDialog(int npcId)
Mana::Event event(Mana::Event::CloseSent);
event.setInt("npcId", npcId);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::menuSelect(int npcId, int choice)
@@ -211,7 +211,7 @@ void NpcHandler::menuSelect(int npcId, int choice)
Mana::Event event(Mana::Event::MenuSent);
event.setInt("npcId", npcId);
event.setInt("choice", choice);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::integerInput(int npcId, int value)
@@ -223,7 +223,7 @@ void NpcHandler::integerInput(int npcId, int value)
Mana::Event event(Mana::Event::IntegerInputSent);
event.setInt("npcId", npcId);
event.setInt("value", value);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::stringInput(int npcId, const std::string &value)
@@ -237,7 +237,7 @@ void NpcHandler::stringInput(int npcId, const std::string &value)
Mana::Event event(Mana::Event::StringInputSent);
event.setInt("npcId", npcId);
event.setString("value", value);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
void NpcHandler::sendLetter(int npcId, const std::string &recipient,
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 64dda9d4..4b60414b 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -81,7 +81,7 @@ namespace {
viewport->closePopupMenu();
- Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll);
+ Mana::Event::trigger(Mana::Event::NpcChannel, Mana::Event::CloseAll);
}
} deathListener;
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index 9a1db45c..150a1ba1 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -61,7 +61,7 @@ void triggerAttr(int id, int old)
event.setInt("id", id);
event.setInt("oldValue", old);
event.setInt("newValue", mData.mAttributes.find(id)->second);
- event.trigger(CHANNEL_ATTRIBUTES);
+ event.trigger(Mana::Event::AttributesChannel);
}
void triggerStat(int id, const std::string &changed, int old1, int old2 = 0)
@@ -76,7 +76,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2 = 0)
event.setString("changed", changed);
event.setInt("oldValue1", old1);
event.setInt("oldValue2", old2);
- event.trigger(CHANNEL_ATTRIBUTES);
+ event.trigger(Mana::Event::AttributesChannel);
}
// --- Attributes -------------------------------------------------------------
@@ -218,7 +218,7 @@ void setStorageCount(int count)
Mana::Event event(Mana::Event::StorageCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
- event.trigger(CHANNEL_STORAGE);
+ event.trigger(Mana::Event::StorageChannel);
}
}
@@ -239,7 +239,7 @@ void setNPCInteractionCount(int count)
Mana::Event event(Mana::Event::NpcCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
}
@@ -258,7 +258,7 @@ void setNPCPostCount(int count)
Mana::Event event(Mana::Event::PostCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
- event.trigger(CHANNEL_NPC);
+ event.trigger(Mana::Event::NpcChannel);
}
}
@@ -279,7 +279,7 @@ void setBuySellState(BuySellState buySellState)
Mana::Event event(Mana::Event::StateChange);
event.setInt("oldState", old);
event.setInt("newState", buySellState);
- event.trigger(CHANNEL_BUYSELL);
+ event.trigger(Mana::Event::BuySellChannel);
}
}
@@ -297,7 +297,7 @@ void setTrading(bool trading)
{
Mana::Event event(Mana::Event::Trading);
event.setBool("trading", trading);
- event.trigger(CHANNEL_STATUS);
+ event.trigger(Mana::Event::StatusChannel);
}
}
@@ -353,13 +353,13 @@ class PlayerLogic : Mana::Listener
public:
PlayerLogic()
{
- listen(CHANNEL_CLIENT);
- listen(CHANNEL_GAME);
+ listen(Mana::Event::ClientChannel);
+ listen(Mana::Event::GameChannel);
}
- void event(Channels channel, const Mana::Event &event)
+ void event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_CLIENT)
+ if (channel == Mana::Event::ClientChannel)
{
if (event.getType() == Mana::Event::StateChange)
{
@@ -375,7 +375,7 @@ public:
}
}
}
- else if (channel == CHANNEL_GAME)
+ else if (channel == Mana::Event::GameChannel)
{
if (event.getType() == Mana::Event::Destructed)
{
diff --git a/src/resources/theme.cpp b/src/resources/theme.cpp
index 966f0e94..0509681c 100644
--- a/src/resources/theme.cpp
+++ b/src/resources/theme.cpp
@@ -111,7 +111,7 @@ Theme::Theme():
{
initDefaultThemePath();
- listen(CHANNEL_CONFIG);
+ listen(Mana::Event::ConfigChannel);
loadColors();
mColors[HIGHLIGHT].ch = 'H';
@@ -208,9 +208,9 @@ void Theme::updateAlpha()
iter->second->updateAlpha(mMinimumOpacity);
}
-void Theme::event(Channels channel, const Mana::Event &event)
+void Theme::event(Mana::Event::Channel channel, const Mana::Event &event)
{
- if (channel == CHANNEL_CONFIG &&
+ if (channel == Mana::Event::ConfigChannel &&
event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "guialpha")
{
diff --git a/src/resources/theme.h b/src/resources/theme.h
index f830c94f..050e6d2d 100644
--- a/src/resources/theme.h
+++ b/src/resources/theme.h
@@ -218,7 +218,7 @@ class Theme : public Palette, public Mana::Listener
*/
void setMinimumOpacity(float minimumOpacity);
- void event(Channels channel, const Mana::Event &event);
+ void event(Mana::Event::Channel channel, const Mana::Event &event);
private:
Theme();