From fbf5163a75fd85cdef16f29792a11cd988c57667 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Fri, 25 Aug 2017 07:38:56 +0300 Subject: Cow crash fix --- src/Mobs/Behaviors/BehaviorBreeder.cpp | 1 - src/Mobs/Behaviors/BehaviorCoward.cpp | 26 +++++++++++++++++++++++++- src/Mobs/Behaviors/BehaviorCoward.h | 2 ++ src/Mobs/Behaviors/BehaviorItemFollower.cpp | 1 - src/Mobs/Behaviors/BehaviorWanderer.cpp | 1 - 5 files changed, 27 insertions(+), 4 deletions(-) (limited to 'src/Mobs/Behaviors') diff --git a/src/Mobs/Behaviors/BehaviorBreeder.cpp b/src/Mobs/Behaviors/BehaviorBreeder.cpp index bc0c8d3ea..8d569ea03 100644 --- a/src/Mobs/Behaviors/BehaviorBreeder.cpp +++ b/src/Mobs/Behaviors/BehaviorBreeder.cpp @@ -90,7 +90,6 @@ void cBehaviorBreeder::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) void cBehaviorBreeder::PostTick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { - LOGD("mobDebug - Behavior Breeder: PostTick"); UNUSED(a_Dt); UNUSED(a_Chunk); if (m_MatingTimer > 0) diff --git a/src/Mobs/Behaviors/BehaviorCoward.cpp b/src/Mobs/Behaviors/BehaviorCoward.cpp index 94997f065..c3afec67a 100644 --- a/src/Mobs/Behaviors/BehaviorCoward.cpp +++ b/src/Mobs/Behaviors/BehaviorCoward.cpp @@ -37,9 +37,32 @@ bool cBehaviorCoward::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & +bool cBehaviorCoward::ControlStarting(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) +{ + UNUSED(a_Dt); + UNUSED(a_Chunk); + m_Parent->SetSpeed(m_Parent->GetSpeed() * 2); + return true; +} + + + + + +bool cBehaviorCoward::ControlEnding(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) +{ + UNUSED(a_Dt); + UNUSED(a_Chunk); + m_Parent->SetSpeed(m_Parent->GetSpeed() / 2); + return true; +} + + + + + void cBehaviorCoward::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { - LOGD("mobDebug - Behavior Coward: Tick"); UNUSED(a_Dt); UNUSED(a_Chunk); if (m_Attacker == nullptr) @@ -52,6 +75,7 @@ void cBehaviorCoward::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { // We lost the attacker m_Attacker = nullptr; + return; } Vector3d newloc = m_Parent->GetPosition(); diff --git a/src/Mobs/Behaviors/BehaviorCoward.h b/src/Mobs/Behaviors/BehaviorCoward.h index f33ab38c8..d5ffa4312 100644 --- a/src/Mobs/Behaviors/BehaviorCoward.h +++ b/src/Mobs/Behaviors/BehaviorCoward.h @@ -18,6 +18,8 @@ public: // Functions our host Monster should invoke: bool IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; + bool ControlStarting(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; + bool ControlEnding(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; void DoTakeDamage(TakeDamageInfo & a_TDI) override; diff --git a/src/Mobs/Behaviors/BehaviorItemFollower.cpp b/src/Mobs/Behaviors/BehaviorItemFollower.cpp index 421334455..6978b2765 100644 --- a/src/Mobs/Behaviors/BehaviorItemFollower.cpp +++ b/src/Mobs/Behaviors/BehaviorItemFollower.cpp @@ -44,7 +44,6 @@ bool cBehaviorItemFollower::IsControlDesired(std::chrono::milliseconds a_Dt, cCh void cBehaviorItemFollower::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { - LOGD("mobDebug - Behavior ItemFollower: Tick"); UNUSED(a_Dt); UNUSED(a_Chunk); cItems FollowedItems; diff --git a/src/Mobs/Behaviors/BehaviorWanderer.cpp b/src/Mobs/Behaviors/BehaviorWanderer.cpp index 39fde8373..b57d5f033 100644 --- a/src/Mobs/Behaviors/BehaviorWanderer.cpp +++ b/src/Mobs/Behaviors/BehaviorWanderer.cpp @@ -39,7 +39,6 @@ bool cBehaviorWanderer::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk void cBehaviorWanderer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { - LOGD("mobDebug - Behavior Wanderer: Tick"); if (m_Parent->IsPathFinderActivated()) { return; // Still getting there -- cgit v1.2.3