summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-11-11 23:12:29 -0500
committerChuck Miller <shadowmil@gmail.com>2010-11-11 23:12:29 -0500
commita4640305fd0d88c6332112712aa69e496368e01b (patch)
tree0f039b331026ca2b9718a920b24e2344f9e56b25 /src/gui
parent5727a2d9eeb0688a16e5b7fe32f6d9836c4f7a4e (diff)
downloadmana-a4640305fd0d88c6332112712aa69e496368e01b.tar.gz
mana-a4640305fd0d88c6332112712aa69e496368e01b.tar.bz2
mana-a4640305fd0d88c6332112712aa69e496368e01b.tar.xz
mana-a4640305fd0d88c6332112712aa69e496368e01b.zip
Replace Event names with enums instead of strings
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp12
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/inventorywindow.cpp16
-rw-r--r--src/gui/itemamount.cpp8
-rw-r--r--src/gui/ministatus.cpp4
-rw-r--r--src/gui/npcdialog.cpp32
-rw-r--r--src/gui/npcpostdialog.cpp2
-rw-r--r--src/gui/outfitwindow.cpp4
-rw-r--r--src/gui/popupmenu.cpp6
-rw-r--r--src/gui/statuswindow.cpp4
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp6
12 files changed, 49 insertions, 49 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 280d4d15..7acb7de8 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -379,29 +379,29 @@ void ChatWindow::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_NOTICES)
{
- if (event.getName() == "ServerNotice")
+ if (event.getName() == EVENT_SERVERNOTICE)
localChatTab->chatLog(event.getString("message"), BY_SERVER);
}
else if (channel == CHANNEL_CHAT)
{
- if (event.getName() == "Whisper")
+ if (event.getName() == EVENT_WHISPER)
{
whisper(event.getString("nick"), event.getString("message"));
}
- else if (event.getName() == "WhisperError")
+ else if (event.getName() == EVENT_WHISPERERROR)
{
whisper(event.getString("nick"),
event.getString("error"), BY_SERVER);
}
- else if (event.getName() == "Player")
+ else if (event.getName() == EVENT_PLAYER)
{
localChatTab->chatLog(event.getString("message"), BY_PLAYER);
}
- else if (event.getName() == "Announcement")
+ else if (event.getName() == EVENT_ANNOUNCEMENT)
{
localChatTab->chatLog(event.getString("message"), BY_GM);
}
- else if (event.getName() == "Being")
+ else if (event.getName() == EVENT_BEING)
{
if (event.getInt("permissions") & PlayerRelation::SPEECH_LOG)
localChatTab->chatLog(event.getString("message"), BY_OTHER);
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 474a9cb6..aeeaf223 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -158,7 +158,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "unequip" && mSelected > -1)
{
Item *item = mEquipment->getEquipment(mSelected);
- item->doEvent("doUnequip");
+ item->doEvent(EVENT_DOUNEQUIP);
setSelected(-1);
}
}
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index fab87844..31743c57 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -186,19 +186,19 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
return;
if (event.getId() == "activate")
- item->doEvent("doUse");
+ item->doEvent(EVENT_DOUSE);
else if (event.getId() == "equip")
{
if (item->isEquippable())
{
if (item->isEquipped())
- item->doEvent("doUnequip");
+ item->doEvent(EVENT_DOUNEQUIP);
else
- item->doEvent("doEquip");
+ item->doEvent(EVENT_DOEQUIP);
}
else
{
- item->doEvent("doUse");
+ item->doEvent(EVENT_DOUSE);
}
}
else if (event.getId() == "drop")
@@ -256,7 +256,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
return;
if (mInventory->isMainInventory())
{
- Mana::Event event("doMove");
+ Mana::Event event(EVENT_DOMOVE);
event.setItem("item", item);
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::INVENTORY);
@@ -265,7 +265,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
}
else
{
- Mana::Event event("doMove");
+ Mana::Event event(EVENT_DOMOVE);
event.setItem("item", item);
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::STORAGE);
@@ -368,7 +368,7 @@ void InventoryWindow::close()
}
else
{
- Mana::Event event("doCloseInventory");
+ Mana::Event event(EVENT_DOCLOSEINVENTORY);
event.setInt("type", mInventory->getType());
event.trigger(CHANNEL_ITEM);
scheduleDelete();
@@ -377,7 +377,7 @@ void InventoryWindow::close()
void InventoryWindow::event(Channels channel, const Mana::Event &event)
{
- if (event.getName() == "UpdateAttribute")
+ if (event.getName() == EVENT_UPDATEATTRIBUTE)
{
int id = event.getInt("id");
if (id == TOTAL_WEIGHT ||
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index bb8f95d0..85325c66 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -47,14 +47,14 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
tradeWindow->tradeItem(item, amount);
break;
case ItemDrop:
- item->doEvent("doDrop", amount);
+ item->doEvent(EVENT_DODROP, amount);
break;
case ItemSplit:
- item->doEvent("doSplit", amount);
+ item->doEvent(EVENT_DOSPLIT, amount);
break;
case StoreAdd:
{
- Mana::Event event("doMove");
+ Mana::Event event(EVENT_DOMOVE);
event.setItem("item", item);
event.setInt("amount", amount);
event.setInt("source", Inventory::INVENTORY);
@@ -64,7 +64,7 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
break;
case StoreRemove:
{
- Mana::Event event("doMove");
+ Mana::Event event(EVENT_DOMOVE);
event.setItem("item", item);
event.setInt("amount", amount);
event.setInt("source", Inventory::STORAGE);
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index ab01dbbd..fae40d03 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -123,7 +123,7 @@ void MiniStatusWindow::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_ATTRIBUTES)
{
- if (event.getName() == "UpdateAttribute")
+ if (event.getName() == EVENT_UPDATEATTRIBUTE)
{
int id = event.getInt("id");
if (id == HP || id == MAX_HP)
@@ -142,7 +142,7 @@ void MiniStatusWindow::event(Channels channel, const Mana::Event &event)
}
else if (channel == CHANNEL_ACTORSPRITE)
{
- if (event.getName() == "UpdateStatusEffect")
+ if (event.getName() == EVENT_UPDATESTATUSEFFECT)
{
int index = event.getInt("index");
bool newStatus = event.getBool("newStatus");
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index f565a13f..33c18eca 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -225,7 +225,7 @@ void NpcDialog::action(const gcn::ActionEvent &event)
printText = mItems[selectedIndex];
- NpcEvent("doMenu")
+ NpcEvent(EVENT_DOMENU)
event.setInt("choice", selectedIndex + 1);
event.trigger(CHANNEL_NPC);
}
@@ -233,7 +233,7 @@ void NpcDialog::action(const gcn::ActionEvent &event)
{
printText = mTextField->getText();
- NpcEvent("doStringInput")
+ NpcEvent(EVENT_DOSTRINGINPUT)
event.setString("value", printText);
event.trigger(CHANNEL_NPC);
}
@@ -241,7 +241,7 @@ void NpcDialog::action(const gcn::ActionEvent &event)
{
printText = strprintf("%d", mIntField->getValue());
- NpcEvent("doIntegerInput")
+ NpcEvent(EVENT_DOINTEGERINPUT)
event.setInt("value", mIntField->getValue());
event.trigger(CHANNEL_NPC);
}
@@ -281,13 +281,13 @@ void NpcDialog::action(const gcn::ActionEvent &event)
void NpcDialog::nextDialog()
{
- NpcEvent("doNext");
+ NpcEvent(EVENT_DONEXT);
event.trigger(CHANNEL_NPC);
}
void NpcDialog::closeDialog()
{
- NpcEvent("doClose");
+ NpcEvent(EVENT_DOCLOSE);
event.trigger(CHANNEL_NPC);
close();
}
@@ -512,13 +512,13 @@ void NpcEventListener::event(Channels channel,
if (channel != CHANNEL_NPC)
return;
- if (event.getName() == "Message")
+ if (event.getName() == EVENT_MESSAGE)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
dialog->addText(event.getString("text"));
}
- else if (event.getName() == "Menu")
+ else if (event.getName() == EVENT_MENU)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -528,7 +528,7 @@ void NpcEventListener::event(Channels channel,
for (int i = 1; i <= count; i++)
dialog->addChoice(event.getString("choice" + toString(i)));
}
- else if (event.getName() == "IntegerInput")
+ else if (event.getName() == EVENT_INTEGERINPUT)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -538,7 +538,7 @@ void NpcEventListener::event(Channels channel,
dialog->integerRequest(defaultValue, min, max);
}
- else if (event.getName() == "StringInput")
+ else if (event.getName() == EVENT_STRINGINPUT)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -551,7 +551,7 @@ void NpcEventListener::event(Channels channel,
dialog->textRequest("");
}
}
- else if (event.getName() == "Next")
+ else if (event.getName() == EVENT_NEXT)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -559,14 +559,14 @@ void NpcEventListener::event(Channels channel,
if (!dialog)
{
int mNpcId = id;
- NpcEvent("doNext");
+ NpcEvent(EVENT_DONEXT);
event.trigger(CHANNEL_NPC);
return;
}
dialog->showNextButton();
}
- else if (event.getName() == "Close")
+ else if (event.getName() == EVENT_CLOSE)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -574,18 +574,18 @@ void NpcEventListener::event(Channels channel,
if (!dialog)
{
int mNpcId = id;
- NpcEvent("doClose");
+ NpcEvent(EVENT_DOCLOSE);
event.trigger(CHANNEL_NPC);
return;
}
dialog->showCloseButton();
}
- else if (event.getName() == "CloseAll")
+ else if (event.getName() == EVENT_CLOSEALL)
{
NpcDialog::closeAll();
}
- else if (event.getName() == "End")
+ else if (event.getName() == EVENT_END)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -593,7 +593,7 @@ void NpcEventListener::event(Channels channel,
if (dialog)
dialog->close();
}
- else if (event.getName() == "Post")
+ else if (event.getName() == EVENT_POST)
{
new NpcPostDialog(event.getInt("id"));
}
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index a4740027..7a85dda5 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -97,7 +97,7 @@ void NpcPostDialog::action(const gcn::ActionEvent &event)
}
else
{
- Mana::Event event("doSendLetter");
+ Mana::Event event(EVENT_DOSENDLETTER);
event.setInt("npcId", mNpcId);
event.setString("recipient", mSender->getText());
event.setString("text", mText->getText());
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 7e126dc8..8da8914a 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("doEquip");
+ item->doEvent(EVENT_DOEQUIP);
}
}
}
@@ -341,7 +341,7 @@ void OutfitWindow::unequipNotInOutfit(int outfit)
Item *item = inventory->getItem(i);
if (item)
- item->doEvent("doUnequip");
+ item->doEvent(EVENT_DOUNEQUIP);
}
}
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 3d389374..8ff638c2 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("doUnequip");
+ mItem->doEvent(EVENT_DOUNEQUIP);
else
- mItem->doEvent("doEquip");
+ mItem->doEvent(EVENT_DOEQUIP);
}
else
{
- mItem->doEvent("doUse");
+ mItem->doEvent(EVENT_DOUSE);
}
}
else if (link == "chat")
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 654d2bf3..a3420f06 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -219,7 +219,7 @@ StatusWindow::StatusWindow():
void StatusWindow::event(Channels channel, const Mana::Event &event)
{
- if (event.getName() == "UpdateAttribute")
+ if (event.getName() == EVENT_UPDATEATTRIBUTE)
{
switch(event.getInt("id"))
{
@@ -265,7 +265,7 @@ void StatusWindow::event(Channels channel, const Mana::Event &event)
break;
}
}
- else if (event.getName() == "UpdateStat")
+ else if (event.getName() == EVENT_UPDATESTAT)
{
int id = event.getInt("id");
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 6cef33a1..4152bd95 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -558,7 +558,7 @@ void Viewport::hideBeingPopup()
void Viewport::event(Channels channel, const Mana::Event &event)
{
- if (channel == CHANNEL_ACTORSPRITE && event.getName() == "Destroyed")
+ if (channel == CHANNEL_ACTORSPRITE && event.getName() == EVENT_DESTROYED)
{
ActorSprite *actor = event.getActor("source");
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index bf0272ee..2e9b698d 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -308,7 +308,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
Item *item = getSelectedItem();
{
- Mana::Event event("doMove");
+ Mana::Event event(EVENT_DOMOVE);
event.setItem("item", item);
event.setInt("newIndex", index);
event.trigger(CHANNEL_ITEM);
@@ -380,7 +380,7 @@ void ItemContainer::keyAction()
mHighlightedIndex != -1)
{
Item *item = getSelectedItem();
- Mana::Event event("doMove");
+ Mana::Event event(EVENT_DOMOVE);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
event.trigger(CHANNEL_ITEM);
@@ -396,7 +396,7 @@ void ItemContainer::keyAction()
else if (mSelectedIndex != -1)
{
Item *item = getSelectedItem();
- Mana::Event event("doMove");
+ Mana::Event event(EVENT_DOMOVE);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
event.trigger(CHANNEL_ITEM);