summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 10:29:29 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 10:29:29 +0200
commit7f7c743204bb7fddfd439bcfa84943ba0fe31755 (patch)
treeacd72b62c5bc33dbb45b9ac1b5853f9970d7a45c /src/Entities
parenttargetStrikeRange (diff)
downloadcuberite-7f7c743204bb7fddfd439bcfa84943ba0fe31755.tar
cuberite-7f7c743204bb7fddfd439bcfa84943ba0fe31755.tar.gz
cuberite-7f7c743204bb7fddfd439bcfa84943ba0fe31755.tar.bz2
cuberite-7f7c743204bb7fddfd439bcfa84943ba0fe31755.tar.lz
cuberite-7f7c743204bb7fddfd439bcfa84943ba0fe31755.tar.xz
cuberite-7f7c743204bb7fddfd439bcfa84943ba0fe31755.tar.zst
cuberite-7f7c743204bb7fddfd439bcfa84943ba0fe31755.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Entity.cpp6
-rw-r--r--src/Entities/Pawn.cpp52
-rw-r--r--src/Entities/Pawn.h16
-rw-r--r--src/Entities/Player.cpp2
4 files changed, 5 insertions, 71 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index ccba28d53..c4fe1fffd 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1592,12 +1592,12 @@ bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d
// Stop all mobs from targeting this entity
// Stop this entity from targeting other mobs
- if (this->IsMob())
+ /* if (this->IsMob())
{
cMonster * Monster = static_cast<cMonster*>(this);
Monster->SetTarget(nullptr);
- Monster->StopEveryoneFromTargetingMe();
- }
+ Monster->StopEveryoneFromTargetingMe(); mobTodo MovingWorld event for all behaviors?
+ }*/
// Queue add to new world and removal from the old one
cWorld * OldWorld = GetWorld();
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index 233cdfa85..0fa11997b 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -29,7 +29,7 @@ cPawn::cPawn(eEntityType a_EntityType, double a_Width, double a_Height) :
cPawn::~cPawn()
{
- ASSERT(m_TargetingMe.size() == 0);
+
}
@@ -38,7 +38,6 @@ cPawn::~cPawn()
void cPawn::Destroyed()
{
- StopEveryoneFromTargetingMe();
super::Destroyed();
}
@@ -260,38 +259,6 @@ void cPawn::ClearEntityEffects()
-void cPawn::NoLongerTargetingMe(cMonster * a_Monster)
-{
- ASSERT(IsTicking()); // Our destroy override is supposed to clear all targets before we're destroyed.
- for (auto i = m_TargetingMe.begin(); i != m_TargetingMe.end(); ++i)
- {
- cMonster * Monster = *i;
- if (Monster == a_Monster)
- {
- ASSERT(Monster->GetTarget() != this); // The monster is notifying us it is no longer targeting us, assert if that's a lie
- m_TargetingMe.erase(i);
- return;
- }
- }
- ASSERT(false); // If this happens, something is wrong. Perhaps the monster never called TargetingMe() or called NoLongerTargetingMe() twice.
-}
-
-
-
-
-
-void cPawn::TargetingMe(cMonster * a_Monster)
-{
- ASSERT(IsTicking());
- ASSERT(m_TargetingMe.size() < 10000);
- ASSERT(a_Monster->GetTarget() == this);
- m_TargetingMe.push_back(a_Monster);
-}
-
-
-
-
-
void cPawn::HandleFalling(void)
{
/* Not pretty looking, and is more suited to wherever server-sided collision detection is implemented.
@@ -462,23 +429,6 @@ void cPawn::HandleFalling(void)
-void cPawn::StopEveryoneFromTargetingMe()
-{
- std::vector<cMonster*>::iterator i = m_TargetingMe.begin();
- while (i != m_TargetingMe.end())
- {
- cMonster * Monster = *i;
- ASSERT(Monster->GetTarget() == this);
- Monster->UnsafeUnsetTarget();
- i = m_TargetingMe.erase(i);
- }
- ASSERT(m_TargetingMe.size() == 0);
-}
-
-
-
-
-
std::map<cEntityEffect::eType, cEntityEffect *> cPawn::GetEntityEffects()
{
std::map<cEntityEffect::eType, cEntityEffect *> Effects;
diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h
index 480b523ea..935122012 100644
--- a/src/Entities/Pawn.h
+++ b/src/Entities/Pawn.h
@@ -33,11 +33,6 @@ public:
virtual void HandleAir(void) override;
virtual void HandleFalling(void);
- /** Tells all pawns which are targeting us to stop targeting us. */
- void StopEveryoneFromTargetingMe();
-
-
-
// tolua_begin
/** Applies an entity effect.
@@ -58,12 +53,6 @@ public:
// tolua_end
- /** Remove the monster from the list of monsters targeting this pawn. */
- void NoLongerTargetingMe(cMonster * a_Monster);
-
- /** Add the monster to the list of monsters targeting this pawn. (Does not check if already in list!) */
- void TargetingMe(cMonster * a_Monster);
-
/** Returns all entity effects */
std::map<cEntityEffect::eType, cEntityEffect *> GetEntityEffects();
@@ -76,11 +65,6 @@ protected:
double m_LastGroundHeight;
bool m_bTouchGround;
-
-private:
-
- /** A list of all monsters that are targeting this pawn. */
- std::vector<cMonster*> m_TargetingMe;
} ; // tolua_export
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index fb2274cad..4189841b8 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -2018,7 +2018,7 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d
FreezeInternal(a_NewPosition, false);
// Stop all mobs from targeting this player
- StopEveryoneFromTargetingMe();
+ // StopEveryoneFromTargetingMe(); // mobTodo
cClientHandle * ch = this->GetClientHandle();
if (ch != nullptr)