summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-28 00:11:59 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-28 00:11:59 +0300
commit4e7669dd6e07658fa86878d1e64c482a094b3b19 (patch)
tree8ffc8cb8621fef8a40615ef17e7b39abd885a000
parenta065831539e63dc6e25f4743b3a548aadf92304a (diff)
downloadmanaverse-4e7669dd6e07658fa86878d1e64c482a094b3b19.tar.gz
manaverse-4e7669dd6e07658fa86878d1e64c482a094b3b19.tar.bz2
manaverse-4e7669dd6e07658fa86878d1e64c482a094b3b19.tar.xz
manaverse-4e7669dd6e07658fa86878d1e64c482a094b3b19.zip
Add fake pet moving commands.
Actual moving will be implimented after.
-rw-r--r--src/actions/pets.cpp47
-rw-r--r--src/actions/pets.h4
-rw-r--r--src/being/being.cpp1
-rw-r--r--src/input/inputaction.h4
-rw-r--r--src/input/inputactionmap.h36
-rw-r--r--src/net/eathena/pethandler.cpp6
-rw-r--r--src/net/eathena/pethandler.h6
-rw-r--r--src/net/pethandler.h6
-rw-r--r--src/net/tmwa/pethandler.cpp6
-rw-r--r--src/net/tmwa/pethandler.h6
10 files changed, 101 insertions, 21 deletions
diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp
index 30cfc9613..e30e7f529 100644
--- a/src/actions/pets.cpp
+++ b/src/actions/pets.cpp
@@ -62,6 +62,17 @@
namespace Actions
{
+static const Being *getPet()
+{
+ if (!localPlayer)
+ return nullptr;
+
+ const std::vector<Being*> &pets = localPlayer->getPets();
+ if (pets.empty())
+ return nullptr;
+ return *pets.begin();
+}
+
impHandler(commandEmotePet)
{
// need use actual pet id
@@ -130,4 +141,40 @@ impHandler(catchPet)
return true;
}
+impHandler0(petMoveUp)
+{
+ const Being *const pet = getPet();
+ if (!pet)
+ return false;
+ petHandler->move(pet->getId(), pet->getTileX(), pet->getTileY() - 1);
+ return true;
+}
+
+impHandler0(petMoveDown)
+{
+ const Being *const pet = getPet();
+ if (!pet)
+ return false;
+ petHandler->move(pet->getId(), pet->getTileX(), pet->getTileY() + 1);
+ return true;
+}
+
+impHandler0(petMoveLeft)
+{
+ const Being *const pet = getPet();
+ if (!pet)
+ return false;
+ petHandler->move(pet->getId(), pet->getTileX() - 1, pet->getTileY());
+ return true;
+}
+
+impHandler0(petMoveRight)
+{
+ const Being *const pet = getPet();
+ if (!pet)
+ return false;
+ petHandler->move(pet->getId(), pet->getTileX() + 1, pet->getTileY());
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/pets.h b/src/actions/pets.h
index e0521b546..37bd85713 100644
--- a/src/actions/pets.h
+++ b/src/actions/pets.h
@@ -32,6 +32,10 @@ namespace Actions
decHandler(setPetName);
decHandler(petEmote);
decHandler(catchPet);
+ decHandler(petMoveUp);
+ decHandler(petMoveDown);
+ decHandler(petMoveLeft);
+ decHandler(petMoveRight);
} // namespace Actions
#undef decHandler
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 70a71d960..289f49411 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1642,7 +1642,6 @@ void Being::petLogic()
if (mX != dstX || mY != dstY)
{
setPath(mMap->findPath(mX, mY, dstX, dstY, blockWalkMask));
- petHandler->move(mOwner, mId, mX, mY, dstX, dstY);
return;
}
}
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 7e330f909..67ac8f446 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -516,6 +516,10 @@ namespace InputAction
LEAVE_PARTY,
WARP,
CLEAR_CHAT,
+ PET_MOVE_UP,
+ PET_MOVE_DOWN,
+ PET_MOVE_LEFT,
+ PET_MOVE_RIGHT,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 4c1c6d986..4dc84bb71 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -4388,6 +4388,42 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputCondition::INGAME,
"clearchat|chatclear",
false},
+ {"keyPetMoveUp",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::petMoveUp,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "petmoveup|moveuppet",
+ false},
+ {"keyPetMoveDown",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::petMoveDown,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "petmovedown|movedownpet",
+ false},
+ {"keyPetMoveLeft",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::petMoveLeft,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "petmoveleft|moveleftpet",
+ false},
+ {"keyPetMoveRight",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::petMoveRight,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "petmoveright|moverightpet",
+ false},
};
#endif // INPUT_INPUTACTIONMAP_H
diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp
index 41b69550c..9c78787cf 100644
--- a/src/net/eathena/pethandler.cpp
+++ b/src/net/eathena/pethandler.cpp
@@ -108,10 +108,8 @@ void PetHandler::handleMessage(Net::MessageIn &msg)
BLOCK_END("PetHandler::handleMessage")
}
-void PetHandler::move(const Being *const being A_UNUSED,
- const int petId A_UNUSED,
- const int x1 A_UNUSED, const int y1 A_UNUSED,
- const int x2 A_UNUSED, const int y2 A_UNUSED) const
+void PetHandler::move(const int petId A_UNUSED,
+ const int x A_UNUSED, const int y A_UNUSED) const
{
}
diff --git a/src/net/eathena/pethandler.h b/src/net/eathena/pethandler.h
index 982fb501a..42a03452b 100644
--- a/src/net/eathena/pethandler.h
+++ b/src/net/eathena/pethandler.h
@@ -37,10 +37,8 @@ class PetHandler final : public MessageHandler, public Net::PetHandler
void handleMessage(Net::MessageIn &msg) override final;
- void move(const Being *const being,
- const int petId,
- const int x1, const int y1,
- const int x2, const int y2) const override final;
+ void move(const int petId,
+ const int x, const int y) const override final;
void spawn(const Being *const being,
const int petId,
diff --git a/src/net/pethandler.h b/src/net/pethandler.h
index 914065593..1eaf011d8 100644
--- a/src/net/pethandler.h
+++ b/src/net/pethandler.h
@@ -32,10 +32,8 @@ class PetHandler notfinal
virtual ~PetHandler()
{ }
- virtual void move(const Being *const being,
- const int petId,
- const int x1, const int y1,
- const int x2, const int y2) const = 0;
+ virtual void move(const int petId,
+ const int x, const int y) const = 0;
virtual void spawn(const Being *const being,
const int petId,
diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp
index 1f278e016..eba2f4093 100644
--- a/src/net/tmwa/pethandler.cpp
+++ b/src/net/tmwa/pethandler.cpp
@@ -51,10 +51,8 @@ void PetHandler::handleMessage(Net::MessageIn &msg A_UNUSED)
BLOCK_END("PetHandler::handleMessage")
}
-void PetHandler::move(const Being *const being A_UNUSED,
- const int petId A_UNUSED,
- const int x1 A_UNUSED, const int y1 A_UNUSED,
- const int x2 A_UNUSED, const int y2 A_UNUSED) const
+void PetHandler::move(const int petId A_UNUSED,
+ const int x A_UNUSED, const int y A_UNUSED) const
{
}
diff --git a/src/net/tmwa/pethandler.h b/src/net/tmwa/pethandler.h
index 31822d3d5..fa46256c2 100644
--- a/src/net/tmwa/pethandler.h
+++ b/src/net/tmwa/pethandler.h
@@ -37,10 +37,8 @@ class PetHandler final : public MessageHandler, public Net::PetHandler
void handleMessage(Net::MessageIn &msg) override final;
- void move(const Being *const being,
- const int petId,
- const int x1, const int y1,
- const int x2, const int y2) const override final;
+ void move(const int petId,
+ const int x, const int y) const override final;
void spawn(const Being *const being,
const int petId,