summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-02 17:50:42 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-02 17:50:42 +0200
commit9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf (patch)
treec9791797f079c73213f39bd8c9b69c1e80da9c23 /src/Mobs/Monster.cpp
parentMerge pull request #1928 from SafwatHalaby/contrib (diff)
parentPathFinding - Chunk querying optimization and improve cPath::IsSolid (diff)
downloadcuberite-9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf.tar
cuberite-9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf.tar.gz
cuberite-9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf.tar.bz2
cuberite-9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf.tar.lz
cuberite-9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf.tar.xz
cuberite-9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf.tar.zst
cuberite-9226bdbd4c3dafe7b35f5e82a452b5ee6e8b44cf.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 2c557532c..9b9bec51e 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -121,7 +121,7 @@ void cMonster::SpawnOn(cClientHandle & a_Client)
-void cMonster::TickPathFinding()
+void cMonster::TickPathFinding(cChunk & a_Chunk)
{
if (m_Path == nullptr)
@@ -131,12 +131,12 @@ void cMonster::TickPathFinding()
// Can someone explain why are these two NOT THE SAME???
// m_Path = new cPath(GetWorld(), GetPosition(), m_FinalDestination, 30);
- m_Path = new cPath(GetWorld(), Vector3d(floor(position.x), floor(position.y), floor(position.z)), Vector3d(floor(Dest.x), floor(Dest.y), floor(Dest.z)), 20);
+ m_Path = new cPath(&a_Chunk, Vector3d(floor(position.x), floor(position.y), floor(position.z)), Vector3d(floor(Dest.x), floor(Dest.y), floor(Dest.z)), 20);
m_IsFollowingPath = false;
}
- m_PathStatus = m_Path->Step();
+ m_PathStatus = m_Path->Step(&a_Chunk);
switch (m_PathStatus)
{
@@ -295,7 +295,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
}
- TickPathFinding();
+ TickPathFinding(a_Chunk);
Vector3d Distance = m_Destination - GetPosition();
if (!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move