TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TransportMgr Class Reference

#include <TransportMgr.h>

Public Member Functions

void Unload ()
 
void LoadTransportTemplates ()
 
TransportCreateTransport (uint32 entry, ObjectGuid::LowType guid=UI64LIT(0), Map *map=nullptr, uint32 phaseid=0, uint32 phasegroup=0)
 
void SpawnContinentTransports ()
 
void CreateInstanceTransports (Map *map)
 
TransportTemplate constGetTransportTemplate (uint32 entry) const
 
TransportAnimation constGetTransportAnimInfo (uint32 entry) const
 

Static Public Member Functions

static TransportMgrinstance ()
 

Private Member Functions

 TransportMgr ()
 
 ~TransportMgr ()
 
 TransportMgr (TransportMgr const &)
 
TransportMgroperator= (TransportMgr const &)
 
void GeneratePath (GameObjectTemplate const *goInfo, TransportTemplate *transport)
 
void AddPathNodeToTransport (uint32 transportEntry, uint32 timeSeg, TransportAnimationEntry const *node)
 
void AddPathRotationToTransport (uint32 transportEntry, uint32 timeSeg, TransportRotationEntry const *node)
 

Private Attributes

TransportTemplates _transportTemplates
 
TransportInstanceMap _instanceTransports
 
TransportAnimationContainer _transportAnimations
 

Friends

void DB2Manager::LoadStores (std::string const &, uint32)
 

Constructor & Destructor Documentation

TransportMgr::TransportMgr ( )
private
34 { }
TransportMgr::~TransportMgr ( )
private
36 { }
TransportMgr::TransportMgr ( TransportMgr const )
private

Member Function Documentation

void TransportMgr::AddPathNodeToTransport ( uint32  transportEntry,
uint32  timeSeg,
TransportAnimationEntry const node 
)
private
351 {
352  TransportAnimation& animNode = _transportAnimations[transportEntry];
353  if (animNode.TotalTime < timeSeg)
354  animNode.TotalTime = timeSeg;
355 
356  animNode.Path[timeSeg] = node;
357 }
Definition: TransportMgr.h:86
TransportPathContainer Path
Definition: TransportMgr.h:90
TransportAnimationContainer _transportAnimations
Definition: TransportMgr.h:159
uint32 TotalTime
Definition: TransportMgr.h:92
void TransportMgr::AddPathRotationToTransport ( uint32  transportEntry,
uint32  timeSeg,
TransportRotationEntry const node 
)
inlineprivate
149  {
150  _transportAnimations[transportEntry].Rotations[timeSeg] = node;
151  }
TransportAnimationContainer _transportAnimations
Definition: TransportMgr.h:159
void TransportMgr::CreateInstanceTransports ( Map map)
459 {
460  TransportInstanceMap::const_iterator mapTransports = _instanceTransports.find(map->GetId());
461 
462  // no transports here
463  if (mapTransports == _instanceTransports.end() || mapTransports->second.empty())
464  return;
465 
466  // create transports
467  for (std::set<uint32>::const_iterator itr = mapTransports->second.begin(); itr != mapTransports->second.end(); ++itr)
468  CreateTransport(*itr, UI64LIT(0), map);
469 }
#define UI64LIT(N)
Definition: Define.h:138
uint32 GetId(void) const
Definition: Map.h:325
TransportInstanceMap _instanceTransports
Definition: TransportMgr.h:157
Transport * CreateTransport(uint32 entry, ObjectGuid::LowType guid=UI64LIT(0), Map *map=nullptr, uint32 phaseid=0, uint32 phasegroup=0)
Definition: TransportMgr.cpp:359

+ Here is the call graph for this function:

Transport * TransportMgr::CreateTransport ( uint32  entry,
ObjectGuid::LowType  guid = UI64LIT(0),
Map map = nullptr,
uint32  phaseid = 0,
uint32  phasegroup = 0 
)
360 {
361  // instance case, execute GetGameObjectEntry hook
362  if (map)
363  {
364  // SetZoneScript() is called after adding to map, so fetch the script using map
365  if (map->IsDungeon())
366  if (InstanceScript* instance = static_cast<InstanceMap*>(map)->GetInstanceScript())
367  entry = instance->GetGameObjectEntry(0, entry);
368 
369  if (!entry)
370  return NULL;
371  }
372 
373  TransportTemplate const* tInfo = GetTransportTemplate(entry);
374  if (!tInfo)
375  {
376  TC_LOG_ERROR("sql.sql", "Transport %u will not be loaded, `transport_template` missing", entry);
377  return NULL;
378  }
379 
380  // create transport...
381  Transport* trans = new Transport();
382 
383  // ...at first waypoint
384  TaxiPathNodeEntry const* startNode = tInfo->keyFrames.begin()->Node;
385  uint32 mapId = startNode->MapID;
386  float x = startNode->Loc.X;
387  float y = startNode->Loc.Y;
388  float z = startNode->Loc.Z;
389  float o = tInfo->keyFrames.begin()->InitialOrientation;
390 
391  // initialize the gameobject base
392  ObjectGuid::LowType guidLow = guid ? guid : sObjectMgr->GetGenerator<HighGuid::Transport>().Generate();
393  if (!trans->Create(guidLow, entry, mapId, x, y, z, o, 255))
394  {
395  delete trans;
396  return NULL;
397  }
398 
399  if (phaseid)
400  trans->SetInPhase(phaseid, false, true);
401 
402  if (phasegroup)
403  for (auto ph : sDB2Manager.GetPhasesForGroup(phasegroup))
404  trans->SetInPhase(ph, false, true);
405 
406  if (MapEntry const* mapEntry = sMapStore.LookupEntry(mapId))
407  {
408  if (mapEntry->Instanceable() != tInfo->inInstance)
409  {
410  TC_LOG_ERROR("entities.transport", "Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName().c_str(), mapId);
411  delete trans;
412  return NULL;
413  }
414  }
415 
416  // use preset map for instances (need to know which instance)
417  trans->SetMap(map ? map : sMapMgr->CreateMap(mapId, NULL));
418  if (map && map->IsDungeon())
419  trans->m_zoneScript = map->ToInstanceMap()->GetInstanceScript();
420 
421  // Passengers will be loaded once a player is near
423  trans->GetMap()->AddToMap<Transport>(trans);
424  return trans;
425 }
float Z
Definition: DBCEnums.h:36
#define sDB2Manager
Definition: DB2Stores.h:224
float Y
Definition: DBCEnums.h:35
Map * GetMap() const
Definition: Object.h:543
std::string const & GetName() const
Definition: Object.h:479
virtual void SetMap(Map *map)
Definition: Object.cpp:2169
Definition: DBCStructure.h:830
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Transport.h:28
bool IsDungeon() const
Definition: Map.h:395
uint64 LowType
Definition: ObjectGuid.h:199
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 MapID
Definition: DB2Structure.h:1350
TransportTemplate const * GetTransportTemplate(uint32 entry) const
Definition: TransportMgr.h:120
KeyFrameVec keyFrames
Definition: TransportMgr.h:77
ZoneScript * m_zoneScript
Definition: Object.h:627
G3D::int16 z
Definition: Vector3int16.h:46
bool AddToMap(T *)
Definition: Map.cpp:566
InstanceMap * ToInstanceMap()
Definition: Map.h:495
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
float X
Definition: DBCEnums.h:34
bool Insert(ContainerUnorderedMap< SPECIFIC_TYPE, KEY_TYPE > &elements, KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainerFunctions.h:38
Definition: DB2Structure.h:1345
bool inInstance
Definition: TransportMgr.h:75
DBCPosition3D Loc
Definition: DB2Structure.h:1351
InstanceScript * GetInstanceScript()
Definition: Map.h:769
DBCStorage< MapEntry > sMapStore(Mapfmt)
bool SetInPhase(uint32 id, bool update, bool apply) override
Definition: GameObject.cpp:2194
static TransportMgr * instance()
Definition: TransportMgr.cpp:38
#define sMapMgr
Definition: MapManager.h:194
Definition: InstanceScript.h:141
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
G3D::int16 x
Definition: Vector2int16.h:37
bool Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
Definition: Transport.cpp:46
Definition: TransportMgr.h:69

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TransportMgr::GeneratePath ( GameObjectTemplate const goInfo,
TransportTemplate transport 
)
private
116 {
117  uint32 pathId = goInfo->moTransport.taxiPathID;
118  TaxiPathNodeList const& path = sTaxiPathNodesByPath[pathId];
119  std::vector<KeyFrame>& keyFrames = transport->keyFrames;
120  Movement::PointsArray splinePath, allPoints;
121  bool mapChange = false;
122  for (size_t i = 0; i < path.size(); ++i)
123  allPoints.push_back(G3D::Vector3(path[i]->Loc.X, path[i]->Loc.Y, path[i]->Loc.Z));
124 
125  // Add extra points to allow derivative calculations for all path nodes
126  allPoints.insert(allPoints.begin(), allPoints.front().lerp(allPoints[1], -0.2f));
127  allPoints.push_back(allPoints.back().lerp(allPoints[allPoints.size() - 2], -0.2f));
128  allPoints.push_back(allPoints.back().lerp(allPoints[allPoints.size() - 2], -1.0f));
129 
130  SplineRawInitializer initer(allPoints);
131  TransportSpline orientationSpline;
132  orientationSpline.init_spline_custom(initer);
133  orientationSpline.initLengths();
134 
135  for (size_t i = 0; i < path.size(); ++i)
136  {
137  if (!mapChange)
138  {
139  TaxiPathNodeEntry const* node_i = path[i];
140  if (i != path.size() - 1 && (node_i->Flags & TAXI_PATH_NODE_FLAG_TELEPORT || node_i->MapID != path[i + 1]->MapID))
141  {
142  keyFrames.back().Teleport = true;
143  mapChange = true;
144  }
145  else
146  {
147  KeyFrame k(node_i);
148  G3D::Vector3 h;
149  orientationSpline.evaluate_derivative(i + 1, 0.0f, h);
150  k.InitialOrientation = Position::NormalizeOrientation(std::atan2(h.y, h.x) + float(M_PI));
151 
152  keyFrames.push_back(k);
153  splinePath.push_back(G3D::Vector3(node_i->Loc.X, node_i->Loc.Y, node_i->Loc.Z));
154  transport->mapsUsed.insert(k.Node->MapID);
155  }
156  }
157  else
158  mapChange = false;
159  }
160 
161  if (splinePath.size() >= 2)
162  {
163  // Remove special catmull-rom spline points
164  if (!keyFrames.front().IsStopFrame() && !keyFrames.front().Node->ArrivalEventID && !keyFrames.front().Node->DepartureEventID)
165  {
166  splinePath.erase(splinePath.begin());
167  keyFrames.erase(keyFrames.begin());
168  }
169  if (!keyFrames.back().IsStopFrame() && !keyFrames.back().Node->ArrivalEventID && !keyFrames.back().Node->DepartureEventID)
170  {
171  splinePath.pop_back();
172  keyFrames.pop_back();
173  }
174  }
175 
176  ASSERT(!keyFrames.empty());
177 
178  if (transport->mapsUsed.size() > 1)
179  {
180  for (std::set<uint32>::const_iterator itr = transport->mapsUsed.begin(); itr != transport->mapsUsed.end(); ++itr)
181  ASSERT(!sMapStore.LookupEntry(*itr)->Instanceable());
182 
183  transport->inInstance = false;
184  }
185  else
186  transport->inInstance = sMapStore.LookupEntry(*transport->mapsUsed.begin())->Instanceable();
187 
188  // last to first is always "teleport", even for closed paths
189  keyFrames.back().Teleport = true;
190 
191  const float speed = float(goInfo->moTransport.moveSpeed);
192  const float accel = float(goInfo->moTransport.accelRate);
193  const float accel_dist = 0.5f * speed * speed / accel;
194 
195  transport->accelTime = speed / accel;
196  transport->accelDist = accel_dist;
197 
198  int32 firstStop = -1;
199  int32 lastStop = -1;
200 
201  // first cell is arrived at by teleportation :S
202  keyFrames[0].DistFromPrev = 0;
203  keyFrames[0].Index = 1;
204  if (keyFrames[0].IsStopFrame())
205  {
206  firstStop = 0;
207  lastStop = 0;
208  }
209 
210  // find the rest of the distances between key points
211  // Every path segment has its own spline
212  size_t start = 0;
213  for (size_t i = 1; i < keyFrames.size(); ++i)
214  {
215  if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.size())
216  {
217  size_t extra = !keyFrames[i - 1].Teleport ? 1 : 0;
218  TransportSpline* spline = new TransportSpline();
219  spline->init_spline(&splinePath[start], i - start + extra, Movement::SplineBase::ModeCatmullrom);
220  spline->initLengths();
221  for (size_t j = start; j < i + extra; ++j)
222  {
223  keyFrames[j].Index = j - start + 1;
224  keyFrames[j].DistFromPrev = float(spline->length(j - start, j + 1 - start));
225  if (j > 0)
226  keyFrames[j - 1].NextDistFromPrev = keyFrames[j].DistFromPrev;
227  keyFrames[j].Spline = spline;
228  }
229 
230  if (keyFrames[i - 1].Teleport)
231  {
232  keyFrames[i].Index = i - start + 1;
233  keyFrames[i].DistFromPrev = 0.0f;
234  keyFrames[i - 1].NextDistFromPrev = 0.0f;
235  keyFrames[i].Spline = spline;
236  }
237 
238  start = i;
239  }
240 
241  if (keyFrames[i].IsStopFrame())
242  {
243  // remember first stop frame
244  if (firstStop == -1)
245  firstStop = i;
246  lastStop = i;
247  }
248  }
249 
250  keyFrames.back().NextDistFromPrev = keyFrames.front().DistFromPrev;
251 
252  if (firstStop == -1 || lastStop == -1)
253  firstStop = lastStop = 0;
254 
255  // at stopping keyframes, we define distSinceStop == 0,
256  // and distUntilStop is to the next stopping keyframe.
257  // this is required to properly handle cases of two stopping frames in a row (yes they do exist)
258  float tmpDist = 0.0f;
259  for (size_t i = 0; i < keyFrames.size(); ++i)
260  {
261  int32 j = (i + lastStop) % keyFrames.size();
262  if (keyFrames[j].IsStopFrame() || j == lastStop)
263  tmpDist = 0.0f;
264  else
265  tmpDist += keyFrames[j].DistFromPrev;
266  keyFrames[j].DistSinceStop = tmpDist;
267  }
268 
269  tmpDist = 0.0f;
270  for (int32 i = int32(keyFrames.size()) - 1; i >= 0; i--)
271  {
272  int32 j = (i + firstStop) % keyFrames.size();
273  tmpDist += keyFrames[(j + 1) % keyFrames.size()].DistFromPrev;
274  keyFrames[j].DistUntilStop = tmpDist;
275  if (keyFrames[j].IsStopFrame() || j == firstStop)
276  tmpDist = 0.0f;
277  }
278 
279  for (size_t i = 0; i < keyFrames.size(); ++i)
280  {
281  float total_dist = keyFrames[i].DistSinceStop + keyFrames[i].DistUntilStop;
282  if (total_dist < 2 * accel_dist) // won't reach full speed
283  {
284  if (keyFrames[i].DistSinceStop < keyFrames[i].DistUntilStop) // is still accelerating
285  {
286  // calculate accel+brake time for this short segment
287  float segment_time = 2.0f * std::sqrt((keyFrames[i].DistUntilStop + keyFrames[i].DistSinceStop) / accel);
288  // substract acceleration time
289  keyFrames[i].TimeTo = segment_time - std::sqrt(2 * keyFrames[i].DistSinceStop / accel);
290  }
291  else // slowing down
292  keyFrames[i].TimeTo = std::sqrt(2 * keyFrames[i].DistUntilStop / accel);
293  }
294  else if (keyFrames[i].DistSinceStop < accel_dist) // still accelerating (but will reach full speed)
295  {
296  // calculate accel + cruise + brake time for this long segment
297  float segment_time = (keyFrames[i].DistUntilStop + keyFrames[i].DistSinceStop) / speed + (speed / accel);
298  // substract acceleration time
299  keyFrames[i].TimeTo = segment_time - std::sqrt(2 * keyFrames[i].DistSinceStop / accel);
300  }
301  else if (keyFrames[i].DistUntilStop < accel_dist) // already slowing down (but reached full speed)
302  keyFrames[i].TimeTo = std::sqrt(2 * keyFrames[i].DistUntilStop / accel);
303  else // at full speed
304  keyFrames[i].TimeTo = (keyFrames[i].DistUntilStop / speed) + (0.5f * speed / accel);
305  }
306 
307  // calculate tFrom times from tTo times
308  float segmentTime = 0.0f;
309  for (size_t i = 0; i < keyFrames.size(); ++i)
310  {
311  int32 j = (i + lastStop) % keyFrames.size();
312  if (keyFrames[j].IsStopFrame() || j == lastStop)
313  segmentTime = keyFrames[j].TimeTo;
314  keyFrames[j].TimeFrom = segmentTime - keyFrames[j].TimeTo;
315  }
316 
317  // calculate path times
318  keyFrames[0].ArriveTime = 0;
319  float curPathTime = 0.0f;
320  if (keyFrames[0].IsStopFrame())
321  {
322  curPathTime = float(keyFrames[0].Node->Delay);
323  keyFrames[0].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
324  }
325 
326  for (size_t i = 1; i < keyFrames.size(); ++i)
327  {
328  curPathTime += keyFrames[i - 1].TimeTo;
329  if (keyFrames[i].IsStopFrame())
330  {
331  keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
332  keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
333  curPathTime += float(keyFrames[i].Node->Delay);
334  keyFrames[i].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
335  }
336  else
337  {
338  curPathTime -= keyFrames[i].TimeTo;
339  keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
340  keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
341  keyFrames[i].DepartureTime = keyFrames[i].ArriveTime;
342  }
343  }
344 
345  keyFrames.back().NextArriveTime = keyFrames.back().DepartureTime;
346 
347  transport->pathTime = keyFrames.back().DepartureTime;
348 }
float Z
Definition: DBCEnums.h:36
float x
Definition: Vector3.h:62
float Y
Definition: DBCEnums.h:35
#define M_PI
Definition: Common.h:163
void init_spline(const Vector3 *controls, index_type count, EvaluationMode m)
Definition: Spline.h:172
Movement::Spline< double > TransportSpline
Definition: TransportMgr.h:31
void initLengths()
Definition: SplineImpl.h:79
float accelTime
Definition: TransportMgr.h:78
Definition: TransportMgr.cpp:98
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DB2Stores.cpp:139
static float NormalizeOrientation(float o)
Definition: Position.h:211
float y
Definition: Vector3.h:62
Definition: Vector3.h:58
std::set< uint32 > mapsUsed
Definition: TransportMgr.h:74
uint32 MapID
Definition: DB2Structure.h:1350
KeyFrameVec keyFrames
Definition: TransportMgr.h:77
uint32 Flags
Definition: DB2Structure.h:1352
length_type length() const
Definition: Spline.h:199
std::vector< Vector3 > PointsArray
Definition: MoveSplineInitArgs.h:30
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
float X
Definition: DBCEnums.h:34
Definition: DB2Structure.h:1345
bool inInstance
Definition: TransportMgr.h:75
DBCPosition3D Loc
Definition: DB2Structure.h:1351
Definition: Spline.h:135
DBCStorage< MapEntry > sMapStore(Mapfmt)
Definition: Common.h:103
int32_t int32
Definition: g3dmath.h:167
#define ASSERT
Definition: Errors.h:55
uint32_t uint32
Definition: g3dmath.h:168
Definition: TransportMgr.h:40
uint32 pathTime
Definition: TransportMgr.h:76
Definition: DBCEnums.h:701
void evaluate_derivative(float t, Vector3 &hermite) const
Definition: SplineImpl.h:29
std::vector< TaxiPathNodeEntry const * > TaxiPathNodeList
Definition: DB2Structure.h:1449
float accelDist
Definition: TransportMgr.h:79

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TransportAnimation const* TransportMgr::GetTransportAnimInfo ( uint32  entry) const
inline
129  {
130  TransportAnimationContainer::const_iterator itr = _transportAnimations.find(entry);
131  if (itr != _transportAnimations.end())
132  return &itr->second;
133 
134  return NULL;
135  }
arena_t NULL
Definition: jemalloc_internal.h:624
TransportAnimationContainer _transportAnimations
Definition: TransportMgr.h:159
TransportTemplate const* TransportMgr::GetTransportTemplate ( uint32  entry) const
inline
121  {
122  TransportTemplates::const_iterator itr = _transportTemplates.find(entry);
123  if (itr != _transportTemplates.end())
124  return &itr->second;
125  return NULL;
126  }
arena_t NULL
Definition: jemalloc_internal.h:624
TransportTemplates _transportTemplates
Definition: TransportMgr.h:154

+ Here is the caller graph for this function:

TransportMgr * TransportMgr::instance ( )
static
39 {
40  static TransportMgr instance;
41  return &instance;
42 }
Definition: TransportMgr.h:100
static TransportMgr * instance()
Definition: TransportMgr.cpp:38

+ Here is the caller graph for this function:

void TransportMgr::LoadTransportTemplates ( )
50 {
51  uint32 oldMSTime = getMSTime();
52 
53  QueryResult result = WorldDatabase.Query("SELECT entry FROM gameobject_template WHERE type = 15 ORDER BY entry ASC");
54 
55  if (!result)
56  {
57  TC_LOG_INFO("server.loading", ">> Loaded 0 transport templates. DB table `gameobject_template` has no transports!");
58  return;
59  }
60 
61  uint32 count = 0;
62 
63  do
64  {
65  Field* fields = result->Fetch();
66  uint32 entry = fields[0].GetUInt32();
67  GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
68  if (goInfo == NULL)
69  {
70  TC_LOG_ERROR("sql.sql", "Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry);
71  continue;
72  }
73 
74  if (goInfo->moTransport.taxiPathID >= sTaxiPathNodesByPath.size())
75  {
76  TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) has an invalid path specified in `gameobject_template`.`Data0` (%u) field, skipped.", entry, goInfo->name.c_str(), goInfo->moTransport.taxiPathID);
77  continue;
78  }
79 
80  if (!goInfo->moTransport.taxiPathID)
81  continue;
82 
83  // paths are generated per template, saves us from generating it again in case of instanced transports
84  TransportTemplate& transport = _transportTemplates[entry];
85  transport.entry = entry;
86  GeneratePath(goInfo, &transport);
87 
88  // transports in instance are only on one map
89  if (transport.inInstance)
90  _instanceTransports[*transport.mapsUsed.begin()].insert(entry);
91 
92  ++count;
93  } while (result->NextRow());
94 
95  TC_LOG_INFO("server.loading", ">> Loaded %u transport templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
96 }
void GeneratePath(GameObjectTemplate const *goInfo, TransportTemplate *transport)
Definition: TransportMgr.cpp:115
uint32 entry
Definition: TransportMgr.h:80
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: GameObject.h:34
arena_t NULL
Definition: jemalloc_internal.h:624
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DB2Stores.cpp:139
#define sObjectMgr
Definition: ObjectMgr.h:1567
std::set< uint32 > mapsUsed
Definition: TransportMgr.h:74
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
bool inInstance
Definition: TransportMgr.h:75
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
std::string name
Definition: GameObject.h:39
struct GameObjectTemplate::@221::@238 moTransport
uint32 GetUInt32() const
Definition: Field.h:146
TransportInstanceMap _instanceTransports
Definition: TransportMgr.h:157
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
TransportTemplates _transportTemplates
Definition: TransportMgr.h:154
Definition: TransportMgr.h:69

+ Here is the call graph for this function:

TransportMgr& TransportMgr::operator= ( TransportMgr const )
private
void TransportMgr::SpawnContinentTransports ( )
428 {
429  if (_transportTemplates.empty())
430  return;
431 
432  uint32 oldMSTime = getMSTime();
433 
434  QueryResult result = WorldDatabase.Query("SELECT guid, entry, phaseid, phasegroup FROM transports");
435 
436  uint32 count = 0;
437  if (result)
438  {
439  do
440  {
441  Field* fields = result->Fetch();
442  ObjectGuid::LowType guid = fields[0].GetUInt64();
443  uint32 entry = fields[1].GetUInt32();
444  uint32 phaseid = fields[2].GetUInt32();
445  uint32 phasegroup = fields[3].GetUInt32();
446 
447  if (TransportTemplate const* tInfo = GetTransportTemplate(entry))
448  if (!tInfo->inInstance)
449  if (CreateTransport(entry, guid, nullptr, phaseid, phasegroup))
450  ++count;
451 
452  } while (result->NextRow());
453  }
454 
455  TC_LOG_INFO("server.loading", ">> Spawned %u continent transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
456 }
uint64 GetUInt64() const
Definition: Field.h:184
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint64 LowType
Definition: ObjectGuid.h:199
TransportTemplate const * GetTransportTemplate(uint32 entry) const
Definition: TransportMgr.h:120
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Transport * CreateTransport(uint32 entry, ObjectGuid::LowType guid=UI64LIT(0), Map *map=nullptr, uint32 phaseid=0, uint32 phasegroup=0)
Definition: TransportMgr.cpp:359
TransportTemplates _transportTemplates
Definition: TransportMgr.h:154
Definition: TransportMgr.h:69

+ Here is the call graph for this function:

void TransportMgr::Unload ( )
45 {
46  _transportTemplates.clear();
47 }
TransportTemplates _transportTemplates
Definition: TransportMgr.h:154

Friends And Related Function Documentation

void DB2Manager::LoadStores ( std::string const ,
uint32   
)
friend

Member Data Documentation

TransportInstanceMap TransportMgr::_instanceTransports
private
TransportAnimationContainer TransportMgr::_transportAnimations
private
TransportTemplates TransportMgr::_transportTemplates
private

The documentation for this class was generated from the following files: