diff options
author | maximius <none@none> | 2009-11-17 20:26:35 -0800 |
---|---|---|
committer | maximius <none@none> | 2009-11-17 20:26:35 -0800 |
commit | 27d3bf466c447f8df587eb29f5be48d837b6027c (patch) | |
tree | 2c0d073a6317b3583fb0edc054201c3c91f54e2c /src/game/WaypointMovementGenerator.cpp | |
parent | 6659defa6d61d402061b4c2b1442a52a271c14bc (diff) |
*Convert some tabs to 4 spaces.
--HG--
branch : trunk
Diffstat (limited to 'src/game/WaypointMovementGenerator.cpp')
-rw-r--r-- | src/game/WaypointMovementGenerator.cpp | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index fe5d20bbc91..d017b09981f 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -21,7 +21,7 @@ //Extended headers #include "ObjectMgr.h" #include "World.h" -#include "MapManager.h" // for flightmaster grid preloading +#include "MapManager.h" // for flightmaster grid preloading //Creature-specific headers #include "Creature.h" #include "CreatureAI.h" @@ -256,17 +256,16 @@ void FlightPathMovementGenerator::Initialize(Player &player) player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd()); - // Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will - // be reinitialized for each flightmaster at the end of each spline (or stop) in the flight. + // Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will + // be reinitialized for each flightmaster at the end of each spline (or stop) in the flight. - uint32 nodeCount = i_mapIds.size(); // Get the number of nodes in the path. i_path and i_mapIds are the - // same size when loaded in ObjectMgr::GetTaxiPathNodes, called from LoadPath() - - m_endMapId = i_mapIds[nodeCount -1]; // Get the map ID from the last node - m_preloadTargetNode = nodeCount / 2; // Split the number of nodes in half to preload the flightmaster half-way through the flight - m_endGridX = i_path[nodeCount -1].x; // Get the X position from the last node - m_endGridY = i_path[nodeCount -1].y; // Get tye Y position from the last node + uint32 nodeCount = i_mapIds.size(); // Get the number of nodes in the path. i_path and i_mapIds are the + // same size when loaded in ObjectMgr::GetTaxiPathNodes, called from LoadPath() + m_endMapId = i_mapIds[nodeCount -1]; // Get the map ID from the last node + m_preloadTargetNode = nodeCount / 2; // Split the number of nodes in half to preload the flightmaster half-way through the flight + m_endGridX = i_path[nodeCount -1].x; // Get the X position from the last node + m_endGridY = i_path[nodeCount -1].y; // Get tye Y position from the last node } void FlightPathMovementGenerator::Finalize(Player & player) @@ -280,31 +279,29 @@ void FlightPathMovementGenerator::Finalize(Player & player) bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) { - if( MovementInProgress() ) + if(MovementInProgress()) { Traveller<Player> traveller(player); - if( i_destinationHolder.UpdateTraveller(traveller, diff) ) + if(i_destinationHolder.UpdateTraveller(traveller, diff)) { i_destinationHolder.ResetUpdate(FLIGHT_TRAVEL_UPDATE); - if( i_destinationHolder.HasArrived() ) + if(i_destinationHolder.HasArrived()) { uint32 curMap = i_mapIds[i_currentNode]; ++i_currentNode; - if( MovementInProgress() ) + if(MovementInProgress()) { DEBUG_LOG("loading node %u for player %s", i_currentNode, player.GetName()); - if(i_mapIds[i_currentNode]==curMap) + if(i_mapIds[i_currentNode] == curMap) { // do not send movement, it was sent already i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false); } - // check if it's time to preload the flightmaster grid - // at path end - if (i_currentNode == m_preloadTargetNode) - { - PreloadEndGrid(); - } + // check if it's time to preload the flightmaster grid at path end + if (i_currentNode == m_preloadTargetNode) + PreloadEndGrid(); + return true; } //else HasArrived() @@ -338,20 +335,17 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() void FlightPathMovementGenerator::PreloadEndGrid() { - // used to preload the final grid where the flightmaster is - Map *endMap = MapManager::Instance().FindMap(m_endMapId); - - // Load the grid - if (endMap) - { - sLog.outDetail("Preloading flightmaster at grid (%f, %f) for map %u", m_endGridX, m_endGridY, m_endMapId); - endMap->LoadGrid(m_endGridX, m_endGridY); - } - else - { - sLog.outDetail("Unable to determine map to preload flightmaster grid"); - } + // used to preload the final grid where the flightmaster is + Map *endMap = MapManager::Instance().FindMap(m_endMapId); + // Load the grid + if (endMap) + { + sLog.outDetail("Preloading flightmaster at grid (%f, %f) for map %u", m_endGridX, m_endGridY, m_endMapId); + endMap->LoadGrid(m_endGridX, m_endGridY); + } + else + sLog.outDetail("Unable to determine map to preload flightmaster grid"); } // |