summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-09 00:16:28 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-09 17:54:13 +0200
commit404d3f7f2f9aa455bea423a6a00025df23cd6687 (patch)
tree27f6655b3345be1ab109433a55b0512dfe48cb34
parent1e1f619b9ae5aa26058c499c988f45d1fb1b6d53 (diff)
downloadmana-404d3f7f2f9aa455bea423a6a00025df23cd6687.tar.gz
mana-404d3f7f2f9aa455bea423a6a00025df23cd6687.tar.bz2
mana-404d3f7f2f9aa455bea423a6a00025df23cd6687.tar.xz
mana-404d3f7f2f9aa455bea423a6a00025df23cd6687.zip
Removed the Mana namespace
It's just an annoyance when it's only applied to a few classes. Either we place everything in this namespace or nothing, and at the moment I don't see any rationale for placing everything in a Mana namespace. Acked-by: Jared Adams
-rw-r--r--src/actorsprite.cpp12
-rw-r--r--src/being.cpp18
-rw-r--r--src/being.h4
-rw-r--r--src/client.cpp18
-rw-r--r--src/client.h4
-rw-r--r--src/configuration.cpp30
-rw-r--r--src/configuration.h4
-rw-r--r--src/defaults.cpp2
-rw-r--r--src/defaults.h2
-rw-r--r--src/event.cpp5
-rw-r--r--src/event.h11
-rw-r--r--src/game.cpp24
-rw-r--r--src/gui/chat.cpp22
-rw-r--r--src/gui/chat.h4
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/gui.cpp10
-rw-r--r--src/gui/inventorywindow.cpp26
-rw-r--r--src/gui/inventorywindow.h4
-rw-r--r--src/gui/itemamount.cpp12
-rw-r--r--src/gui/ministatus.cpp14
-rw-r--r--src/gui/ministatus.h4
-rw-r--r--src/gui/npcdialog.cpp40
-rw-r--r--src/gui/npcdialog.h4
-rw-r--r--src/gui/outfitwindow.cpp4
-rw-r--r--src/gui/popupmenu.cpp6
-rw-r--r--src/gui/skilldialog.cpp6
-rw-r--r--src/gui/skilldialog.h4
-rw-r--r--src/gui/statuswindow.cpp10
-rw-r--r--src/gui/statuswindow.h4
-rw-r--r--src/gui/viewport.cpp14
-rw-r--r--src/gui/viewport.h4
-rw-r--r--src/gui/widgets/itemcontainer.cpp12
-rw-r--r--src/item.cpp12
-rw-r--r--src/item.h4
-rw-r--r--src/itemshortcut.cpp6
-rw-r--r--src/listener.cpp5
-rw-r--r--src/listener.h5
-rw-r--r--src/localplayer.cpp20
-rw-r--r--src/localplayer.h2
-rw-r--r--src/net/manaserv/chathandler.cpp14
-rw-r--r--src/net/manaserv/generalhandler.cpp18
-rw-r--r--src/net/manaserv/generalhandler.h4
-rw-r--r--src/net/manaserv/inventoryhandler.cpp20
-rw-r--r--src/net/manaserv/inventoryhandler.h4
-rw-r--r--src/net/manaserv/npchandler.cpp62
-rw-r--r--src/net/manaserv/playerhandler.cpp2
-rw-r--r--src/net/tmwa/chathandler.cpp24
-rw-r--r--src/net/tmwa/gamehandler.cpp10
-rw-r--r--src/net/tmwa/gamehandler.h4
-rw-r--r--src/net/tmwa/generalhandler.cpp12
-rw-r--r--src/net/tmwa/generalhandler.h4
-rw-r--r--src/net/tmwa/inventoryhandler.cpp20
-rw-r--r--src/net/tmwa/inventoryhandler.h4
-rw-r--r--src/net/tmwa/npchandler.cpp52
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/net/tmwa/tradehandler.cpp2
-rw-r--r--src/playerinfo.cpp44
-rw-r--r--src/resources/theme.cpp8
-rw-r--r--src/resources/theme.h4
-rw-r--r--src/variabledata.h5
60 files changed, 343 insertions, 370 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index fdf6defd..42086e00 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -60,9 +60,9 @@ ActorSprite::~ActorSprite()
mUsedTargetCursor = NULL;
// Notify listeners of the destruction.
- Mana::Event event(Mana::Event::Destroyed);
+ Event event(Event::Destroyed);
event.setActor("source", this);
- event.trigger(Mana::Event::ActorSpriteChannel);
+ event.trigger(Event::ActorSpriteChannel);
}
bool ActorSprite::draw(Graphics *graphics, int offsetX, int offsetY) const
@@ -256,10 +256,10 @@ void ActorSprite::updateStunMode(int oldMode, int newMode)
{
if (this == player_node)
{
- Mana::Event event(Mana::Event::Stun);
+ Event event(Event::Stun);
event.setInt("oldMode", oldMode);
event.setInt("newMode", newMode);
- event.trigger(Mana::Event::ActorSpriteChannel);
+ event.trigger(Event::ActorSpriteChannel);
}
handleStatusEffect(StatusEffect::getStatusEffect(oldMode, false), -1);
@@ -270,10 +270,10 @@ void ActorSprite::updateStatusEffect(int index, bool newStatus)
{
if (this == player_node)
{
- Mana::Event event(Mana::Event::UpdateStatusEffect);
+ Event event(Event::UpdateStatusEffect);
event.setInt("index", index);
event.setBool("newStatus", newStatus);
- event.trigger(Mana::Event::ActorSpriteChannel);
+ event.trigger(Event::ActorSpriteChannel);
}
handleStatusEffect(StatusEffect::getStatusEffect(index, newStatus), index);
diff --git a/src/being.cpp b/src/being.cpp
index fa9bd4f5..788422fb 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(Mana::Event::ConfigChannel);
- listen(Mana::Event::ChatChannel);
+ listen(Event::ConfigChannel);
+ listen(Event::ChatChannel);
}
Being::~Being()
@@ -1226,11 +1226,11 @@ void Being::talkTo()
Net::getNpcHandler()->talk(mId);
}
-void Being::event(Mana::Event::Channel channel, const Mana::Event &event)
+void Being::event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::ChatChannel &&
- (event.getType() == Mana::Event::Being
- || event.getType() == Mana::Event::Player) &&
+ if (channel == Event::ChatChannel &&
+ (event.getType() == Event::Being
+ || event.getType() == Event::Player) &&
event.getInt("permissions") & PlayerRelation::SPEECH_FLOAT)
{
try
@@ -1240,11 +1240,11 @@ void Being::event(Mana::Event::Channel channel, const Mana::Event &event)
setSpeech(event.getString("text"));
}
}
- catch (Mana::BadEvent badEvent)
+ catch (BadEvent badEvent)
{}
}
- else if (channel == Mana::Event::ConfigChannel &&
- event.getType() == Mana::Event::ConfigOptionChanged)
+ else if (channel == Event::ConfigChannel &&
+ event.getType() == Event::ConfigOptionChanged)
{
if (getType() == PLAYER && event.getString("option") == "visiblenames")
{
diff --git a/src/being.h b/src/being.h
index e3d42717..febe6668 100644
--- a/src/being.h
+++ b/src/being.h
@@ -61,7 +61,7 @@ enum Gender
GENDER_UNSPECIFIED = 2
};
-class Being : public ActorSprite, public Mana::Listener
+class Being : public ActorSprite, public Listener
{
public:
/**
@@ -481,7 +481,7 @@ class Being : public ActorSprite, public Mana::Listener
void talkTo();
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
protected:
/**
diff --git a/src/client.cpp b/src/client.cpp
index 4fb76b4b..2590813f 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(Mana::Event::ConfigChannel);
+ listen(Event::ConfigChannel);
//TODO: fix having to fake a option changed event
- Mana::Event fakeevent(Mana::Event::ConfigOptionChanged);
+ Event fakeevent(Event::ConfigOptionChanged);
fakeevent.setString("option", "fpslimit");
- event(Mana::Event::ConfigChannel, fakeevent);
+ event(Event::ConfigChannel, fakeevent);
// Initialize PlayerInfo
PlayerInfo::init();
@@ -634,10 +634,10 @@ int Client::exec()
if (mState != mOldState)
{
{
- Mana::Event event(Mana::Event::StateChange);
+ Event event(Event::StateChange);
event.setInt("oldState", mOldState);
event.setInt("newState", mState);
- event.trigger(Mana::Event::ClientChannel);
+ event.trigger(Event::ClientChannel);
}
if (mOldState == STATE_GAME)
@@ -797,7 +797,7 @@ int Client::exec()
paths.init("paths.xml", true);
paths.setDefaultValues(getPathsDefaults());
- Mana::Event::trigger(Mana::Event::ClientChannel, Mana::Event::LoadingDatabases);
+ Event::trigger(Event::ClientChannel, Event::LoadingDatabases);
// Load XML databases
ColorDB::load();
@@ -1072,10 +1072,10 @@ int Client::exec()
return 0;
}
-void Client::event(Mana::Event::Channel channel, const Mana::Event &event)
+void Client::event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::ConfigChannel &&
- event.getType() == Mana::Event::ConfigOptionChanged &&
+ if (channel == Event::ConfigChannel &&
+ event.getType() == Event::ConfigOptionChanged &&
event.getString("option") == "fpslimit")
{
const int fpsLimit = config.getIntValue("fpslimit");
diff --git a/src/client.h b/src/client.h
index ab89dcc2..f9030dc0 100644
--- a/src/client.h
+++ b/src/client.h
@@ -119,7 +119,7 @@ enum State {
* The core part of the client. This class initializes all subsystems, runs
* the event loop, and shuts everything down again.
*/
-class Client : public Mana::Listener, public gcn::ActionListener
+class Client : public Listener, public gcn::ActionListener
{
public:
/**
@@ -185,7 +185,7 @@ public:
static const std::string &getScreenshotDirectory()
{ return instance()->mScreenshotDir; }
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
void action(const gcn::ActionEvent &event);
private:
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 59d8a024..44621eb3 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -38,9 +38,9 @@ void Configuration::setValue(const std::string &key, const std::string &value)
ConfigurationObject::setValue(key, value);
// Notify listeners
- Mana::Event event(Mana::Event::ConfigOptionChanged);
+ Event event(Event::ConfigOptionChanged);
event.setString("option", key);
- event.trigger(Mana::Event::ConfigChannel);
+ event.trigger(Event::ConfigChannel);
}
std::string ConfigurationObject::getValue(const std::string &key,
@@ -125,8 +125,8 @@ void Configuration::setDefaultValues(DefaultsData *defaultsData)
mDefaultsData = defaultsData;
}
-Mana::VariableData* Configuration::getDefault(const std::string &key,
- Mana::VariableData::DataType type
+VariableData* Configuration::getDefault(const std::string &key,
+ VariableData::DataType type
) const
{
if (mDefaultsData)
@@ -153,9 +153,9 @@ int Configuration::getIntValue(const std::string &key) const
Options::const_iterator iter = mOptions.find(key);
if (iter == mOptions.end())
{
- Mana::VariableData* vd = getDefault(key, Mana::VariableData::DATA_INT);
+ VariableData* vd = getDefault(key, VariableData::DATA_INT);
if (vd)
- defaultValue = ((Mana::IntData*)vd)->getData();
+ defaultValue = ((IntData*)vd)->getData();
}
else
{
@@ -170,11 +170,11 @@ std::string Configuration::getStringValue(const std::string &key) const
Options::const_iterator iter = mOptions.find(key);
if (iter == mOptions.end())
{
- Mana::VariableData* vd = getDefault(key,
- Mana::VariableData::DATA_STRING);
+ VariableData* vd = getDefault(key,
+ VariableData::DATA_STRING);
if (vd)
- defaultValue = ((Mana::StringData*)vd)->getData();
+ defaultValue = ((StringData*)vd)->getData();
}
else
{
@@ -190,11 +190,11 @@ float Configuration::getFloatValue(const std::string &key) const
Options::const_iterator iter = mOptions.find(key);
if (iter == mOptions.end())
{
- Mana::VariableData* vd = getDefault(key,
- Mana::VariableData::DATA_FLOAT);
+ VariableData* vd = getDefault(key,
+ VariableData::DATA_FLOAT);
if (vd)
- defaultValue = ((Mana::FloatData*)vd)->getData();
+ defaultValue = ((FloatData*)vd)->getData();
}
else
{
@@ -209,11 +209,11 @@ bool Configuration::getBoolValue(const std::string &key) const
Options::const_iterator iter = mOptions.find(key);
if (iter == mOptions.end())
{
- Mana::VariableData* vd = getDefault(key,
- Mana::VariableData::DATA_BOOL);
+ VariableData* vd = getDefault(key,
+ VariableData::DATA_BOOL);
if (vd)
- defaultValue = ((Mana::BoolData*)vd)->getData();
+ defaultValue = ((BoolData*)vd)->getData();
}
else
{
diff --git a/src/configuration.h b/src/configuration.h
index a46b0718..bf8cffde 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -247,8 +247,8 @@ class Configuration : public ConfigurationObject
bool getBoolValue(const std::string &key) const;
- Mana::VariableData* getDefault(const std::string &key,
- Mana::VariableData::DataType type) const;
+ VariableData* getDefault(const std::string &key,
+ VariableData::DataType type) const;
private:
/**
* Clean up the default values member.
diff --git a/src/defaults.cpp b/src/defaults.cpp
index e0e48d60..54e39c1f 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -26,8 +26,6 @@
#include <stdlib.h>
-using namespace Mana;
-
VariableData* createData(int defData)
{
return new IntData(defData);
diff --git a/src/defaults.h b/src/defaults.h
index b9dfa511..34a5402c 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -25,7 +25,7 @@
#include <string>
#include "variabledata.h"
-typedef std::map<std::string, Mana::VariableData*> DefaultsData;
+typedef std::map<std::string, VariableData*> DefaultsData;
DefaultsData* getConfigDefaults();
DefaultsData* getBrandingDefaults();
diff --git a/src/event.cpp b/src/event.cpp
index d1d12242..fc6fa570 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -23,9 +23,6 @@
#include "listener.h"
#include "variabledata.h"
-namespace Mana
-{
-
Event::ListenMap Event::mBindings;
Event::~Event()
@@ -251,5 +248,3 @@ void Event::remove(Listener *listener)
it++;
}
}
-
-} // namespace Mana
diff --git a/src/event.h b/src/event.h
index 74a4e1f5..4ee0c326 100644
--- a/src/event.h
+++ b/src/event.h
@@ -28,9 +28,6 @@
class ActorSprite;
class Item;
-namespace Mana
-{
-
// Possible exception that can be thrown
enum BadEvent {
BAD_KEY,
@@ -297,7 +294,7 @@ public:
* given channel.
*/
static inline void trigger(Channel channel, Type type)
- { trigger(channel, Mana::Event(type)); }
+ { trigger(channel, Event(type)); }
protected:
friend class Listener;
@@ -327,11 +324,9 @@ private:
VariableMap mData;
};
-} // namespace Mana
-
#define SERVER_NOTICE(message) { \
-Mana::Event event(Mana::Event::ServerNotice); \
+Event event(Event::ServerNotice); \
event.setString("message", message); \
-event.trigger(Mana::Event::NoticesChannel, event); }
+event.trigger(Event::NoticesChannel, event); }
#endif // EVENT_H
diff --git a/src/game.cpp b/src/game.cpp
index 5cc01f64..7f1def50 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -128,7 +128,7 @@ ChatTab *localChatTab = NULL;
*/
static void initEngines()
{
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::EnginesInitializing);
+ Event::trigger(Event::GameChannel, Event::EnginesInitializing);
actorSpriteManager = new ActorSpriteManager;
commandHandler = new CommandHandler;
@@ -138,7 +138,7 @@ static void initEngines()
particleEngine = new Particle(NULL);
particleEngine->setupEngine();
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::EnginesInitialized);
+ Event::trigger(Event::GameChannel, Event::EnginesInitialized);
}
/**
@@ -146,7 +146,7 @@ static void initEngines()
*/
static void createGuiWindows()
{
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsLoading);
+ Event::trigger(Event::GameChannel, Event::GuiWindowsLoading);
setupWindow->clearWindowsForReset();
@@ -183,7 +183,7 @@ static void createGuiWindows()
NpcDialog::setup();
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsLoaded);
+ Event::trigger(Event::GameChannel, Event::GuiWindowsLoaded);
}
#define del_0(X) { delete X; X = 0; }
@@ -193,7 +193,7 @@ static void createGuiWindows()
*/
static void destroyGuiWindows()
{
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsUnloading);
+ Event::trigger(Event::GameChannel, 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(Mana::Event::NpcChannel, Mana::Event::CloseAll); // Cleanup remaining NPC dialogs
+ Event::trigger(Event::NpcChannel, Event::CloseAll); // Cleanup remaining NPC dialogs
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::GuiWindowsUnloaded);
+ Event::trigger(Event::GameChannel, Event::GuiWindowsUnloaded);
}
Game *Game::mInstance = 0;
@@ -266,12 +266,12 @@ Game::Game():
setupWindow->setInGame(true);
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::Constructed);
+ Event::trigger(Event::GameChannel, Event::Constructed);
}
Game::~Game()
{
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::Destructing);
+ Event::trigger(Event::GameChannel, Event::Destructing);
delete mWindowMenu;
@@ -289,7 +289,7 @@ Game::~Game()
mInstance = 0;
- Mana::Event::trigger(Mana::Event::GameChannel, Mana::Event::Destructed);
+ Event::trigger(Event::GameChannel, Event::Destructed);
}
static bool saveScreenshot()
@@ -990,7 +990,7 @@ void Game::changeMap(const std::string &mapPath)
delete mCurrentMap;
mCurrentMap = newMap;
- Mana::Event event(Mana::Event::MapLoaded);
+ Event event(Event::MapLoaded);
event.setString("mapPath", mapPath);
- event.trigger(Mana::Event::GameChannel);
+ event.trigger(Event::GameChannel);
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 17eb8af3..491542a8 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -90,8 +90,8 @@ ChatWindow::ChatWindow():
mAutoComplete(new ChatAutoComplete),
mTmpVisible(false)
{
- listen(Mana::Event::ChatChannel);
- listen(Mana::Event::NoticesChannel);
+ listen(Event::ChatChannel);
+ listen(Event::NoticesChannel);
setWindowName("Chat");
@@ -375,33 +375,33 @@ void ChatWindow::mouseDragged(gcn::MouseEvent &event)
}
}
-void ChatWindow::event(Mana::Event::Channel channel, const Mana::Event &event)
+void ChatWindow::event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::NoticesChannel)
+ if (channel == Event::NoticesChannel)
{
- if (event.getType() == Mana::Event::ServerNotice)
+ if (event.getType() == Event::ServerNotice)
localChatTab->chatLog(event.getString("message"), BY_SERVER);
}
- else if (channel == Mana::Event::ChatChannel)
+ else if (channel == Event::ChatChannel)
{
- if (event.getType() == Mana::Event::Whisper)
+ if (event.getType() == Event::Whisper)
{
whisper(event.getString("nick"), event.getString("message"));
}
- else if (event.getType() == Mana::Event::WhisperError)
+ else if (event.getType() == Event::WhisperError)
{
whisper(event.getString("nick"),
event.getString("error"), BY_SERVER);
}
- else if (event.getType() == Mana::Event::Player)
+ else if (event.getType() == Event::Player)
{
localChatTab->chatLog(event.getString("message"), BY_PLAYER);
}
- else if (event.getType() == Mana::Event::Announcement)
+ else if (event.getType() == Event::Announcement)
{
localChatTab->chatLog(event.getString("message"), BY_GM);
}
- else if (event.getType() == Mana::Event::Being)
+ else if (event.getType() == Event::Being)
{
if (event.getInt("permissions") & PlayerRelation::SPEECH_LOG)
localChatTab->chatLog(event.getString("message"), BY_OTHER);
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 4ec2a179..bba3a477 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -77,7 +77,7 @@ struct CHATLOG
*/
class ChatWindow : public Window,
public gcn::ActionListener,
- public Mana::Listener
+ public Listener
{
public:
/**
@@ -158,7 +158,7 @@ class ChatWindow : public Window,
void mousePressed(gcn::MouseEvent &event);
void mouseDragged(gcn::MouseEvent &event);
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
/**
* Scrolls the chat window
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 09ad6207..339cf717 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(Mana::Event::DoUnequip);
+ item->doEvent(Event::DoUnequip);
setSelected(-1);
}
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index b8ce7989..2aca60bf 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -50,18 +50,18 @@ SDLInput *guiInput = 0;
// Bolded font
gcn::Font *boldFont = 0;
-class GuiConfigListener : public Mana::Listener
+class GuiConfigListener : public Listener
{
public:
GuiConfigListener(Gui *g):
mGui(g)
{}
- void event(Mana::Event::Channel channel, const Mana::Event &event)
+ void event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::ConfigChannel)
+ if (channel == Event::ConfigChannel)
{
- if (event.getType() == Mana::Event::ConfigOptionChanged &&
+ if (event.getType() == Event::ConfigOptionChanged &&
event.getString("option") == "customcursor")
{
bool bCustomCursor = config.getBoolValue("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(Mana::Event::ConfigChannel);
+ mConfigListener->listen(Event::ConfigChannel);
}
Gui::~Gui()
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 7a8d5f09..4ebcce8b 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(Mana::Event::AttributesChannel);
+ listen(Event::AttributesChannel);
setWindowName(isMainInventory() ? "Inventory" : "Storage");
setupWindow->registerWindowForReset(this);
@@ -195,19 +195,19 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
return;
if (event.getId() == "activate")
- item->doEvent(Mana::Event::DoUse);
+ item->doEvent(Event::DoUse);
else if (event.getId() == "equip")
{
if (item->isEquippable())
{
if (item->isEquipped())
- item->doEvent(Mana::Event::DoUnequip);
+ item->doEvent(Event::DoUnequip);
else
- item->doEvent(Mana::Event::DoEquip);
+ item->doEvent(Event::DoEquip);
}
else
{
- item->doEvent(Mana::Event::DoUse);
+ item->doEvent(Event::DoUse);
}
}
else if (event.getId() == "drop")
@@ -265,21 +265,21 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
return;
if (mInventory->isMainInventory())
{
- Mana::Event event(Mana::Event::DoMove);
+ Event event(Event::DoMove);
event.setItem("item", item);
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::INVENTORY);
event.setInt("destination", Inventory::STORAGE);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
}
else
{
- Mana::Event event(Mana::Event::DoMove);
+ Event event(Event::DoMove);
event.setItem("item", item);
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::STORAGE);
event.setInt("destination", Inventory::INVENTORY);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
}
}
}
@@ -383,16 +383,16 @@ void InventoryWindow::close()
}
else
{
- Mana::Event event(Mana::Event::DoCloseInventory);
+ Event event(Event::DoCloseInventory);
event.setInt("type", mInventory->getType());
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
scheduleDelete();
}
}
-void InventoryWindow::event(Mana::Event::Channel channel, const Mana::Event &event)
+void InventoryWindow::event(Event::Channel channel, const Event &event)
{
- if (event.getType() == Mana::Event::UpdateAttribute)
+ if (event.getType() == Event::UpdateAttribute)
{
int id = event.getInt("id");
if (id == TOTAL_WEIGHT ||
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index c1f6ec57..d192fafa 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -49,7 +49,7 @@ class InventoryWindow : public Window,
public gcn::KeyListener,
public gcn::SelectionListener,
public InventoryListener,
- public Mana::Listener
+ public Listener
{
public:
/**
@@ -116,7 +116,7 @@ class InventoryWindow : public Window,
bool isMainInventory() { return mInventory->isMainInventory(); }
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
private:
/**
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 7782466d..43cdf1cf 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -47,29 +47,29 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
tradeWindow->tradeItem(item, amount);
break;
case ItemDrop:
- item->doEvent(Mana::Event::DoDrop, amount);
+ item->doEvent(Event::DoDrop, amount);
break;
case ItemSplit:
- item->doEvent(Mana::Event::DoSplit, amount);
+ item->doEvent(Event::DoSplit, amount);
break;
case StoreAdd:
{
- Mana::Event event(Mana::Event::DoMove);
+ Event event(Event::DoMove);
event.setItem("item", item);
event.setInt("amount", amount);
event.setInt("source", Inventory::INVENTORY);
event.setInt("destination", Inventory::STORAGE);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
}
break;
case StoreRemove:
{
- Mana::Event event(Mana::Event::DoMove);
+ Event event(Event::DoMove);
event.setItem("item", item);
event.setInt("amount", amount);
event.setInt("source", Inventory::STORAGE);
event.setInt("destination", Inventory::INVENTORY);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
}
break;
default:
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 5791b4fb..0fdf59b1 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(Mana::Event::AttributesChannel);
+ listen(Event::AttributesChannel);
mHpBar = new ProgressBar(0, 100, 20, Theme::PROG_HP);
StatusWindow::updateHPBar(mHpBar);
@@ -119,12 +119,12 @@ void MiniStatusWindow::drawIcons(Graphics *graphics)
}
}
-void MiniStatusWindow::event(Mana::Event::Channel channel,
- const Mana::Event &event)
+void MiniStatusWindow::event(Event::Channel channel,
+ const Event &event)
{
- if (channel == Mana::Event::AttributesChannel)
+ if (channel == Event::AttributesChannel)
{
- if (event.getType() == Mana::Event::UpdateAttribute)
+ if (event.getType() == Event::UpdateAttribute)
{
int id = event.getInt("id");
if (id == HP || id == MAX_HP)
@@ -141,9 +141,9 @@ void MiniStatusWindow::event(Mana::Event::Channel channel,
}
}
}
- else if (channel == Mana::Event::ActorSpriteChannel)
+ else if (channel == Event::ActorSpriteChannel)
{
- if (event.getType() == Mana::Event::UpdateStatusEffect)
+ if (event.getType() == Event::UpdateStatusEffect)
{
int index = event.getInt("index");
bool newStatus = event.getBool("newStatus");
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index 88d2d88a..7fbb8597 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -38,14 +38,14 @@ class TextPopup;
*
* \ingroup Interface
*/
-class MiniStatusWindow : public Popup, public Mana::Listener
+class MiniStatusWindow : public Popup, public Listener
{
public:
MiniStatusWindow();
void drawIcons(Graphics *graphics);
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
void logic(); // Updates icons
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 8322a735..a8f61a1a 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -52,10 +52,10 @@
typedef std::map<int, NpcDialog*> NpcDialogs;
-class NpcEventListener : public Mana::Listener
+class NpcEventListener : public Listener
{
public:
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
NpcDialog *getDialog(int id, bool make = true);
@@ -143,7 +143,7 @@ NpcDialog::NpcDialog(int npcId)
setVisible(true);
requestFocus();
- listen(Mana::Event::ConfigChannel);
+ listen(Event::ConfigChannel);
PlayerInfo::setNPCInteractionCount(PlayerInfo::getNPCInteractionCount()
+ 1);
}
@@ -387,12 +387,12 @@ void NpcDialog::setVisible(bool visible)
}
}
-void NpcDialog::event(Mana::Event::Channel channel, const Mana::Event &event)
+void NpcDialog::event(Event::Channel channel, const Event &event)
{
- if (channel != Mana::Event::ConfigChannel)
+ if (channel != Event::ConfigChannel)
return;
- if (event.getType() == Mana::Event::ConfigOptionChanged &&
+ if (event.getType() == Event::ConfigOptionChanged &&
event.getString("option") == "logNpcInGui")
{
mLogInteraction = config.getBoolValue("logNpcInGui");
@@ -436,7 +436,7 @@ void NpcDialog::setup()
npcListener = new NpcEventListener();
- npcListener->listen(Mana::Event::NpcChannel);
+ npcListener->listen(Event::NpcChannel);
}
void NpcDialog::buildLayout()
@@ -506,19 +506,19 @@ void NpcDialog::buildLayout()
mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
}
-void NpcEventListener::event(Mana::Event::Channel channel,
- const Mana::Event &event)
+void NpcEventListener::event(Event::Channel channel,
+ const Event &event)
{
- if (channel != Mana::Event::NpcChannel)
+ if (channel != Event::NpcChannel)
return;
- if (event.getType() == Mana::Event::Message)
+ if (event.getType() == Event::Message)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
dialog->addText(event.getString("text"));
}
- else if (event.getType() == Mana::Event::Menu)
+ else if (event.getType() == Event::Menu)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -528,7 +528,7 @@ void NpcEventListener::event(Mana::Event::Channel channel,
for (int i = 1; i <= count; i++)
dialog->addChoice(event.getString("choice" + toString(i)));
}
- else if (event.getType() == Mana::Event::IntegerInput)
+ else if (event.getType() == Event::IntegerInput)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -538,7 +538,7 @@ void NpcEventListener::event(Mana::Event::Channel channel,
dialog->integerRequest(defaultValue, min, max);
}
- else if (event.getType() == Mana::Event::StringInput)
+ else if (event.getType() == Event::StringInput)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -546,12 +546,12 @@ void NpcEventListener::event(Mana::Event::Channel channel,
{
dialog->textRequest(event.getString("default"));
}
- catch (Mana::BadEvent)
+ catch (BadEvent)
{
dialog->textRequest("");
}
}
- else if (event.getType() == Mana::Event::Next)
+ else if (event.getType() == Event::Next)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -565,7 +565,7 @@ void NpcEventListener::event(Mana::Event::Channel channel,
dialog->showNextButton();
}
- else if (event.getType() == Mana::Event::Close)
+ else if (event.getType() == Event::Close)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -579,11 +579,11 @@ void NpcEventListener::event(Mana::Event::Channel channel,
dialog->showCloseButton();
}
- else if (event.getType() == Mana::Event::CloseAll)
+ else if (event.getType() == Event::CloseAll)
{
NpcDialog::closeAll();
}
- else if (event.getType() == Mana::Event::End)
+ else if (event.getType() == Event::End)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -591,7 +591,7 @@ void NpcEventListener::event(Mana::Event::Channel channel,
if (dialog)
dialog->close();
}
- else if (event.getType() == Mana::Event::Post)
+ else if (event.getType() == Event::Post)
{
new NpcPostDialog(event.getInt("id"));
}
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index 7923cfa3..9981e088 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -45,7 +45,7 @@ class Button;
* \ingroup Interface
*/
class NpcDialog : public Window, public gcn::ActionListener,
- public gcn::ListModel, public Mana::Listener
+ public gcn::ListModel, public Listener
{
public:
/**
@@ -145,7 +145,7 @@ class NpcDialog : public Window, public gcn::ActionListener,
void setVisible(bool visible);
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
/**
* Returns the first active instance. Useful for pushing user
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index e54fed04..efa0e08b 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -172,7 +172,7 @@ void OutfitWindow::wearOutfit(int outfit)
if (item && !item->isEquipped() && item->getQuantity())
{
if (item->isEquippable())
- item->doEvent(Mana::Event::DoEquip);
+ item->doEvent(Event::DoEquip);
}
}
}
@@ -341,7 +341,7 @@ void OutfitWindow::unequipNotInOutfit(int outfit)
Item *item = inventory->getItem(i);
if (item)
- item->doEvent(Mana::Event::DoUnequip);
+ item->doEvent(Event::DoUnequip);
}
}
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 6c8662a0..7e648311 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -269,13 +269,13 @@ void PopupMenu::handleLink(const std::string &link)
if (mItem->isEquippable())
{
if (mItem->isEquipped())
- mItem->doEvent(Mana::Event::DoUnequip);
+ mItem->doEvent(Event::DoUnequip);
else
- mItem->doEvent(Mana::Event::DoEquip);
+ mItem->doEvent(Event::DoEquip);
}
else
{
- mItem->doEvent(Mana::Event::DoUse);
+ mItem->doEvent(Event::DoUse);
}
}
else if (link == "chat")
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 95324e98..4c405254 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -212,7 +212,7 @@ private:
SkillDialog::SkillDialog():
Window(_("Skills"))
{
- listen(Mana::Event::AttributesChannel);
+ listen(Event::AttributesChannel);
setWindowName("Skills");
setCloseButton(true);
@@ -280,9 +280,9 @@ void SkillDialog::update()
}
}
-void SkillDialog::event(Mana::Event::Channel channel, const Mana::Event &event)
+void SkillDialog::event(Event::Channel channel, const Event &event)
{
- if (event.getType() == Mana::Event::UpdateAttribute)
+ if (event.getType() == Event::UpdateAttribute)
{
if (event.getInt("id") == SKILL_POINTS)
{
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index b6d1d4ae..d83210b5 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -42,14 +42,14 @@ struct SkillInfo;
*
* \ingroup Interface
*/
-class SkillDialog : public Window, public gcn::ActionListener, public Mana::Listener
+class SkillDialog : public Window, public gcn::ActionListener, public Listener
{
public:
SkillDialog();
~SkillDialog();
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
/**
* Called when receiving actions from widget.
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index b124a883..28ed6c68 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(Mana::Event::AttributesChannel);
+ listen(Event::AttributesChannel);
setWindowName("Status");
setupWindow->registerWindowForReset(this);
@@ -217,10 +217,10 @@ StatusWindow::StatusWindow():
mLvlLabel->adjustSize();
}
-void StatusWindow::event(Mana::Event::Channel channel,
- const Mana::Event &event)
+void StatusWindow::event(Event::Channel channel,
+ const Event &event)
{
- if (event.getType() == Mana::Event::UpdateAttribute)
+ if (event.getType() == Event::UpdateAttribute)
{
switch(event.getInt("id"))
{
@@ -266,7 +266,7 @@ void StatusWindow::event(Mana::Event::Channel channel,
break;
}
}
- else if (event.getType() == Mana::Event::UpdateStat)
+ else if (event.getType() == Event::UpdateStat)
{
int id = event.getInt("id");
diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h
index 6a08fd09..d52dbd72 100644
--- a/src/gui/statuswindow.h
+++ b/src/gui/statuswindow.h
@@ -40,7 +40,7 @@ class VertContainer;
*
* \ingroup Interface
*/
-class StatusWindow : public Window, public Mana::Listener
+class StatusWindow : public Window, public Listener
{
public:
/**
@@ -48,7 +48,7 @@ class StatusWindow : public Window, public Mana::Listener
*/
StatusWindow();
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
void updateAttrs();
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 3ec88102..e5211baa 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -71,8 +71,8 @@ Viewport::Viewport():
setFocusable(true);
- listen(Mana::Event::ConfigChannel);
- listen(Mana::Event::ActorSpriteChannel);
+ listen(Event::ConfigChannel);
+ listen(Event::ActorSpriteChannel);
}
Viewport::~Viewport()
@@ -584,10 +584,10 @@ void Viewport::hideBeingPopup()
mBeingPopup->setVisible(false);
}
-void Viewport::event(Mana::Event::Channel channel, const Mana::Event &event)
+void Viewport::event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::ActorSpriteChannel
- && event.getType() == Mana::Event::Destroyed)
+ if (channel == Event::ActorSpriteChannel
+ && event.getType() == Event::Destroyed)
{
ActorSprite *actor = event.getActor("source");
@@ -597,8 +597,8 @@ void Viewport::event(Mana::Event::Channel channel, const Mana::Event &event)
if (mHoverItem == actor)
mHoverItem = 0;
}
- else if (channel == Mana::Event::ConfigChannel &&
- event.getType() == Mana::Event::ConfigOptionChanged)
+ else if (channel == Event::ConfigChannel &&
+ event.getType() == Event::ConfigOptionChanged)
{
const std::string option = event.getString("option");
if (option == "ScrollLaziness" || option == "ScrollRadius")
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index eec09478..feb521d7 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -54,7 +54,7 @@ const int walkingMouseDelay = 500;
* coordinates.
*/
class Viewport : public WindowContainer, public gcn::MouseListener,
- public Mana::Listener
+ public Listener
{
public:
/**
@@ -171,7 +171,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
void shakeScreenStop()
{ mShakeEffects.clear(); }
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
private:
/**
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 59f7934e..0967055b 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -346,10 +346,10 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
Item *item = getSelectedItem();
{
- Mana::Event event(Mana::Event::DoMove);
+ Event event(Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", index);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
}
selectNone();
}
@@ -418,10 +418,10 @@ void ItemContainer::keyAction()
mHighlightedIndex != -1)
{
Item *item = getSelectedItem();
- Mana::Event event(Mana::Event::DoMove);
+ Event event(Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
setSelectedIndex(mHighlightedIndex);
}
// If the highlight is on an item then select it.
@@ -434,10 +434,10 @@ void ItemContainer::keyAction()
else if (mSelectedIndex != -1)
{
Item *item = getSelectedItem();
- Mana::Event event(Mana::Event::DoMove);
+ Event event(Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
selectNone();
}
}
diff --git a/src/item.cpp b/src/item.cpp
index 3dff9228..821a178b 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -72,19 +72,19 @@ void Item::setId(int id)
"unknown-item.png"));
}
-void Item::doEvent(Mana::Event::Type eventName)
+void Item::doEvent(Event::Type eventName)
{
- Mana::Event event(eventName);
+ Event event(eventName);
event.setItem("item", this);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
}
-void Item::doEvent(Mana::Event::Type eventName, int amount)
+void Item::doEvent(Event::Type eventName, int amount)
{
- Mana::Event event(eventName);
+ Event event(eventName);
event.setItem("item", this);
event.setInt("amount", amount);
- event.trigger(Mana::Event::ItemChannel);
+ event.trigger(Event::ItemChannel);
}
bool Item::isEquippable() const
diff --git a/src/item.h b/src/item.h
index 294ac477..04cf269e 100644
--- a/src/item.h
+++ b/src/item.h
@@ -114,9 +114,9 @@ class Item
*/
int getInvIndex() const { return mInvIndex; }
- void doEvent(Mana::Event::Type eventType);
+ void doEvent(Event::Type eventType);
- void doEvent(Mana::Event::Type eventType, int amount);
+ void doEvent(Event::Type eventType, int amount);
/**
* Returns information about this item type.
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 51bd6b21..dfcbb3b6 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -74,13 +74,13 @@ void ItemShortcut::useItem(int index)
if (item->getInfo().getEquippable())
{
if (item->isEquipped())
- item->doEvent(Mana::Event::DoUnequip);
+ item->doEvent(Event::DoUnequip);
else
- item->doEvent(Mana::Event::DoEquip);
+ item->doEvent(Event::DoEquip);
}
else
{
- item->doEvent(Mana::Event::DoUse);
+ item->doEvent(Event::DoUse);
}
}
}
diff --git a/src/listener.cpp b/src/listener.cpp
index b156baf7..dda5e5ff 100644
--- a/src/listener.cpp
+++ b/src/listener.cpp
@@ -22,9 +22,6 @@
#include "event.h"
-namespace Mana
-{
-
Listener::~Listener()
{
Event::remove(this);
@@ -39,5 +36,3 @@ void Listener::ignore(Event::Channel channel)
{
Event::unbind(this, channel);
}
-
-} // namespace Mana
diff --git a/src/listener.h b/src/listener.h
index a61e0883..21ff3faf 100644
--- a/src/listener.h
+++ b/src/listener.h
@@ -25,9 +25,6 @@
#include <string>
-namespace Mana
-{
-
class Listener
{
public:
@@ -40,6 +37,4 @@ public:
virtual void event(Event::Channel channel, const Event &event) = 0;
};
-} // namespace Mana
-
#endif
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 1ed65cd6..4a03c841 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -85,7 +85,7 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mAfkTime(0),
mAwayMode(false)
{
- listen(Mana::Event::AttributesChannel);
+ listen(Event::AttributesChannel);
mAwayListener = new AwayListener();
@@ -93,8 +93,8 @@ LocalPlayer::LocalPlayer(int id, int subtype):
setShowName(config.getValue("showownname", 1));
- listen(Mana::Event::ConfigChannel);
- listen(Mana::Event::ActorSpriteChannel);
+ listen(Event::ConfigChannel);
+ listen(Event::ActorSpriteChannel);
}
LocalPlayer::~LocalPlayer()
@@ -1105,11 +1105,11 @@ void LocalPlayer::addMessageToQueue(const std::string &message, int color)
mMessages.push_back(MessagePair(message, color));
}
-void LocalPlayer::event(Mana::Event::Channel channel, const Mana::Event &event)
+void LocalPlayer::event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::ActorSpriteChannel)
+ if (channel == Event::ActorSpriteChannel)
{
- if (event.getType() == Mana::Event::Destroyed)
+ if (event.getType() == Event::Destroyed)
{
ActorSprite *actor = event.getActor("source");
@@ -1120,9 +1120,9 @@ void LocalPlayer::event(Mana::Event::Channel channel, const Mana::Event &event)
mTarget = 0;
}
}
- else if (channel == Mana::Event::AttributesChannel)
+ else if (channel == Event::AttributesChannel)
{
- if (event.getType() == Mana::Event::UpdateAttribute)
+ if (event.getType() == Event::UpdateAttribute)
{
if (event.getInt("id") == EXP)
{
@@ -1133,9 +1133,9 @@ void LocalPlayer::event(Mana::Event::Channel channel, const Mana::Event &event)
}
}
}
- else if (channel == Mana::Event::ConfigChannel)
+ else if (channel == Event::ConfigChannel)
{
- if (event.getType() == Mana::Event::ConfigOptionChanged &&
+ if (event.getType() == Event::ConfigOptionChanged &&
event.getString("option") == "showownname")
{
setShowName(config.getValue("showownname", 1));
diff --git a/src/localplayer.h b/src/localplayer.h
index 0f66c55f..54c1a2e7 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(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
/**
* Tells the engine wether to check
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 021dddf0..6c97fae3 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -165,8 +165,8 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg)
std::string mes = being->getName() + " : " + chatMsg;
- Mana::Event event(being == player_node ? Mana::Event::Player
- : Mana::Event::Being);
+ Event event(being == player_node ? Event::Player
+ : Event::Being);
event.setString("message", mes);
event.setString("text", chatMsg);
event.setString("nick", being->getName());
@@ -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(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
}
void ChatHandler::handleEnterChannelResponse(Net::MessageIn &msg)
@@ -234,18 +234,18 @@ void ChatHandler::handlePrivateMessage(Net::MessageIn &msg)
std::string userNick = msg.readString();
std::string chatMsg = msg.readString();
- Mana::Event event(Mana::Event::Whisper);
+ Event event(Event::Whisper);
event.setString("nick", userNick);
event.setString("message", chatMsg);
- event.trigger(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
}
void ChatHandler::handleAnnouncement(Net::MessageIn &msg)
{
std::string chatMsg = msg.readString();
- Mana::Event event(Mana::Event::Announcement);
+ Event event(Event::Announcement);
event.setString("message", chatMsg);
- event.trigger(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
}
void ChatHandler::handleChatMessage(Net::MessageIn &msg)
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index e5e7ef95..68d5ee9e 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -91,8 +91,8 @@ GeneralHandler::GeneralHandler():
generalHandler = this;
- listen(Mana::Event::ClientChannel);
- listen(Mana::Event::GameChannel);
+ listen(Event::ClientChannel);
+ listen(Event::GameChannel);
}
void GeneralHandler::load()
@@ -171,12 +171,12 @@ void GeneralHandler::clearHandlers()
clearNetworkHandlers();
}
-void GeneralHandler::event(Mana::Event::Channel channel,
- const Mana::Event &event)
+void GeneralHandler::event(Event::Channel channel,
+ const Event &event)
{
- if (channel == Mana::Event::ClientChannel)
+ if (channel == Event::ClientChannel)
{
- if (event.getType() == Mana::Event::StateChange)
+ if (event.getType() == Event::StateChange)
{
int newState = event.getInt("newState");
@@ -186,15 +186,15 @@ void GeneralHandler::event(Mana::Event::Channel channel,
game->gameLoading();
}
}
- else if (event.getType() == Mana::Event::LoadingDatabases)
+ else if (event.getType() == Event::LoadingDatabases)
{
Attributes::load();
Attributes::informItemDB();
}
}
- else if (channel == Mana::Event::GameChannel)
+ else if (channel == Event::GameChannel)
{
- if (event.getType() == Mana::Event::GuiWindowsLoaded)
+ if (event.getType() == Event::GuiWindowsLoaded)
{
inventoryWindow->setSplitAllowed(true);
skillDialog->loadSkills("mana-skills.xml");
diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h
index 20c4c338..a840f02f 100644
--- a/src/net/manaserv/generalhandler.h
+++ b/src/net/manaserv/generalhandler.h
@@ -31,7 +31,7 @@
namespace ManaServ {
-class GeneralHandler : public Net::GeneralHandler, public Mana::Listener
+class GeneralHandler : public Net::GeneralHandler, public Listener
{
public:
GeneralHandler();
@@ -46,7 +46,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener
void clearHandlers();
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
protected:
MessageHandlerPtr mBeingHandler;
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index 0fd57225..ff9b69e6 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -52,7 +52,7 @@ InventoryHandler::InventoryHandler()
handledMessages = _messages;
inventoryHandler = this;
- listen(Mana::Event::ItemChannel);
+ listen(Event::ItemChannel);
}
void InventoryHandler::handleMessage(Net::MessageIn &msg)
@@ -108,10 +108,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
}
}
-void InventoryHandler::event(Mana::Event::Channel channel,
- const Mana::Event &event)
+void InventoryHandler::event(Event::Channel channel,
+ const Event &event)
{
- if (channel == Mana::Event::ItemChannel)
+ if (channel == Event::ItemChannel)
{
Item *item = event.getItem("item");
@@ -120,13 +120,13 @@ void InventoryHandler::event(Mana::Event::Channel channel,
int index = item->getInvIndex();
- if (event.getType() == Mana::Event::DoEquip)
+ if (event.getType() == Event::DoEquip)
{
MessageOut msg(PGMSG_EQUIP);
msg.writeInt8(index);
gameServerConnection->send(msg);
}
- else if (event.getType() == Mana::Event::DoUnequip)
+ else if (event.getType() == Event::DoUnequip)
{
MessageOut msg(PGMSG_UNEQUIP);
msg.writeInt8(index);
@@ -136,13 +136,13 @@ void InventoryHandler::event(Mana::Event::Channel channel,
// for instance.
mEquips.setEquipment(index, 0, 0);
}
- else if (event.getType() == Mana::Event::DoUse)
+ else if (event.getType() == Event::DoUse)
{
MessageOut msg(PGMSG_USE_ITEM);
msg.writeInt8(index);
gameServerConnection->send(msg);
}
- else if (event.getType() == Mana::Event::DoDrop)
+ else if (event.getType() == Event::DoDrop)
{
int amount = event.getInt("amount", 1);
@@ -151,7 +151,7 @@ void InventoryHandler::event(Mana::Event::Channel channel,
msg.writeInt8(amount);
gameServerConnection->send(msg);
}
- else if (event.getType() == Mana::Event::DoSplit)
+ else if (event.getType() == Event::DoSplit)
{
int amount = event.getInt("amount", 1);
@@ -165,7 +165,7 @@ void InventoryHandler::event(Mana::Event::Channel channel,
gameServerConnection->send(msg);
}
}
- else if (event.getType() == Mana::Event::DoMove)
+ else if (event.getType() == Event::DoMove)
{
int newIndex = event.getInt("newIndex", -1);
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
index 5577e431..efa318ad 100644
--- a/src/net/manaserv/inventoryhandler.h
+++ b/src/net/manaserv/inventoryhandler.h
@@ -59,14 +59,14 @@ class EquipBackend : public Equipment::Backend
};
class InventoryHandler : public MessageHandler, Net::InventoryHandler,
- public Mana::Listener
+ public Listener
{
public:
InventoryHandler();
void handleMessage(Net::MessageIn &msg);
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
bool canSplit(const Item *item);
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp
index 2642067c..1c89f39f 100644
--- a/src/net/manaserv/npchandler.cpp
+++ b/src/net/manaserv/npchandler.cpp
@@ -62,12 +62,12 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
}
int npcId = being->getId(), count = 0;
- Mana::Event *event = 0;
+ Event *event = 0;
switch (msg.getId())
{
case GPMSG_NPC_CHOICE:
- event = new Mana::Event(Mana::Event::Menu);
+ event = new Event(Event::Menu);
event->setInt("id", npcId);
while (msg.getUnreadLength())
{
@@ -75,52 +75,52 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
event->setString("choice" + toString(count), msg.readString());
}
event->setInt("choiceCount", count);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case GPMSG_NPC_NUMBER:
- event = new Mana::Event(Mana::Event::IntegerInput);
+ event = new Event(Event::IntegerInput);
event->setInt("id", npcId);
event->setInt("min", msg.readInt32());
event->setInt("max", msg.readInt32());
event->setInt("default", msg.readInt32());
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case GPMSG_NPC_STRING:
- event = new Mana::Event(Mana::Event::StringInput);
+ event = new Event(Event::StringInput);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case GPMSG_NPC_POST:
- event = new Mana::Event(Mana::Event::Post);
+ event = new Event(Event::Post);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case GPMSG_NPC_ERROR:
- event = new Mana::Event(Mana::Event::End);
+ event = new Event(Event::End);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case GPMSG_NPC_MESSAGE:
- event = new Mana::Event(Mana::Event::Message);
+ event = new Event(Event::Message);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getUnreadLength()));
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
delete event;
- event = new Mana::Event(Mana::Event::Next);
+ event = new Event(Event::Next);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case GPMSG_NPC_CLOSE:
- event = new Mana::Event(Mana::Event::Close);
+ event = new Event(Event::Close);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
}
@@ -169,9 +169,9 @@ void NpcHandler::talk(int npcId)
msg.writeInt16(npcId);
gameServerConnection->send(msg);
- Mana::Event event(Mana::Event::TalkSent);
+ Event event(Event::TalkSent);
event.setInt("npcId", npcId);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::nextDialog(int npcId)
@@ -180,9 +180,9 @@ void NpcHandler::nextDialog(int npcId)
msg.writeInt16(npcId);
gameServerConnection->send(msg);
- Mana::Event event(Mana::Event::NextSent);
+ Event event(Event::NextSent);
event.setInt("npcId", npcId);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::closeDialog(int npcId)
@@ -191,9 +191,9 @@ void NpcHandler::closeDialog(int npcId)
msg.writeInt16(npcId);
gameServerConnection->send(msg);
- Mana::Event event(Mana::Event::CloseSent);
+ Event event(Event::CloseSent);
event.setInt("npcId", npcId);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::menuSelect(int npcId, int choice)
@@ -203,10 +203,10 @@ void NpcHandler::menuSelect(int npcId, int choice)
msg.writeInt8(choice);
gameServerConnection->send(msg);
- Mana::Event event(Mana::Event::MenuSent);
+ Event event(Event::MenuSent);
event.setInt("npcId", npcId);
event.setInt("choice", choice);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::integerInput(int npcId, int value)
@@ -216,10 +216,10 @@ void NpcHandler::integerInput(int npcId, int value)
msg.writeInt32(value);
gameServerConnection->send(msg);
- Mana::Event event(Mana::Event::IntegerInputSent);
+ Event event(Event::IntegerInputSent);
event.setInt("npcId", npcId);
event.setInt("value", value);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::stringInput(int npcId, const std::string &value)
@@ -229,10 +229,10 @@ void NpcHandler::stringInput(int npcId, const std::string &value)
msg.writeString(value);
gameServerConnection->send(msg);
- Mana::Event event(Mana::Event::StringInputSent);
+ Event event(Event::StringInputSent);
event.setInt("npcId", npcId);
event.setString("value", value);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::sendLetter(int npcId, const std::string &recipient,
@@ -243,11 +243,11 @@ void NpcHandler::sendLetter(int npcId, const std::string &recipient,
msg.writeString(text);
gameServerConnection->send(msg);
- Mana::Event event(Mana::Event::SendLetterSent);
+ Event event(Event::SendLetterSent);
event.setInt("npcId", npcId);
event.setString("recipient", recipient);
event.setString("text", text);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
} // namespace ManaServ
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 96d01e41..e86f9afa 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(Mana::Event::NpcChannel, Mana::Event::CloseAll);
+ Event::trigger(Event::NpcChannel, Event::CloseAll);
}
PlayerHandler::PlayerHandler()
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index a992b1a2..51974eb2 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -82,20 +82,20 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
break;
case 0x01:
{
- Mana::Event event(Mana::Event::WhisperError);
+ Event event(Event::WhisperError);
event.setString("nick", nick);
event.setString("error", strprintf(_("Whisper could "
"not be sent, %s is offline."), nick.c_str()));
- event.trigger(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
}
break;
case 0x02:
{
- Mana::Event event(Mana::Event::WhisperError);
+ Event event(Event::WhisperError);
event.setString("nick", nick);
event.setString("error", strprintf(_("Whisper could "
"not be sent, ignored by %s."), nick.c_str()));
- event.Event::trigger(Mana::Event::ChatChannel);
+ event.Event::trigger(Event::ChatChannel);
}
break;
}
@@ -115,10 +115,10 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
{
if (player_relations.hasPermission(nick, PlayerRelation::WHISPER))
{
- Mana::Event event(Mana::Event::Whisper);
+ Event event(Event::Whisper);
event.setString("nick", nick);
event.setString("message", chatMsg);
- event.trigger(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
}
}
else
@@ -174,13 +174,13 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
std::string reducedMessage = chatMsg;
chatMsg = removeColors(sender_name) + " : " + reducedMessage;
- Mana::Event event(Mana::Event::Being);
+ Event event(Event::Being);
event.setString("message", chatMsg);
event.setString("text", reducedMessage);
event.setString("nick", sender_name);
event.setInt("beingId", beingId);
event.setInt("permissions", perms);
- event.trigger(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
break;
}
@@ -205,7 +205,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
trim(chatMsg);
- Mana::Event event(Mana::Event::Player);
+ Event event(Event::Player);
event.setString("message", mes);
event.setString("text", chatMsg);
event.setString("nick", player_node->getName());
@@ -213,13 +213,13 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
event.setInt("permissions", player_relations.getDefault()
& (PlayerRelation::SPEECH_LOG
| PlayerRelation::SPEECH_FLOAT));
- event.trigger(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
}
else
{
- Mana::Event event(Mana::Event::Announcement);
+ Event event(Event::Announcement);
event.setString("message", chatMsg);
- event.trigger(Mana::Event::ChatChannel);
+ event.trigger(Event::ChatChannel);
}
break;
}
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index 79686953..0b3c7d38 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -58,7 +58,7 @@ GameHandler::GameHandler()
handledMessages = _messages;
gameHandler = this;
- listen(Mana::Event::GameChannel);
+ listen(Event::GameChannel);
}
void GameHandler::handleMessage(Net::MessageIn &msg)
@@ -105,15 +105,15 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
}
}
-void GameHandler::event(Mana::Event::Channel channel, const Mana::Event &event)
+void GameHandler::event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::GameChannel)
+ if (channel == Event::GameChannel)
{
- if (event.getType() == Mana::Event::EnginesInitialized)
+ if (event.getType() == Event::EnginesInitialized)
{
Game::instance()->changeMap(mMap);
}
- else if (event.getType() == Mana::Event::MapLoaded)
+ else if (event.getType() == Event::MapLoaded)
{
MessageOut outMsg(CMSG_MAP_LOADED);
}
diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h
index 858f16b3..b24bd42b 100644
--- a/src/net/tmwa/gamehandler.h
+++ b/src/net/tmwa/gamehandler.h
@@ -34,14 +34,14 @@
namespace TmwAthena {
class GameHandler : public MessageHandler, public Net::GameHandler,
- public Mana::Listener
+ public Listener
{
public:
GameHandler();
void handleMessage(Net::MessageIn &msg);
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
void connect();
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index d4374d4a..ef59ee12 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -108,7 +108,7 @@ GeneralHandler::GeneralHandler():
setStatsList(stats);
- listen(Mana::Event::GameChannel);
+ listen(Event::GameChannel);
}
GeneralHandler::~GeneralHandler()
@@ -217,12 +217,12 @@ void GeneralHandler::clearHandlers()
mNetwork->clearHandlers();
}
-void GeneralHandler::event(Mana::Event::Channel channel,
- const Mana::Event &event)
+void GeneralHandler::event(Event::Channel channel,
+ const Event &event)
{
- if (channel == Mana::Event::GameChannel)
+ if (channel == Event::GameChannel)
{
- if (event.getType() == Mana::Event::GuiWindowsLoaded)
+ if (event.getType() == Event::GuiWindowsLoaded)
{
inventoryWindow->setSplitAllowed(false);
skillDialog->loadSkills("ea-skills.xml");
@@ -242,7 +242,7 @@ void GeneralHandler::event(Mana::Event::Channel channel,
statusWindow->addAttribute(FLEE, _("% Evade"), false, "");
statusWindow->addAttribute(CRIT, _("% Critical"), false, "");
}
- else if (event.getType() == Mana::Event::GuiWindowsUnloading)
+ else if (event.getType() == Event::GuiWindowsUnloading)
{
socialWindow->removeTab(taGuild);
socialWindow->removeTab(taParty);
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index d7b5f743..a5f65e63 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -32,7 +32,7 @@
namespace TmwAthena {
class GeneralHandler : public MessageHandler, public Net::GeneralHandler,
- public Mana::Listener
+ public Listener
{
public:
GeneralHandler();
@@ -51,7 +51,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler,
void clearHandlers();
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
protected:
MessageHandlerPtr mAdminHandler;
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 6bba2afd..18e8febc 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -110,7 +110,7 @@ InventoryHandler::InventoryHandler()
mStorage = 0;
mStorageWindow = 0;
- listen(Mana::Event::ItemChannel);
+ listen(Event::ItemChannel);
}
InventoryHandler::~InventoryHandler()
@@ -431,12 +431,12 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
}
}
-void InventoryHandler::event(Mana::Event::Channel channel,
- const Mana::Event &event)
+void InventoryHandler::event(Event::Channel channel,
+ const Event &event)
{
- if (channel == Mana::Event::ItemChannel)
+ if (channel == Event::ItemChannel)
{
- if (event.getType() == Mana::Event::DoCloseInventory)
+ if (event.getType() == Event::DoCloseInventory)
{
// No need to worry about type
MessageOut outMsg(CMSG_CLOSE_STORAGE);
@@ -450,24 +450,24 @@ void InventoryHandler::event(Mana::Event::Channel channel,
int index = item->getInvIndex() + INVENTORY_OFFSET;
- if (event.getType() == Mana::Event::DoEquip)
+ if (event.getType() == Event::DoEquip)
{
MessageOut outMsg(CMSG_PLAYER_EQUIP);
outMsg.writeInt16(index);
outMsg.writeInt16(0);
}
- else if (event.getType() == Mana::Event::DoUnequip)
+ else if (event.getType() == Event::DoUnequip)
{
MessageOut outMsg(CMSG_PLAYER_UNEQUIP);
outMsg.writeInt16(index);
}
- else if (event.getType() == Mana::Event::DoUse)
+ else if (event.getType() == Event::DoUse)
{
MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE);
outMsg.writeInt16(index);
outMsg.writeInt32(item->getId()); // unused
}
- else if (event.getType() == Mana::Event::DoDrop)
+ else if (event.getType() == Event::DoDrop)
{
int amount = event.getInt("amount", 1);
@@ -477,7 +477,7 @@ void InventoryHandler::event(Mana::Event::Channel channel,
outMsg.writeInt16(index);
outMsg.writeInt16(amount);
}
- else if (event.getType() == Mana::Event::DoMove)
+ else if (event.getType() == Event::DoMove)
{
int newIndex = event.getInt("newIndex", -1);
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index 8edb34ad..afbdd7b4 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -119,7 +119,7 @@ class InventoryItem
typedef std::list<InventoryItem> InventoryItems;
class InventoryHandler : public MessageHandler, public Net::InventoryHandler,
- public Mana::Listener
+ public Listener
{
public:
enum {
@@ -133,7 +133,7 @@ class InventoryHandler : public MessageHandler, public Net::InventoryHandler,
void handleMessage(Net::MessageIn &msg);
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
bool canSplit(const Item *item);
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index a55a3183..092e3046 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -38,7 +38,7 @@
extern Net::NpcHandler *npcHandler;
-static void parseMenu(Mana::Event *event, const std::string &options)
+static void parseMenu(Event *event, const std::string &options)
{
std::istringstream iss(options);
@@ -78,50 +78,50 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
}
int npcId = msg.readInt32();
- Mana::Event *event = 0;
+ Event *event = 0;
switch (msg.getId())
{
case SMSG_NPC_CHOICE:
- event = new Mana::Event(Mana::Event::Menu);
+ event = new Event(Event::Menu);
event->setInt("id", npcId);
parseMenu(event, msg.readString(msg.getLength() - 8));
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_MESSAGE:
- event = new Mana::Event(Mana::Event::Message);
+ event = new Event(Event::Message);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getLength() - 8));
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_CLOSE:
// Show the close button
- event = new Mana::Event(Mana::Event::Close);
+ event = new Event(Event::Close);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_NEXT:
// Show the next button
- event = new Mana::Event(Mana::Event::Next);
+ event = new Event(Event::Next);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_INT_INPUT:
// Request for an integer
- event = new Mana::Event(Mana::Event::IntegerInput);
+ event = new Event(Event::IntegerInput);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_STR_INPUT:
// Request for a string
- event = new Mana::Event(Mana::Event::StringInput);
+ event = new Event(Event::StringInput);
event->setInt("id", npcId);
- event->trigger(Mana::Event::NpcChannel);
+ event->trigger(Event::NpcChannel);
break;
}
@@ -177,9 +177,9 @@ void NpcHandler::talk(int npcId)
outMsg.writeInt32(npcId);
outMsg.writeInt8(0); // Unused
- Mana::Event event(Mana::Event::TalkSent);
+ Event event(Event::TalkSent);
event.setInt("npcId", npcId);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::nextDialog(int npcId)
@@ -187,9 +187,9 @@ void NpcHandler::nextDialog(int npcId)
MessageOut outMsg(CMSG_NPC_NEXT_REQUEST);
outMsg.writeInt32(npcId);
- Mana::Event event(Mana::Event::NextSent);
+ Event event(Event::NextSent);
event.setInt("npcId", npcId);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::closeDialog(int npcId)
@@ -197,9 +197,9 @@ void NpcHandler::closeDialog(int npcId)
MessageOut outMsg(CMSG_NPC_CLOSE);
outMsg.writeInt32(npcId);
- Mana::Event event(Mana::Event::CloseSent);
+ Event event(Event::CloseSent);
event.setInt("npcId", npcId);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::menuSelect(int npcId, int choice)
@@ -208,10 +208,10 @@ void NpcHandler::menuSelect(int npcId, int choice)
outMsg.writeInt32(npcId);
outMsg.writeInt8(choice);
- Mana::Event event(Mana::Event::MenuSent);
+ Event event(Event::MenuSent);
event.setInt("npcId", npcId);
event.setInt("choice", choice);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::integerInput(int npcId, int value)
@@ -220,10 +220,10 @@ void NpcHandler::integerInput(int npcId, int value)
outMsg.writeInt32(npcId);
outMsg.writeInt32(value);
- Mana::Event event(Mana::Event::IntegerInputSent);
+ Event event(Event::IntegerInputSent);
event.setInt("npcId", npcId);
event.setInt("value", value);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
void NpcHandler::stringInput(int npcId, const std::string &value)
@@ -234,10 +234,10 @@ void NpcHandler::stringInput(int npcId, const std::string &value)
outMsg.writeString(value, value.length());
outMsg.writeInt8(0); // Prevent problems with string reading
- Mana::Event event(Mana::Event::StringInputSent);
+ Event event(Event::StringInputSent);
event.setInt("npcId", npcId);
event.setString("value", value);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(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 4b60414b..ec004917 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -81,7 +81,7 @@ namespace {
viewport->closePopupMenu();
- Mana::Event::trigger(Mana::Event::NpcChannel, Mana::Event::CloseAll);
+ Event::trigger(Event::NpcChannel, Event::CloseAll);
}
} deathListener;
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 80249784..69ba24af 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -191,7 +191,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
// Successfully added item
if (item->isEquippable() && item->isEquipped())
{
- item->doEvent(Mana::Event::DoUnequip);
+ item->doEvent(Event::DoUnequip);
}
tradeWindow->addItem(item->getId(), true, quantity);
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index 150a1ba1..4307ca56 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -57,17 +57,17 @@ int mLevelProgress = 0;
void triggerAttr(int id, int old)
{
- Mana::Event event(Mana::Event::UpdateAttribute);
+ Event event(Event::UpdateAttribute);
event.setInt("id", id);
event.setInt("oldValue", old);
event.setInt("newValue", mData.mAttributes.find(id)->second);
- event.trigger(Mana::Event::AttributesChannel);
+ event.trigger(Event::AttributesChannel);
}
void triggerStat(int id, const std::string &changed, int old1, int old2 = 0)
{
StatMap::iterator it = mData.mStats.find(id);
- Mana::Event event(Mana::Event::UpdateStat);
+ Event event(Event::UpdateStat);
event.setInt("id", id);
event.setInt("base", it->second.base);
event.setInt("mod", it->second.mod);
@@ -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(Mana::Event::AttributesChannel);
+ event.trigger(Event::AttributesChannel);
}
// --- Attributes -------------------------------------------------------------
@@ -215,10 +215,10 @@ void setStorageCount(int count)
if (count != old)
{
- Mana::Event event(Mana::Event::StorageCount);
+ Event event(Event::StorageCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
- event.trigger(Mana::Event::StorageChannel);
+ event.trigger(Event::StorageChannel);
}
}
@@ -236,10 +236,10 @@ void setNPCInteractionCount(int count)
if (count != old)
{
- Mana::Event event(Mana::Event::NpcCount);
+ Event event(Event::NpcCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
}
@@ -255,10 +255,10 @@ void setNPCPostCount(int count)
if (count != old)
{
- Mana::Event event(Mana::Event::PostCount);
+ Event event(Event::PostCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
- event.trigger(Mana::Event::NpcChannel);
+ event.trigger(Event::NpcChannel);
}
}
@@ -276,10 +276,10 @@ void setBuySellState(BuySellState buySellState)
if (buySellState != old)
{
- Mana::Event event(Mana::Event::StateChange);
+ Event event(Event::StateChange);
event.setInt("oldState", old);
event.setInt("newState", buySellState);
- event.trigger(Mana::Event::BuySellChannel);
+ event.trigger(Event::BuySellChannel);
}
}
@@ -295,9 +295,9 @@ void setTrading(bool trading)
if (notify)
{
- Mana::Event event(Mana::Event::Trading);
+ Event event(Event::Trading);
event.setBool("trading", trading);
- event.trigger(Mana::Event::StatusChannel);
+ event.trigger(Event::StatusChannel);
}
}
@@ -348,20 +348,20 @@ void logic()
mSpecialRechargeUpdateNeeded++;
}
-class PlayerLogic : Mana::Listener
+class PlayerLogic : Listener
{
public:
PlayerLogic()
{
- listen(Mana::Event::ClientChannel);
- listen(Mana::Event::GameChannel);
+ listen(Event::ClientChannel);
+ listen(Event::GameChannel);
}
- void event(Mana::Event::Channel channel, const Mana::Event &event)
+ void event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::ClientChannel)
+ if (channel == Event::ClientChannel)
{
- if (event.getType() == Mana::Event::StateChange)
+ if (event.getType() == Event::StateChange)
{
int newState = event.getInt("newState");
@@ -375,9 +375,9 @@ public:
}
}
}
- else if (channel == Mana::Event::GameChannel)
+ else if (channel == Event::GameChannel)
{
- if (event.getType() == Mana::Event::Destructed)
+ if (event.getType() == Event::Destructed)
{
delete mInventory;
delete mEquipment;
diff --git a/src/resources/theme.cpp b/src/resources/theme.cpp
index 0509681c..869f225c 100644
--- a/src/resources/theme.cpp
+++ b/src/resources/theme.cpp
@@ -111,7 +111,7 @@ Theme::Theme():
{
initDefaultThemePath();
- listen(Mana::Event::ConfigChannel);
+ listen(Event::ConfigChannel);
loadColors();
mColors[HIGHLIGHT].ch = 'H';
@@ -208,10 +208,10 @@ void Theme::updateAlpha()
iter->second->updateAlpha(mMinimumOpacity);
}
-void Theme::event(Mana::Event::Channel channel, const Mana::Event &event)
+void Theme::event(Event::Channel channel, const Event &event)
{
- if (channel == Mana::Event::ConfigChannel &&
- event.getType() == Mana::Event::ConfigOptionChanged &&
+ if (channel == Event::ConfigChannel &&
+ event.getType() == Event::ConfigOptionChanged &&
event.getString("option") == "guialpha")
{
updateAlpha();
diff --git a/src/resources/theme.h b/src/resources/theme.h
index 050e6d2d..179662bc 100644
--- a/src/resources/theme.h
+++ b/src/resources/theme.h
@@ -100,7 +100,7 @@ class Skin
Image *mStickyImageDown; /**< Sticky Button Image */
};
-class Theme : public Palette, public Mana::Listener
+class Theme : public Palette, public Listener
{
public:
static Theme *instance();
@@ -218,7 +218,7 @@ class Theme : public Palette, public Mana::Listener
*/
void setMinimumOpacity(float minimumOpacity);
- void event(Mana::Event::Channel channel, const Mana::Event &event);
+ void event(Event::Channel channel, const Event &event);
private:
Theme();
diff --git a/src/variabledata.h b/src/variabledata.h
index 19e09795..9bdb9db5 100644
--- a/src/variabledata.h
+++ b/src/variabledata.h
@@ -26,9 +26,6 @@
class ActorSprite;
class Item;
-namespace Mana
-{
-
class VariableData
{
public:
@@ -126,6 +123,4 @@ private:
ActorSprite *mData;
};
-} // namespace Mana
-
#endif