Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2010
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 19.13 KB | None | 0 0
  1. /*
  2.  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
  3.  *
  4.  * Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * (at your option) any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program; if not, write to the Free Software
  18.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19.  */
  20.  
  21. #include "Common.h"
  22.  
  23. #include "Transport.h"
  24. #include "MapManager.h"
  25. #include "ObjectMgr.h"
  26. #include "Path.h"
  27.  
  28. #include "WorldPacket.h"
  29. #include "DBCStores.h"
  30. #include "ProgressBar.h"
  31.  
  32. #include "World.h"
  33.  
  34. void MapManager::LoadTransports()
  35. {
  36.     QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, name, period FROM transports");
  37.  
  38.     uint32 count = 0;
  39.  
  40.     if (!result)
  41.     {
  42.         barGoLink bar(1);
  43.         bar.step();
  44.  
  45.         sLog.outString();
  46.         sLog.outString(">> Loaded %u transports", count);
  47.         return;
  48.     }
  49.  
  50.     barGoLink bar(result->GetRowCount());
  51.  
  52.     do
  53.     {
  54.         bar.step();
  55.  
  56.         Transport *t = new Transport;
  57.  
  58.         Field *fields = result->Fetch();
  59.  
  60.         uint32 entry = fields[0].GetUInt32();
  61.         std::string name = fields[1].GetCppString();
  62.         t->m_period = fields[2].GetUInt32();
  63.  
  64.         const GameObjectInfo *goinfo = objmgr.GetGameObjectInfo(entry);
  65.  
  66.         if (!goinfo)
  67.         {
  68.             sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());
  69.             delete t;
  70.             continue;
  71.         }
  72.  
  73.         if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
  74.         {
  75.             sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());
  76.             delete t;
  77.             continue;
  78.         }
  79.  
  80.         // sLog.outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
  81.  
  82.         std::set<uint32> mapsUsed;
  83.  
  84.         if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
  85.             // skip transports with empty waypoints list
  86.         {
  87.             sLog.outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.",goinfo->moTransport.taxiPathId);
  88.             delete t;
  89.             continue;
  90.         }
  91.  
  92.         float x, y, z, o;
  93.         uint32 mapid;
  94.         x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1;
  95.  
  96.          // creates the Gameobject
  97.         if (!t->Create(entry, mapid, x, y, z, o, 100, 0))
  98.         {
  99.             delete t;
  100.             continue;
  101.         }
  102.  
  103.         m_Transports.insert(t);
  104.  
  105.         for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i)
  106.             m_TransportsByMap[*i].insert(t);
  107.  
  108.         //If we someday decide to use the grid to track transports, here:
  109.         t->SetMap(sMapMgr.CreateMap(mapid, t, 0));
  110.  
  111.         //t->GetMap()->Add<GameObject>((GameObject *)t);
  112.         ++count;
  113.     } while (result->NextRow());
  114.  
  115.     sLog.outString();
  116.     sLog.outString(">> Loaded %u transports", count);
  117.  
  118.     // check transport data DB integrity
  119.     result = WorldDatabase.Query("SELECT gameobject.guid,gameobject.id,transports.name FROM gameobject,transports WHERE gameobject.id = transports.entry");
  120.     if (result)                                              // wrong data found
  121.     {
  122.         do
  123.         {
  124.             Field *fields = result->Fetch();
  125.  
  126.             uint32 guid  = fields[0].GetUInt32();
  127.             uint32 entry = fields[1].GetUInt32();
  128.             std::string name = fields[2].GetCppString();
  129.             sLog.outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid);
  130.         }
  131.         while (result->NextRow());
  132.     }
  133. }
  134.  
  135. Transport::Transport() : GameObject()
  136. {
  137.     m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION);
  138. }
  139.  
  140. bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags)
  141. {
  142.     Relocate(x,y,z,ang);
  143.     // instance id and phaseMask isn't set to values different from std.
  144.  
  145.     if (!IsPositionValid())
  146.     {
  147.         sLog.outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
  148.             guidlow,x,y);
  149.         return false;
  150.     }
  151.  
  152.     Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
  153.  
  154.     GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow);
  155.  
  156.     if (!goinfo)
  157.     {
  158.         sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u  (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang);
  159.         return false;
  160.     }
  161.  
  162.     m_goInfo = goinfo;
  163.  
  164.     SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
  165.  
  166.     SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
  167.     //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
  168.     SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
  169.     SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
  170.     SetEntry(goinfo->id);
  171.  
  172.     SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
  173.  
  174.     SetGoState(GO_STATE_READY);
  175.     SetGoType(GameobjectTypes(goinfo->type));
  176.  
  177.     SetGoAnimProgress(animprogress);
  178.     if (dynflags)
  179.         SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags));
  180.  
  181.     SetName(goinfo->name);
  182.  
  183.     return true;
  184. }
  185.  
  186. struct keyFrame
  187. {
  188.     explicit keyFrame(TaxiPathNodeEntry const& _node) : node(&_node),
  189.         distSinceStop(-1.0f), distUntilStop(-1.0f), distFromPrev(-1.0f), tFrom(0.0f), tTo(0.0f)
  190.         {
  191.         }
  192.  
  193.     TaxiPathNodeEntry const* node;
  194.  
  195.     float distSinceStop;
  196.     float distUntilStop;
  197.     float distFromPrev;
  198.     float tFrom, tTo;
  199. };
  200.  
  201. bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
  202. {
  203.     if (pathid >= sTaxiPathNodesByPath.size())
  204.         return false;
  205.  
  206.     TaxiPathNodeList const& path = sTaxiPathNodesByPath[pathid];
  207.    
  208.     std::vector<keyFrame> keyFrames;
  209.     int mapChange = 0;
  210.     mapids.clear();
  211.     for (size_t i = 1; i < path.size() - 1; ++i)
  212.     {
  213.         if (mapChange == 0)
  214.         {
  215.             TaxiPathNodeEntry const& node_i = path[i];
  216.             if (node_i.mapid == path[i+1].mapid)
  217.             {
  218.                 keyFrame k(node_i);
  219.                 keyFrames.push_back(k);
  220.                 mapids.insert(k.node->mapid);
  221.             }
  222.             else
  223.             {
  224.                 mapChange = 1;
  225.             }
  226.         }
  227.         else
  228.         {
  229.             --mapChange;
  230.         }
  231.     }
  232.  
  233.     int lastStop = -1;
  234.     int firstStop = -1;
  235.  
  236.     // first cell is arrived at by teleportation :S
  237.     keyFrames[0].distFromPrev = 0;
  238.     if (keyFrames[0].node->actionFlag == 2)
  239.     {
  240.         lastStop = 0;
  241.     }
  242.  
  243.     // find the rest of the distances between key points
  244.     for (size_t i = 1; i < keyFrames.size(); ++i)
  245.     {
  246.         if ((keyFrames[i].node->actionFlag == 1) || (keyFrames[i].node->mapid != keyFrames[i-1].node->mapid))
  247.         {
  248.             keyFrames[i].distFromPrev = 0;
  249.         }
  250.         else
  251.         {
  252.             keyFrames[i].distFromPrev =
  253.                 sqrt(pow(keyFrames[i].node->x - keyFrames[i - 1].node->x, 2) +
  254.                     pow(keyFrames[i].node->y - keyFrames[i - 1].node->y, 2) +
  255.                     pow(keyFrames[i].node->z - keyFrames[i - 1].node->z, 2));
  256.         }
  257.         if (keyFrames[i].node->actionFlag == 2)
  258.         {
  259.             // remember first stop frame
  260.             if (firstStop == -1)
  261.                 firstStop = i;
  262.             lastStop = i;
  263.         }
  264.     }
  265.  
  266.     float tmpDist = 0;
  267.     for (size_t i = 0; i < keyFrames.size(); ++i)
  268.     {
  269.         int j = (i + lastStop) % keyFrames.size();
  270.         if (keyFrames[j].node->actionFlag == 2)
  271.             tmpDist = 0;
  272.         else
  273.             tmpDist += keyFrames[j].distFromPrev;
  274.         keyFrames[j].distSinceStop = tmpDist;
  275.     }
  276.  
  277.     for (int i = int(keyFrames.size()) - 1; i >= 0; i--)
  278.     {
  279.         int j = (i + (firstStop+1)) % keyFrames.size();
  280.         tmpDist += keyFrames[(j + 1) % keyFrames.size()].distFromPrev;
  281.         keyFrames[j].distUntilStop = tmpDist;
  282.         if (keyFrames[j].node->actionFlag == 2)
  283.             tmpDist = 0;
  284.     }
  285.  
  286.     for (size_t i = 0; i < keyFrames.size(); ++i)
  287.     {
  288.         if (keyFrames[i].distSinceStop < (30 * 30 * 0.5f))
  289.             keyFrames[i].tFrom = sqrt(2 * keyFrames[i].distSinceStop);
  290.         else
  291.             keyFrames[i].tFrom = ((keyFrames[i].distSinceStop - (30 * 30 * 0.5f)) / 30) + 30;
  292.  
  293.         if (keyFrames[i].distUntilStop < (30 * 30 * 0.5f))
  294.             keyFrames[i].tTo = sqrt(2 * keyFrames[i].distUntilStop);
  295.         else
  296.             keyFrames[i].tTo = ((keyFrames[i].distUntilStop - (30 * 30 * 0.5f)) / 30) + 30;
  297.  
  298.         keyFrames[i].tFrom *= 1000;
  299.         keyFrames[i].tTo *= 1000;
  300.     }
  301.  
  302.     //    for (int i = 0; i < keyFrames.size(); ++i) {
  303.     //        sLog.outString("%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo);
  304.     //    }
  305.  
  306.     // Now we're completely set up; we can move along the length of each waypoint at 100 ms intervals
  307.     // speed = max(30, t) (remember x = 0.5s^2, and when accelerating, a = 1 unit/s^2
  308.     int t = 0;
  309.     bool teleport = false;
  310.     if (keyFrames[keyFrames.size() - 1].node->mapid != keyFrames[0].node->mapid)
  311.         teleport = true;
  312.  
  313.     WayPoint pos(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
  314.         keyFrames[0].node->arrivalEventID, keyFrames[0].node->departureEventID);
  315.     m_WayPoints[0] = pos;
  316.     t += keyFrames[0].node->delay * 1000;
  317.  
  318.     uint32 cM = keyFrames[0].node->mapid;
  319.     for (size_t i = 0; i < keyFrames.size() - 1; ++i)
  320.     {
  321.         float d = 0;
  322.         float tFrom = keyFrames[i].tFrom;
  323.         float tTo = keyFrames[i].tTo;
  324.  
  325.         // keep the generation of all these points; we use only a few now, but may need the others later
  326.         if (((d < keyFrames[i + 1].distFromPrev) && (tTo > 0)))
  327.         {
  328.             while ((d < keyFrames[i + 1].distFromPrev) && (tTo > 0))
  329.             {
  330.                 tFrom += 100;
  331.                 tTo -= 100;
  332.  
  333.                 if (d > 0)
  334.                 {
  335.                     float newX, newY, newZ;
  336.                     newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
  337.                     newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
  338.                     newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
  339.  
  340.                     bool teleport = false;
  341.                     if (keyFrames[i].node->mapid != cM)
  342.                     {
  343.                         teleport = true;
  344.                         cM = keyFrames[i].node->mapid;
  345.                     }
  346.  
  347.                     //                    sLog.outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
  348.                     WayPoint pos(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
  349.                     if (teleport)
  350.                         m_WayPoints[t] = pos;
  351.                 }
  352.  
  353.                 if (tFrom < tTo)                            // caught in tFrom dock's "gravitational pull"
  354.                 {
  355.                     if (tFrom <= 30000)
  356.                     {
  357.                         d = 0.5f * (tFrom / 1000) * (tFrom / 1000);
  358.                     }
  359.                     else
  360.                     {
  361.                         d = 0.5f * 30 * 30 + 30 * ((tFrom - 30000) / 1000);
  362.                     }
  363.                     d = d - keyFrames[i].distSinceStop;
  364.                 }
  365.                 else
  366.                 {
  367.                     if (tTo <= 30000)
  368.                     {
  369.                         d = 0.5f * (tTo / 1000) * (tTo / 1000);
  370.                     }
  371.                     else
  372.                     {
  373.                         d = 0.5f * 30 * 30 + 30 * ((tTo - 30000) / 1000);
  374.                     }
  375.                     d = keyFrames[i].distUntilStop - d;
  376.                 }
  377.                 t += 100;
  378.             }
  379.             t -= 100;
  380.         }
  381.  
  382.         if (keyFrames[i + 1].tFrom > keyFrames[i + 1].tTo)
  383.             t += 100 - ((long)keyFrames[i + 1].tTo % 100);
  384.         else
  385.             t += (long)keyFrames[i + 1].tTo % 100;
  386.  
  387.         bool teleport = false;
  388.         if ((keyFrames[i + 1].node->actionFlag == 1) || (keyFrames[i + 1].node->mapid != keyFrames[i].node->mapid))
  389.         {
  390.             teleport = true;
  391.             cM = keyFrames[i + 1].node->mapid;
  392.         }
  393.  
  394.         WayPoint pos(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
  395.             0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID);
  396.         //        sLog.outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
  397. /*
  398.         if (keyFrames[i+1].delay > 5)
  399.             pos.delayed = true;
  400. */
  401.         //if (teleport)
  402.         m_WayPoints[t] = pos;
  403.  
  404.         t += keyFrames[i + 1].node->delay * 1000;
  405.         //        sLog.outString("------");
  406.     }
  407.  
  408.     uint32 timer = t;
  409.  
  410.     //    sLog.outDetail("    Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer);
  411.  
  412.     m_curr = m_WayPoints.begin();
  413.     m_curr = GetNextWayPoint();
  414.     m_next = GetNextWayPoint();
  415.     m_pathTime = timer;
  416.  
  417.     m_nextNodeTime = m_curr->first;
  418.  
  419.     return true;
  420. }
  421.  
  422. Transport::WayPointMap::const_iterator Transport::GetNextWayPoint()
  423. {
  424.     WayPointMap::const_iterator iter = m_curr;
  425.     ++iter;
  426.     if (iter == m_WayPoints.end())
  427.         iter = m_WayPoints.begin();
  428.     return iter;
  429. }
  430.  
  431. void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
  432. {
  433.     Map const* oldMap = GetMap();
  434.     Relocate(x, y, z);
  435.  
  436.     for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();)
  437.     {
  438.         Player *plr = *itr;
  439.         ++itr;
  440.  
  441.         if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
  442.         {
  443.             plr->ResurrectPlayer(1.0);
  444.         }
  445.         plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
  446.  
  447.         //WorldPacket data(SMSG_811, 4);
  448.         //data << uint32(0);
  449.         //plr->GetSession()->SendPacket(&data);
  450.     }
  451.  
  452.     //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference...
  453.     //player far teleport would try to create same instance, but we need it NOW for transport...
  454.     //correct me if I'm wrong O.o
  455.     //yes, you're right
  456.  
  457.     ResetMap();
  458.     Map * newMap = sMapMgr.CreateMap(newMapid, this, 0);
  459.     SetMap(newMap);
  460.     assert (GetMap());
  461.  
  462.     if (oldMap != newMap)
  463.     {
  464.         UpdateForMap(oldMap);
  465.         UpdateForMap(newMap);
  466.     }
  467. }
  468.  
  469. bool Transport::AddPassenger(Player* passenger)
  470. {
  471.     if (m_passengers.insert(passenger).second)
  472.         sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName());
  473.     return true;
  474. }
  475.  
  476. bool Transport::RemovePassenger(Player* passenger)
  477. {
  478.     if (m_passengers.erase(passenger))
  479.         sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), GetName());
  480.     return true;
  481. }
  482.  
  483. void Transport::Update(uint32 /*p_time*/)
  484. {
  485.     if (m_WayPoints.size() <= 1)
  486.         return;
  487.  
  488.     m_timer = getMSTime() % m_period;
  489.     while (((m_timer - m_curr->first) % m_pathTime) > ((m_next->first - m_curr->first) % m_pathTime))
  490.     {
  491.         DoEventIfAny(*m_curr, true);
  492.  
  493.         m_curr = GetNextWayPoint();
  494.         m_next = GetNextWayPoint();
  495.  
  496.         DoEventIfAny(*m_curr,false);
  497.  
  498.         // first check help in case client-server transport coordinates de-synchronization
  499.         if (m_curr->second.mapid != GetMapId() || m_curr->second.teleport)
  500.         {
  501.             TeleportTransport(m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z);
  502.         }
  503.         else
  504.         {
  505.             Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z);
  506.         }
  507. /*
  508.         if (m_curr->second.delayed)
  509.         {
  510.             switch (GetEntry())
  511.             {
  512.                 case 176495:
  513.                 case 164871:
  514.                 case 175080:
  515.                     SendPlaySound(11804, false); break;     // ZeppelinDocked
  516.                 case 20808:
  517.                 case 181646:
  518.                 case 176231:
  519.                 case 176244:
  520.                 case 176310:
  521.                 case 177233:
  522.                     SendPlaySound(5495, false);break;       // BoatDockingWarning
  523.                 default:
  524.                     SendPlaySound(5154, false); break;      // ShipDocked
  525.             }
  526.         }
  527. */
  528.         /*
  529.         for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();)
  530.         {
  531.             PlayerSet::const_iterator it2 = itr;
  532.             ++itr;
  533.             //(*it2)->SetPosition(m_curr->second.x + (*it2)->GetTransOffsetX(), m_curr->second.y + (*it2)->GetTransOffsetY(), m_curr->second.z + (*it2)->GetTransOffsetZ(), (*it2)->GetTransOffsetO());
  534.         }
  535.         */
  536.  
  537.         m_nextNodeTime = m_curr->first;
  538.  
  539.         if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0)
  540.             sLog.outDetail(" ************ BEGIN ************** %s", this->m_name.c_str());
  541.  
  542.         if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0)
  543.             sLog.outDetail("%s moved to %d %f %f %f %d", this->m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid);
  544.     }
  545. }
  546.  
  547. void Transport::UpdateForMap(Map const* targetMap)
  548. {
  549.     Map::PlayerList const& pl = targetMap->GetPlayers();
  550.     if (pl.isEmpty())
  551.         return;
  552.  
  553.     if (GetMapId() == targetMap->GetId())
  554.     {
  555.         for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
  556.         {
  557.             if (this != itr->getSource()->GetTransport())
  558.             {
  559.                 UpdateData transData;
  560.                 BuildCreateUpdateBlockForPlayer(&transData, itr->getSource());
  561.                 WorldPacket packet;
  562.                 transData.BuildPacket(&packet);
  563.                 itr->getSource()->SendDirectMessage(&packet);
  564.             }
  565.         }
  566.     }
  567.     else
  568.     {
  569.         UpdateData transData;
  570.         BuildOutOfRangeUpdateBlock(&transData);
  571.         WorldPacket out_packet;
  572.         transData.BuildPacket(&out_packet);
  573.  
  574.         for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
  575.             if (this != itr->getSource()->GetTransport())
  576.                 itr->getSource()->SendDirectMessage(&out_packet);
  577.     }
  578. }
  579.  
  580. void Transport::DoEventIfAny(WayPointMap::value_type const& node, bool departure)
  581. {
  582.     if (uint32 eventid = departure ? node.second.departureEventID : node.second.arrivalEventID)
  583.     {
  584.         sLog.outDebug("Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.first, GetName());
  585.         GetMap()->ScriptsStart(sEventScripts, eventid, this, this);
  586.     }
  587. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement