From 7e3bd20e9675202e30fac741f3d3acb4f19b109d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 9 Apr 2011 19:49:14 +0300 Subject: Small refactoring based on idea from mana commit 30d4b0adf4f17f05d1d62fc3428c896ef1079b6b --- src/gui/chatwindow.cpp | 14 +++++++------- src/gui/chatwindow.h | 2 +- src/gui/inventorywindow.cpp | 6 +++--- src/gui/inventorywindow.h | 2 +- src/gui/killstats.cpp | 6 +++--- src/gui/killstats.h | 2 +- src/gui/ministatus.cpp | 8 ++++---- src/gui/ministatus.h | 2 +- src/gui/statuswindow.cpp | 8 ++++---- src/gui/statuswindow.h | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/gui') diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 47db83c75..372461b29 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -154,7 +154,7 @@ ChatWindow::ChatWindow(): mChatHistoryIndex(0) { listen(CHANNEL_NOTICES); - listen(CHANNEL_ATTRIBUTES); + listen(Mana::CHANNEL_ATTRIBUTES); setWindowName("Chat"); @@ -798,19 +798,19 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) addInputText(Temp, false); } -void ChatWindow::event(Channels channel, const Mana::Event &event) +void ChatWindow::event(Mana::Channels channel, const Mana::Event &event) { - if (channel == CHANNEL_NOTICES) + if (channel == Mana::CHANNEL_NOTICES) { - if (event.getName() == EVENT_SERVERNOTICE && localChatTab) + if (event.getName() == Mana::EVENT_SERVERNOTICE && localChatTab) localChatTab->chatLog(event.getString("message"), BY_SERVER); } - else if (channel == CHANNEL_ATTRIBUTES) + else if (channel == Mana::CHANNEL_ATTRIBUTES) { if (!config.getBoolValue("showBattleEvents")) return; - if (event.getName() == EVENT_UPDATEATTRIBUTE) + if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -834,7 +834,7 @@ void ChatWindow::event(Channels channel, const Mana::Event &event) break; }; } - else if (event.getName() == EVENT_UPDATESTAT) + else if (event.getName() == Mana::EVENT_UPDATESTAT) { if (!config.getBoolValue("showJobExp")) return; diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index d8457d691..d22aea64c 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -191,7 +191,7 @@ class ChatWindow : public Window, */ void mousePressed(gcn::MouseEvent &event); - void event(Channels channel, const Mana::Event &event); + void event(Mana::Channels channel, const Mana::Event &event); /** * Scrolls the chat window diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index b897ad4b8..403868cd1 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -78,7 +78,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): setWindowName("Inventory"); } - listen(CHANNEL_ATTRIBUTES); + listen(Mana::CHANNEL_ATTRIBUTES); if (setupWindow) setupWindow->registerWindowForReset(this); @@ -493,10 +493,10 @@ void InventoryWindow::close() } } -void InventoryWindow::event(Channels channel _UNUSED_, +void InventoryWindow::event(Mana::Channels channel _UNUSED_, const Mana::Event &event) { - if (event.getName() == EVENT_UPDATEATTRIBUTE) + if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == TOTAL_WEIGHT || id == MAX_WEIGHT) diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index de899afb8..63da97173 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -124,7 +124,7 @@ class InventoryWindow : public Window, void updateDropButton(); - void event(Channels channel, const Mana::Event &event); + void event(Mana::Channels channel, const Mana::Event &event); private: /** diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index e373153e6..1486fdd64 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -54,7 +54,7 @@ KillStats::KillStats(): setResizable(true); setDefaultSize(250, 250, 350, 300); - listen(CHANNEL_ATTRIBUTES); + listen(Mana::CHANNEL_ATTRIBUTES); int xp(PlayerInfo::getAttribute(EXP)); int xpNextLevel(PlayerInfo::getAttribute(EXP_NEEDED)); @@ -409,10 +409,10 @@ void KillStats::validateJacko() } } -void KillStats::event(Channels channel _UNUSED_, +void KillStats::event(Mana::Channels channel _UNUSED_, const Mana::Event &event) { - if (event.getName() == EVENT_UPDATEATTRIBUTE) + if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == EXP || id == EXP_NEEDED) diff --git a/src/gui/killstats.h b/src/gui/killstats.h index df53aa319..59b1ff653 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -77,7 +77,7 @@ class KillStats : public Window, gcn::ActionListener, public Mana::Listener void addLog(std::string str); - void event(Channels channel _UNUSED_, + void event(Mana::Channels channel _UNUSED_, const Mana::Event &event); private: diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index e0103f080..213693e0a 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -51,7 +51,7 @@ extern volatile int tick_time; MiniStatusWindow::MiniStatusWindow(): Popup("MiniStatus") { - listen(CHANNEL_ATTRIBUTES); + listen(Mana::CHANNEL_ATTRIBUTES); mHpBar = createBar(0, 100, 20, Theme::PROG_HP, "hp bar", _("health bar")); StatusWindow::updateHPBar(mHpBar); @@ -209,10 +209,10 @@ void MiniStatusWindow::drawIcons(Graphics *graphics) } } -void MiniStatusWindow::event(Channels channel _UNUSED_, +void MiniStatusWindow::event(Mana::Channels channel _UNUSED_, const Mana::Event &event) { - if (event.getName() == EVENT_UPDATEATTRIBUTE) + if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == HP || id == MAX_HP) @@ -226,7 +226,7 @@ void MiniStatusWindow::event(Channels channel _UNUSED_, else if (id == MONEY) StatusWindow::updateMoneyBar(mMoneyBar); } - else if (event.getName() == EVENT_UPDATESTAT) + else if (event.getName() == Mana::EVENT_UPDATESTAT) { StatusWindow::updateMPBar(mMpBar); StatusWindow::updateJobBar(mJobBar); diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h index 9a88a3d7d..a2648d44b 100644 --- a/src/gui/ministatus.h +++ b/src/gui/ministatus.h @@ -66,7 +66,7 @@ class MiniStatusWindow : public Popup, void drawIcons(Graphics *graphics); - void event(Channels channel, const Mana::Event &event); + void event(Mana::Channels channel, const Mana::Event &event); void updateStatus(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 19ec14a50..82c97ff43 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -114,7 +114,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener StatusWindow::StatusWindow(): Window(player_node ? player_node->getName() : "?") { - listen(CHANNEL_ATTRIBUTES); + listen(Mana::CHANNEL_ATTRIBUTES); setWindowName("Status"); setupWindow->registerWindowForReset(this); @@ -260,14 +260,14 @@ StatusWindow::StatusWindow(): mLvlLabel->adjustSize(); } -void StatusWindow::event(Channels channel _UNUSED_, +void StatusWindow::event(Mana::Channels channel _UNUSED_, const Mana::Event &event) { static bool blocked = false; if (blocked) return; - if (event.getName() == EVENT_UPDATEATTRIBUTE) + if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { switch(event.getInt("id")) { @@ -326,7 +326,7 @@ void StatusWindow::event(Channels channel _UNUSED_, break; } } - else if (event.getName() == EVENT_UPDATESTAT) + else if (event.getName() == Mana::EVENT_UPDATESTAT) { int id = event.getInt("id"); if (id == Net::getPlayerHandler()->getJobLocation()) diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index f9837ba26..79126a095 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -56,7 +56,7 @@ class StatusWindow : public Window, public Mana::Listener */ StatusWindow(); - void event(Channels channel, const Mana::Event &event); + void event(Mana::Channels channel, const Mana::Event &event); void setPointsNeeded(int id, int needed); -- cgit v1.2.3-60-g2f50