summaryrefslogtreecommitdiff
path: root/src/net/tmwa/npchandler.cpp
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/net/tmwa/npchandler.cpp
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/net/tmwa/npchandler.cpp')
-rw-r--r--src/net/tmwa/npchandler.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 1f85e9a6..1b12b63f 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -85,14 +85,14 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_NPC_CHOICE:
- event = new Mana::Event("Menu");
+ event = new Mana::Event(EVENT_MENU);
event->setInt("id", npcId);
parseMenu(event, msg.readString(msg.getLength() - 8));
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_MESSAGE:
- event = new Mana::Event("Message");
+ event = new Mana::Event(EVENT_MESSAGE);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getLength() - 8));
event->trigger(CHANNEL_NPC);
@@ -100,28 +100,28 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
case SMSG_NPC_CLOSE:
// Show the close button
- event = new Mana::Event("Close");
+ event = new Mana::Event(EVENT_CLOSE);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_NEXT:
// Show the next button
- event = new Mana::Event("Next");
+ event = new Mana::Event(EVENT_NEXT);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_INT_INPUT:
// Request for an integer
- event = new Mana::Event("IntegerInput");
+ event = new Mana::Event(EVENT_INTEGERINPUT);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_STR_INPUT:
// Request for a string
- event = new Mana::Event("StringInput");
+ event = new Mana::Event(EVENT_STRINGINPUT);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
@@ -137,35 +137,35 @@ void NpcHandler::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_NPC)
{
- if (event.getName() == "doTalk")
+ if (event.getName() == EVENT_DOTALK)
{
MessageOut outMsg(CMSG_NPC_TALK);
outMsg.writeInt32(event.getInt("npcId"));
outMsg.writeInt8(0); // Unused
}
- else if (event.getName() == "doNext")
+ else if (event.getName() == EVENT_DONEXT)
{
MessageOut outMsg(CMSG_NPC_NEXT_REQUEST);
outMsg.writeInt32(event.getInt("npcId"));
}
- else if (event.getName() == "doClose")
+ else if (event.getName() == EVENT_DOCLOSE)
{
MessageOut outMsg(CMSG_NPC_CLOSE);
outMsg.writeInt32(event.getInt("npcId"));
}
- else if (event.getName() == "doMenu")
+ else if (event.getName() == EVENT_DOMENU)
{
MessageOut outMsg(CMSG_NPC_LIST_CHOICE);
outMsg.writeInt32(event.getInt("npcId"));
outMsg.writeInt8(event.getInt("choice"));
}
- else if (event.getName() == "doIntegerInput")
+ else if (event.getName() == EVENT_DOINTEGERINPUT)
{
MessageOut outMsg(CMSG_NPC_INT_RESPONSE);
outMsg.writeInt32(event.getInt("npcId"));
outMsg.writeInt32(event.getInt("value"));
}
- else if (event.getName() == "doStringInput")
+ else if (event.getName() == EVENT_DOSTRINGINPUT)
{
const std::string &value = event.getString("value");
MessageOut outMsg(CMSG_NPC_STR_RESPONSE);