diff options
author | David Athay <ko2fan@gmail.com> | 2009-01-18 19:41:16 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-01-18 19:41:16 +0000 |
commit | 93f60007c1b5c203b71d32551278351385ea2bee (patch) | |
tree | 1983f0da9de01b94e7c616e1efd530360c650729 /src/npc.cpp | |
parent | 224da21ea258450fcc78dd7635de84aba1d1df5e (diff) | |
parent | ccef6c4284a9cc250da72c5835501ae03c2c513f (diff) | |
download | mana-client-93f60007c1b5c203b71d32551278351385ea2bee.tar.gz mana-client-93f60007c1b5c203b71d32551278351385ea2bee.tar.bz2 mana-client-93f60007c1b5c203b71d32551278351385ea2bee.tar.xz mana-client-93f60007c1b5c203b71d32551278351385ea2bee.zip |
Merge branch 'master' of git://gitorious.org/tmw/eathena
Diffstat (limited to 'src/npc.cpp')
-rw-r--r-- | src/npc.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/npc.cpp b/src/npc.cpp index 66048005..b107445a 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -80,14 +80,12 @@ void NPC::setName(const std::string &name) gcn::Color(200, 200, 255)); } -Being::Type -NPC::getType() const +Being::Type NPC::getType() const { return Being::NPC; } -void -NPC::talk() +void NPC::talk() { MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_TALK); @@ -96,16 +94,14 @@ NPC::talk() current_npc = this; } -void -NPC::nextDialog() +void NPC::nextDialog() { MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_NEXT_REQUEST); outMsg.writeInt32(mId); } -void -NPC::dialogChoice(char choice) +void NPC::dialogChoice(char choice) { MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_LIST_CHOICE); @@ -113,12 +109,29 @@ NPC::dialogChoice(char choice) outMsg.writeInt8(choice); } +void NPC::integerInput(int value) +{ + MessageOut outMsg(mNetwork); + outMsg.writeInt16(CMSG_NPC_INT_RESPONSE); + outMsg.writeInt32(mId); + outMsg.writeInt32(value); +} + +void NPC::stringInput(const std::string &value) +{ + MessageOut outMsg(mNetwork); + outMsg.writeInt16(CMSG_NPC_STR_RESPONSE); + outMsg.writeInt16(value.length() + 8); + outMsg.writeInt32(mId); + outMsg.writeString(value, value.length()); + outMsg.writeInt8(0); // Just to be safe +} + /* * TODO Unify the buy() and sell() methods, without sacrificing readability of * the code calling the method. buy(bool buySell) would be bad... */ -void -NPC::buy() +void NPC::buy() { MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST); @@ -126,8 +139,7 @@ NPC::buy() outMsg.writeInt8(0); } -void -NPC::sell() +void NPC::sell() { MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST); |