summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-24 15:23:26 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-24 15:23:26 +0300
commit38c7345e781e9f6e645f703ffe178849a2140301 (patch)
treefc62b7fc5b346cf755e5b33d3cf52b3550050838 /src
parenta1f5338e93e5f8b2bdac2c305824a925fd2e4141 (diff)
downloadManaVerse-38c7345e781e9f6e645f703ffe178849a2140301.tar.gz
ManaVerse-38c7345e781e9f6e645f703ffe178849a2140301.tar.bz2
ManaVerse-38c7345e781e9f6e645f703ffe178849a2140301.tar.xz
ManaVerse-38c7345e781e9f6e645f703ffe178849a2140301.zip
add support for warp pets if distance very long.
New pet db option: warpDistance
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp9
-rw-r--r--src/resources/beinginfo.cpp1
-rw-r--r--src/resources/beinginfo.h7
-rw-r--r--src/resources/db/petdb.cpp3
4 files changed, 19 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 2da3c644f..90c5cb316 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1630,10 +1630,17 @@ void Being::petLogic()
int dstX = dstX0;
int dstY = dstY0;
const int followDist = mInfo->getStartFollowDist();
+ const int warpDist = mInfo->getWarpDist();
const int dist = mInfo->getFollowDist();
const int divX = abs(dstX - mX);
const int divY = abs(dstY - mY);
- if (divX > followDist || divY > followDist)
+
+ if (divX >= warpDist || divY >= warpDist)
+ {
+ setAction(Being::STAND, 0);
+ setTileCoords(dstX0, dstY0);
+ }
+ else if (divX > followDist || divY > followDist)
{
if (divX > followDist)
{
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 7d769acbe..752b9a5dc 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -62,6 +62,7 @@ BeingInfo::BeingInfo() :
mHeight(0),
mStartFollowDist(3),
mFollowDist(1),
+ mWarpDist(11),
mWalkSpeed(0),
mStaticMaxHP(false),
mTargetSelection(true)
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 556088380..b776c20ff 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -242,6 +242,12 @@ class BeingInfo final
int getWalkSpeed()
{ return mWalkSpeed; }
+ void setWarpDist(const int n)
+ { mWarpDist = n; }
+
+ int getWarpDist()
+ { return mWarpDist; }
+
void setColorsList(const std::string &name);
std::string getColor(const int idx) const;
@@ -274,6 +280,7 @@ class BeingInfo final
int mHeight;
int mStartFollowDist;
int mFollowDist;
+ int mWarpDist;
int mWalkSpeed;
bool mStaticMaxHP;
bool mTargetSelection;
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 0af2621ae..397af6220 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -86,10 +86,13 @@ void PETDB::load()
"startFollowDistance", 3));
currentInfo->setFollowDist(XML::getProperty(petNode,
"followDistance", 1));
+ currentInfo->setWarpDist(XML::getProperty(petNode,
+ "warpDistance", 11));
currentInfo->setWalkSpeed(XML::getProperty(petNode,
"walkSpeed", 0));
+
SpriteDisplay display;
for_each_xml_child_node(spriteNode, petNode)
{