aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-09 10:50:41 -0500
committermegamage <none@none>2009-05-09 10:50:41 -0500
commite35d07ad81f5acedcbe436bf429db5581edc6b81 (patch)
treeae238465d80bc7dcbba5b66dddf6708837be6f2a /src/game/Object.cpp
parent1de3e5d8e846c7bfe48ca4982df7615c392abb9e (diff)
*Update Sapphiron script.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index f649164e21b..6b7a3cdd4ac 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1309,6 +1309,21 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
return (( angle >= lborder ) && ( angle <= rborder ));
}
+bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size) const
+{
+ if(GetPositionX() > std::max(obj1->GetPositionX(), obj2->GetPositionX())
+ || GetPositionX() < std::min(obj1->GetPositionX(), obj2->GetPositionX())
+ || GetPositionY() > std::max(obj1->GetPositionY(), obj2->GetPositionY())
+ || GetPositionY() < std::min(obj1->GetPositionY(), obj2->GetPositionY()))
+ return false;
+
+ if(!size)
+ size = GetObjectSize() / 2;
+
+ float angle = obj1->GetAngle(this) - obj1->GetAngle(obj2);
+ return abs(sin(angle)) * GetExactDistance2d(obj1->GetPositionX(), obj1->GetPositionY()) < size;
+}
+
void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const
{
if(distance==0)
@@ -1658,6 +1673,8 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a
return NULL;
}
+ summon->SetHomePosition(x, y, z, angle);
+
summon->InitStats(duration);
Add((Creature*)summon);
summon->InitSummon();
@@ -1680,7 +1697,6 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, float x, float y, float z,
if(!pCreature)
return NULL;
- pCreature->SetHomePosition(x, y, z, ang);
pCreature->SetTempSummonType(spwtype);
return pCreature;