diff options
author | Philipp Sehmisch <crush@themanaworld.org> | 2009-01-18 23:12:15 +0100 |
---|---|---|
committer | Philipp Sehmisch <crush@themanaworld.org> | 2009-01-18 23:12:15 +0100 |
commit | a10cebb21bdd211716628039b406362f2168c852 (patch) | |
tree | f8776ca56b5972b1ae6bae31e84b12d37019d41a /src/npc.cpp | |
parent | f4abf6b94adf53db7a053f7c342cc79f69a03262 (diff) | |
parent | a2c136d3ae4f192f30ea229c4a313bc528e26c90 (diff) | |
download | mana-client-a10cebb21bdd211716628039b406362f2168c852.tar.gz mana-client-a10cebb21bdd211716628039b406362f2168c852.tar.bz2 mana-client-a10cebb21bdd211716628039b406362f2168c852.tar.xz mana-client-a10cebb21bdd211716628039b406362f2168c852.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); |