TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Garrison.cpp File Reference
#include "Garrison.h"
#include "Creature.h"
#include "GameObject.h"
#include "GarrisonMgr.h"
#include "MapManager.h"
#include "ObjectMgr.h"
#include "VehicleDefines.h"
+ Include dependency graph for Garrison.cpp:

Functions

template<class T , void(T::*)(float, float, float, float) SecondaryRelocate>
T * BuildingSpawnHelper (GameObject *building, ObjectGuid::LowType spawnId, Map *map)
 

Function Documentation

template<class T , void(T::*)(float, float, float, float) SecondaryRelocate>
T* BuildingSpawnHelper ( GameObject building,
ObjectGuid::LowType  spawnId,
Map map 
)
663 {
664  T* spawn = new T();
665  if (!spawn->LoadFromDB(spawnId, map))
666  {
667  delete spawn;
668  return nullptr;
669  }
670 
671  float x = spawn->GetPositionX();
672  float y = spawn->GetPositionY();
673  float z = spawn->GetPositionZ();
674  float o = spawn->GetOrientation();
675  TransportBase::CalculatePassengerPosition(x, y, z, &o, building->GetPositionX(), building->GetPositionY(), building->GetPositionZ(), building->GetOrientation());
676 
677  spawn->Relocate(x, y, z, o);
678  (spawn->*SecondaryRelocate)(x, y, z, o);
679 
680  if (!spawn->IsPositionValid())
681  {
682  delete spawn;
683  return nullptr;
684  }
685 
686  if (!map->AddToMap(spawn))
687  {
688  delete spawn;
689  return nullptr;
690  }
691 
692  return spawn;
693 }
virtual void CalculatePassengerPosition(float &x, float &y, float &z, float *o=NULL) const =0
This method transforms supplied transport offsets into global coordinates.
float GetOrientation() const
Definition: Position.h:107
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
bool AddToMap(T *)
Definition: Map.cpp:566
float GetPositionZ() const
Definition: Position.h:106
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function: