From cc0838459a86e45ccdbaa4977e20f4233f1ff1c1 Mon Sep 17 00:00:00 2001 From: "MeanMachine@MeanMachine-PC" Date: Wed, 10 Dec 2008 06:34:35 +0200 Subject: Featuring a rewritten waypoint movement with more options, optimised code and revamped ingame waypoint control. To convert entries from the old tables manually, please use the PHP script provided at http://www.trinitycore.org/forum/project.php?issueid=830 --HG-- branch : trunk --- src/game/World.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/game/World.cpp') diff --git a/src/game/World.cpp b/src/game/World.cpp index 04b3a1004c9..8cf6147842b 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1271,6 +1271,7 @@ void World::SetInitialWorldSettings() objmgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data) objmgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data) objmgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) + objmgr.LoadWaypointScripts(); sLog.outString( "Loading Scripts text locales..." ); // must be after Load*Scripts calls objmgr.LoadDbScriptStrings(); @@ -1313,7 +1314,6 @@ void World::SetInitialWorldSettings() ///- Initilize static helper structures AIRegistry::Initialize(); - WaypointMovementGenerator::Initialize(); Player::InitVisibleBits(); ///- Initialize MapManager @@ -2203,8 +2203,32 @@ void World::ScriptsProcess() break; } - - default: + + case SCRIPT_COMMAND_LOAD_PATH: + { + if(!source) + { + sLog.outError("SCRIPT_COMMAND_START_MOVE is tried to apply to NON-existing unit."); + break; + } + + if(!source->isType(TYPEMASK_UNIT)) + { + sLog.outError("SCRIPT_COMMAND_START_MOVE source mover isn't unit (TypeId: %u), skipping.",source->GetTypeId()); + break; + } + + if(!WaypointMgr.GetPath(step.script->datalong)) + { + sLog.outError("SCRIPT_COMMAND_START_MOVE source mover has an invallid path, skipping.", step.script->datalong2); + break; + } + + dynamic_cast(source)->GetMotionMaster()->MovePath(step.script->datalong, step.script->datalong2); + break; + } + + default: sLog.outError("Unknown script command %u called.",step.script->command); break; } -- cgit v1.2.3