aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Creature.cpp3
-rw-r--r--src/game/WaypointManager.cpp3
-rw-r--r--src/game/WaypointMovementGenerator.cpp17
3 files changed, 10 insertions, 13 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index c0065212207..c57b8a27fb9 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -219,7 +219,8 @@ void Creature::RemoveCorpse()
float x,y,z,o;
GetRespawnCoord(x, y, z, &o);
- GetMap()->CreatureRelocation(this,x,y,z,o);
+ SetHomePosition(x,y,z,o);
+ GetMap()->CreatureRelocation(this,x,y,z,o);
}
/**
diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp
index c18c09bcc17..fc0ca9e8007 100644
--- a/src/game/WaypointManager.cpp
+++ b/src/game/WaypointManager.cpp
@@ -34,7 +34,7 @@ void WaypointStore::Free()
void WaypointStore::Load()
{
- QueryResult *result = WorldDatabase.PQuery("SELECT MAX(`id`) FROM `waypoint_data");
+ QueryResult *result = WorldDatabase.PQuery("SELECT MAX(`id`) FROM `waypoint_data`");
if(!result)
{
sLog.outError(" an error occured while loading the table `waypoint_data` ( maybe it doesn't exist ?)\n");
@@ -44,7 +44,6 @@ void WaypointStore::Load()
records = (*result)[0].GetUInt32();
delete result;
-
result = WorldDatabase.PQuery("SELECT `id`,`point`,`position_x`,`position_y`,`position_z`,`move_flag`,`delay`,`action`,`action_chance` FROM `waypoint_data` ORDER BY `id`, `point`");
if(!result)
{
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index 71d05d073d2..85ef44b51be 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -15,24 +15,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-//Basic header
-#include <ctime>
-
+//Basic headers
#include "WaypointMovementGenerator.h"
#include "DestinationHolderImp.h"
-//Accessors
-#include "Database/DatabaseEnv.h"
+//Extended headers
#include "ObjectMgr.h"
#include "World.h"
//Creature-specific headers
#include "Creature.h"
#include "CreatureAI.h"
-//Player-Specific
+//Player-specific
#include "Player.h"
-//Visual
-#include "ProgressBar.h"
-#include "MapManager.h"
template<class T>
void
@@ -42,6 +35,8 @@ template<>
void
WaypointMovementGenerator<Creature>::Initialize(Creature &u)
{
+ u.StopMoving();
+ i_nextMoveTime.Reset(0);
i_currentNode = -1;
if(!path_id)
path_id = u.GetWaypointPath();
@@ -160,6 +155,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
i_currentNode = 0; //Start moving all over again
else
{
+ unit.SetHomePosition(node.x, node.y, node.z, unit.GetOrientation());
unit.GetMotionMaster()->Initialize();
return false; //Clear the waypoint movement
}
@@ -184,6 +180,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
MovementInform(unit);
unit.UpdateWaypointID(i_currentNode);
unit.clearUnitState(UNIT_STAT_MOVING);
+ unit.Relocate(node.x, node.y, node.z);
}
}
else