diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/ObjectMgr.cpp | 15 | ||||
-rw-r--r-- | src/game/Pet.cpp | 4 | ||||
-rw-r--r-- | src/game/WaypointMovementGenerator.cpp | 62 | ||||
-rw-r--r-- | src/game/WaypointMovementGenerator.h | 16 |
4 files changed, 45 insertions, 52 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index d5ca4826e38..4ac56042275 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -5314,14 +5314,13 @@ uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_al else mount_entry = node->MountCreatureID[0]; - // Fix for Alliance not being able to use Acherus taxi - // only one mount type for both sides - if (mount_entry == 0 && allowed_alt_team) - { - // Simply reverse the selection. At least one team in theory should - // have a valid mount ID to choose - mount_entry = (team == ALLIANCE) ? node->MountCreatureID[0] : node->MountCreatureID[1]; - } + // Fix for Alliance not being able to use Acherus taxi + // only one mount type for both sides + if (mount_entry == 0 && allowed_alt_team) + { + // Simply reverse the selection. At least one team in theory should have a valid mount ID to choose. + mount_entry = team == ALLIANCE ? node->MountCreatureID[0] : node->MountCreatureID[1]; + } CreatureInfo const *mount_info = GetCreatureTemplate(mount_entry); if (mount_info) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 8fd3f70f6d2..f0f04031967 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -346,9 +346,9 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool } } - //set last used pet number (for use in BG's) + //set last used pet number (for use in BG's) if(owner->GetTypeId() == TYPEID_PLAYER && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET)) - ((Player*)owner)->SetLastPetNumber(pet_number); + ((Player*)owner)->SetLastPetNumber(pet_number); m_loading = false; 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"); } // diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 4e64229b524..577af8d5a09 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -114,14 +114,14 @@ public PathMovementBase<Player> void SkipCurrentNode() { ++i_currentNode; } bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; } - private: - // storage for preloading the flightmaster grid at end - // before reaching final waypoint - uint32 m_endMapId; - uint32 m_preloadTargetNode; - float m_endGridX; - float m_endGridY; - void PreloadEndGrid(); + private: + // storage for preloading the flightmaster grid at end + // before reaching final waypoint + uint32 m_endMapId; + uint32 m_preloadTargetNode; + float m_endGridX; + float m_endGridY; + void PreloadEndGrid(); }; #endif |