diff options
Diffstat (limited to 'src')
53 files changed, 253 insertions, 301 deletions
diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp index ad3753ea3c9..bca738d1ff6 100644 --- a/src/server/collision/BoundingIntervalHierarchy.cpp +++ b/src/server/collision/BoundingIntervalHierarchy.cpp @@ -18,6 +18,12 @@  #include "BoundingIntervalHierarchy.h" +#if defined __APPLE__ +  #define isnan std::isnan +#elif defined _MSC_VER +  #define isnan _isnan +#endif +  void BIH::buildHierarchy(std::vector<uint32> &tempTree, buildData &dat, BuildStats &stats)  {      // create space for the first node @@ -51,7 +57,7 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat          prevAxis = axis;          prevSplit = split;          // perform quick consistency checks -        Vector3 d( gridBox.hi - gridBox.lo ); +        G3D::Vector3 d( gridBox.hi - gridBox.lo );          if (d.x < 0 || d.y < 0 || d.z < 0)              throw std::logic_error("negative node extents");          for (int i = 0; i < 3; i++) @@ -255,11 +261,11 @@ bool BIH::writeToFile(FILE* wf) const  bool BIH::readFromFile(FILE* rf)  {      uint32 treeSize; -    Vector3 lo, hi; +    G3D::Vector3 lo, hi;      uint32 check=0, count=0;      check += fread(&lo, sizeof(float), 3, rf);      check += fread(&hi, sizeof(float), 3, rf); -    bounds = AABox(lo, hi); +    bounds = G3D::AABox(lo, hi);      check += fread(&treeSize, sizeof(uint32), 1, rf);      tree.resize(treeSize);      check += fread(&tree[0], sizeof(uint32), treeSize, rf); diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index 7cbaedbfba6..997f9c99e5f 100644 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -31,20 +31,8 @@  #include <limits>  #include <cmath> -#ifdef __APPLE__ -  #define isnan(x) ( std::isnan(x) ) -#endif -  #define MAX_STACK_SIZE 64 -#ifdef _MSC_VER -    #define isnan(x) _isnan(x) -#endif - -using G3D::Vector3; -using G3D::AABox; -using G3D::Ray; -  static inline uint32 floatToRawIntBits(float f)  {      union @@ -69,7 +57,7 @@ static inline float intBitsToFloat(uint32 i)  struct AABound  { -    Vector3 lo, hi; +    G3D::Vector3 lo, hi;  };  /** Bounding Interval Hierarchy Class. @@ -105,12 +93,11 @@ class BIH              dat.maxPrims = leafSize;              dat.numPrims = primitives.size();              dat.indices = new uint32[dat.numPrims]; -            dat.primBound = new AABox[dat.numPrims]; +            dat.primBound = new G3D::AABox[dat.numPrims];              getBounds(primitives[0], bounds);              for (uint32 i=0; i<dat.numPrims; ++i)              {                  dat.indices[i] = i; -                AABox tb;                  getBounds(primitives[i], dat.primBound[i]);                  bounds.merge(dat.primBound[i]);              } @@ -131,13 +118,13 @@ class BIH          uint32 primCount() const { return objects.size(); }          template<typename RayCallback> -        void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const +        void intersectRay(const G3D::Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const          {              float intervalMin = -1.f;              float intervalMax = -1.f; -            Vector3 org = r.origin(); -            Vector3 dir = r.direction(); -            Vector3 invDir; +            G3D::Vector3 org = r.origin(); +            G3D::Vector3 dir = r.direction(); +            G3D::Vector3 invDir;              for (int i=0; i<3; ++i)              {                  invDir[i] = 1.f / dir[i]; @@ -270,7 +257,7 @@ class BIH          }          template<typename IsectCallback> -        void intersectPoint(const Vector3 &p, IsectCallback& intersectCallback) const +        void intersectPoint(const G3D::Vector3 &p, IsectCallback& intersectCallback) const          {              if (!bounds.contains(p))                  return; @@ -353,12 +340,12 @@ class BIH      protected:          std::vector<uint32> tree;          std::vector<uint32> objects; -        AABox bounds; +        G3D::AABox bounds;          struct buildData          {              uint32 *indices; -            AABox *primBound; +            G3D::AABox *primBound;              uint32 numPrims;              int maxPrims;          }; @@ -410,4 +397,4 @@ class BIH          void subdivide(int left, int right, std::vector<uint32> &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats);  }; -#endif // _BIH_H
\ No newline at end of file +#endif // _BIH_H diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h index 315f3004306..305d57b0075 100644 --- a/src/server/collision/BoundingIntervalHierarchyWrapper.h +++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h @@ -37,7 +37,7 @@ class BIHWrap          MDLCallback(RayCallback& callback, const T* const* objects_array, uint32 objects_size ) : objects(objects_array), _callback(callback), objects_size(objects_size) {} -        bool operator() (const Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) +        bool operator() (const G3D::Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/)          {              if (Idx >= objects_size)                  return false; @@ -46,7 +46,7 @@ class BIHWrap              return false;          } -        void operator() (const Vector3& p, uint32 Idx) +        void operator() (const G3D::Vector3& p, uint32 Idx)          {              if (Idx >= objects_size)                  return false; @@ -98,7 +98,7 @@ public:      }      template<typename RayCallback> -    void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& maxDist) +    void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& maxDist)      {          balance();          MDLCallback<RayCallback> temp_cb(intersectCallback, m_objects.getCArray(), m_objects.size()); @@ -106,7 +106,7 @@ public:      }      template<typename IsectCallback> -    void intersectPoint(const Vector3& point, IsectCallback& intersectCallback) +    void intersectPoint(const G3D::Vector3& point, IsectCallback& intersectCallback)      {          balance();          MDLCallback<IsectCallback> callback(intersectCallback, m_objects.getCArray(), m_objects.size()); diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp index c6754278d17..c70a4b78a03 100644 --- a/src/server/collision/DynamicTree.cpp +++ b/src/server/collision/DynamicTree.cpp @@ -27,15 +27,24 @@  #include "GameObjectModel.h"  #include "ModelInstance.h" +#include <G3D/AABox.h> +#include <G3D/Ray.h> +#include <G3D/Vector3.h> +  using VMAP::ModelInstance; -using G3D::Ray; + +namespace { + +int CHECK_TREE_PERIOD = 200; + +} // namespace  template<> struct HashTrait< GameObjectModel>{      static size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; }  };  template<> struct PositionTrait< GameObjectModel> { -    static void getPosition(const GameObjectModel& g, Vector3& p) { p = g.getPosition(); } +    static void getPosition(const GameObjectModel& g, G3D::Vector3& p) { p = g.getPosition(); }  };  template<> struct BoundsTrait< GameObjectModel> { @@ -49,11 +58,6 @@ static bool operator == (const GameObjectModel& mdl, const GameObjectModel& mdl2  }  */ -int valuesPerNode = 5, numMeanSplits = 3; - -int UNBALANCED_TIMES_LIMIT = 5; -int CHECK_TREE_PERIOD = 200; -  typedef RegularGrid2D<GameObjectModel, BIHWrap<GameObjectModel> > ParentTree;  struct DynTreeImpl : public ParentTree/*, public Intersectable*/ @@ -103,43 +107,43 @@ struct DynTreeImpl : public ParentTree/*, public Intersectable*/      int unbalanced_times;  }; -DynamicMapTree::DynamicMapTree() : impl(*new DynTreeImpl()) +DynamicMapTree::DynamicMapTree() : impl(new DynTreeImpl())  {  }  DynamicMapTree::~DynamicMapTree()  { -    delete &impl; +    delete impl;  }  void DynamicMapTree::insert(const GameObjectModel& mdl)  { -    impl.insert(mdl); +    impl->insert(mdl);  }  void DynamicMapTree::remove(const GameObjectModel& mdl)  { -    impl.remove(mdl); +    impl->remove(mdl);  }  bool DynamicMapTree::contains(const GameObjectModel& mdl) const  { -    return impl.contains(mdl); +    return impl->contains(mdl);  }  void DynamicMapTree::balance()  { -    impl.balance(); +    impl->balance();  }  int DynamicMapTree::size() const  { -    return impl.size(); +    return impl->size();  }  void DynamicMapTree::update(uint32 t_diff)  { -    impl.update(t_diff); +    impl->update(t_diff);  }  struct DynamicTreeIntersectionCallback @@ -147,7 +151,7 @@ struct DynamicTreeIntersectionCallback      bool did_hit;      uint32 phase_mask;      DynamicTreeIntersectionCallback(uint32 phasemask) : did_hit(false), phase_mask(phasemask) {} -    bool operator()(const Ray& r, const GameObjectModel& obj, float& distance) +    bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance)      {          did_hit = obj.intersectRay(r, distance, true, phase_mask);          return did_hit; @@ -163,7 +167,7 @@ struct DynamicTreeIntersectionCallback_WithLogger      {          sLog->outDebug(LOG_FILTER_MAPS, "Dynamic Intersection log");      } -    bool operator()(const Ray& r, const GameObjectModel& obj, float& distance) +    bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance)      {          sLog->outDebug(LOG_FILTER_MAPS, "testing intersection with %s", obj.name.c_str());          bool hit = obj.intersectRay(r, distance, true, phase_mask); @@ -177,17 +181,20 @@ struct DynamicTreeIntersectionCallback_WithLogger      bool didHit() const { return did_hit;}  }; -bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray& ray, const Vector3& endPos, float& maxDist) const +bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray& ray, +                                         const G3D::Vector3& endPos, float& maxDist) const  {      float distance = maxDist;      DynamicTreeIntersectionCallback callback(phasemask); -    impl.intersectRay(ray, callback, distance, endPos); +    impl->intersectRay(ray, callback, distance, endPos);      if (callback.didHit())          maxDist = distance;      return callback.didHit();  } -bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const Vector3& startPos, const Vector3& endPos, Vector3& resultHit, float modifyDist) const +bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const G3D::Vector3& startPos, +                                     const G3D::Vector3& endPos, G3D::Vector3& resultHit, +                                     float modifyDist) const  {      bool result = false;      float maxDist = (endPos - startPos).magnitude(); @@ -199,7 +206,7 @@ bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const Vector3& star          resultHit = endPos;          return false;      } -    Vector3 dir = (endPos - startPos)/maxDist;              // direction with length of 1 +    G3D::Vector3 dir = (endPos - startPos)/maxDist;              // direction with length of 1      G3D::Ray ray(startPos, dir);      float dist = maxDist;      if (getIntersectionTime(phasemask, ray, endPos, dist)) @@ -227,26 +234,26 @@ bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const Vector3& star  bool DynamicMapTree::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const  { -    Vector3 v1(x1, y1, z1), v2(x2, y2, z2); +    G3D::Vector3 v1(x1, y1, z1), v2(x2, y2, z2);      float maxDist = (v2 - v1).magnitude();      if (!G3D::fuzzyGt(maxDist, 0) )          return true; -    Ray r(v1, (v2-v1) / maxDist); +    G3D::Ray r(v1, (v2-v1) / maxDist);      DynamicTreeIntersectionCallback callback(phasemask); -    impl.intersectRay(r, callback, maxDist, v2); +    impl->intersectRay(r, callback, maxDist, v2);      return !callback.did_hit;  }  float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const  { -    Vector3 v(x, y, z); -    Ray r(v, Vector3(0, 0, -1)); +    G3D::Vector3 v(x, y, z); +    G3D::Ray r(v, G3D::Vector3(0, 0, -1));      DynamicTreeIntersectionCallback callback(phasemask); -    impl.intersectZAllignedRay(r, callback, maxSearchDist); +    impl->intersectZAllignedRay(r, callback, maxSearchDist);      if (callback.didHit())          return v.z - maxSearchDist; diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h index ca199a9cd70..8e541fd453a 100644 --- a/src/server/collision/DynamicTree.h +++ b/src/server/collision/DynamicTree.h @@ -20,34 +20,36 @@  #ifndef _DYNTREE_H  #define _DYNTREE_H -#include <G3D/Matrix3.h> -#include <G3D/Vector3.h> -#include <G3D/AABox.h> -#include <G3D/Ray.h> - -//#include "ModelInstance.h"  #include "Define.h" -//#include "GameObjectModel.h"  namespace G3D  { +    class Ray;      class Vector3;  } -using G3D::Vector3;  class GameObjectModel; +struct DynTreeImpl;  class DynamicMapTree  { -    struct DynTreeImpl& impl; +    DynTreeImpl *impl; +  public:      DynamicMapTree();      ~DynamicMapTree(); -    bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; -    bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray, const Vector3& endPos, float& maxDist) const; -    bool getObjectHitPos(uint32 phasemask, const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const; +    bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, +                         float z2, uint32 phasemask) const; + +    bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray, +                             const G3D::Vector3& endPos, float& maxDist) const; + +    bool getObjectHitPos(uint32 phasemask, const G3D::Vector3& pPos1, +                         const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos, +                         float pModifyDist) const; +      float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;      void insert(const GameObjectModel&); diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h index c8e9628dff1..5de8e616d2b 100644 --- a/src/server/collision/Maps/MapTree.h +++ b/src/server/collision/Maps/MapTree.h @@ -72,7 +72,7 @@ namespace VMAP              bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const;              float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const;              bool getAreaInfo(G3D::Vector3 &pos, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const; -            bool GetLocationInfo(const Vector3 &pos, LocationInfo &info) const; +            bool GetLocationInfo(const G3D::Vector3 &pos, LocationInfo &info) const;              bool InitMap(const std::string &fname, VMapManager2* vm);              void UnloadMap(VMapManager2* vm); diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h index ade9efbb040..cea32cfedfb 100644 --- a/src/server/collision/Models/WorldModel.h +++ b/src/server/collision/Models/WorldModel.h @@ -47,11 +47,11 @@ namespace VMAP      class WmoLiquid      {          public: -            WmoLiquid(uint32 width, uint32 height, const Vector3 &corner, uint32 type); +            WmoLiquid(uint32 width, uint32 height, const G3D::Vector3 &corner, uint32 type);              WmoLiquid(const WmoLiquid &other);              ~WmoLiquid();              WmoLiquid& operator=(const WmoLiquid &other); -            bool GetLiquidHeight(const Vector3 &pos, float &liqHeight) const; +            bool GetLiquidHeight(const G3D::Vector3 &pos, float &liqHeight) const;              uint32 GetType() const { return iType; }              float *GetHeightStorage() { return iHeight; }              uint8 *GetFlagsStorage() { return iFlags; } @@ -60,14 +60,14 @@ namespace VMAP              static bool readFromFile(FILE* rf, WmoLiquid* &liquid);          private:              WmoLiquid(): iHeight(0), iFlags(0) {}; -            uint32 iTilesX;  //!< number of tiles in x direction, each +            uint32 iTilesX;       //!< number of tiles in x direction, each              uint32 iTilesY; -            Vector3 iCorner; //!< the lower corner -            uint32 iType;    //!< liquid type -            float *iHeight;  //!< (tilesX + 1)*(tilesY + 1) height values -            uint8 *iFlags;   //!< info if liquid tile is used +            G3D::Vector3 iCorner; //!< the lower corner +            uint32 iType;         //!< liquid type +            float *iHeight;       //!< (tilesX + 1)*(tilesY + 1) height values +            uint8 *iFlags;        //!< info if liquid tile is used          public: -            void getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const; +            void getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const;      };      /*! holding additional info for WMO group files */ @@ -76,16 +76,16 @@ namespace VMAP          public:              GroupModel(): iLiquid(0) {}              GroupModel(const GroupModel &other); -            GroupModel(uint32 mogpFlags, uint32 groupWMOID, const AABox &bound): +            GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox &bound):                          iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) {}              ~GroupModel() { delete iLiquid; }              //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! -            void setMeshData(std::vector<Vector3> &vert, std::vector<MeshTriangle> &tri); +            void setMeshData(std::vector<G3D::Vector3> &vert, std::vector<MeshTriangle> &tri);              void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = NULL; }              bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const; -            bool IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const; -            bool GetLiquidLevel(const Vector3 &pos, float &liqHeight) const; +            bool IsInsideObject(const G3D::Vector3 &pos, const G3D::Vector3 &down, float &z_dist) const; +            bool GetLiquidLevel(const G3D::Vector3 &pos, float &liqHeight) const;              uint32 GetLiquidType() const;              bool writeToFile(FILE* wf);              bool readFromFile(FILE* rf); @@ -96,12 +96,12 @@ namespace VMAP              G3D::AABox iBound;              uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor              uint32 iGroupWMOID; -            std::vector<Vector3> vertices; +            std::vector<G3D::Vector3> vertices;              std::vector<MeshTriangle> triangles;              BIH meshTree;              WmoLiquid* iLiquid;          public: -            void getMeshData(std::vector<Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid); +            void getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid);      };      /*! Holds a model (converted M2 or WMO) in its original coordinate space */      class WorldModel diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index f38bf357a19..d1832c1ea06 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -3,18 +3,12 @@  #include <G3D/Ray.h> -#include <G3D/AABox.h>  #include <G3D/Table.h>  #include <G3D/BoundsTrait.h>  #include <G3D/PositionTrait.h>  #include "Errors.h" -using G3D::Vector2; -using G3D::Vector3; -using G3D::AABox; -using G3D::Ray; -  template<class Node>  struct NodeCreator{      static Node * makeNode(int /*x*/, int /*y*/) { return new Node();} @@ -54,7 +48,7 @@ public:      void insert(const T& value)      { -        Vector3 pos; +        G3D::Vector3 pos;          PositionFunc::getPosition(value, pos);          Node& node = getGridFor(pos.x, pos.y);          node.insert(value); @@ -109,13 +103,13 @@ public:      }      template<typename RayCallback> -    void intersectRay(const Ray& ray, RayCallback& intersectCallback, float max_dist) +    void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float max_dist)      {          intersectRay(ray, intersectCallback, max_dist, ray.origin() + ray.direction() * max_dist);      }      template<typename RayCallback> -    void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist, const Vector3& end) +    void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist, const G3D::Vector3& end)      {          Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);          if (!cell.isValid()) @@ -191,7 +185,7 @@ public:      }      template<typename IsectCallback> -    void intersectPoint(const Vector3& point, IsectCallback& intersectCallback) +    void intersectPoint(const G3D::Vector3& point, IsectCallback& intersectCallback)      {          Cell cell = Cell::ComputeCell(point.x, point.y);          if (!cell.isValid()) @@ -202,7 +196,7 @@ public:      // Optimized verson of intersectRay function for rays with vertical directions      template<typename RayCallback> -    void intersectZAllignedRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist) +    void intersectZAllignedRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist)      {          Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);          if (!cell.isValid()) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index ec118b44f59..30c0b59d5a2 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -819,7 +819,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)  Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team)  {      //Get map object -    Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(m_MapId)); +    Map* map = sMapMgr->CreateBaseMap(m_MapId);      if (!map)      {          sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); @@ -857,7 +857,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl  GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)  {      // Get map object -    Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(571)); // *vomits* +    Map* map = sMapMgr->CreateBaseMap(571); // *vomits*      if (!map)          return 0; diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 1d99b5fd5fe..4fe00ff123c 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -41,14 +41,16 @@ ArenaTeam::ArenaTeam()  ArenaTeam::~ArenaTeam()  { } -bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) +bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& arenaTeamName, +                                         uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, +                                         uint8 borderStyle, uint32 borderColor)  {      // Check if captain is present      if (!ObjectAccessor::FindPlayer(captainGuid))          return false;      // Check if arena team name is already taken -    if (sArenaTeamMgr->GetArenaTeamByName(teamName)) +    if (sArenaTeamMgr->GetArenaTeamByName(arenaTeamName))          return false;      // Generate new arena team id @@ -57,7 +59,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa      // Assign member variables      CaptainGuid = captainGuid;      Type = type; -    TeamName = teamName; +    TeamName = arenaTeamName;      BackgroundColor = backgroundColor;      EmblemStyle = emblemStyle;      EmblemColor = emblemColor; @@ -82,7 +84,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa      // Add captain as member      AddMember(CaptainGuid); -    sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); +    sLog->outDebug(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);      return true;  } @@ -179,7 +181,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)              player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);      } -    sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str()); +    sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str());      return true;  } @@ -291,7 +293,7 @@ void ArenaTeam::SetCaptain(uint64 guid)          newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);          if (oldCaptain)          { -            sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", +            sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",                  oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(),                  newCaptain->GetGUIDLow(), GetId(), GetType());          } @@ -308,10 +310,9 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)              break;          } -    // Inform player and remove arena team info from player data +    // Remove arena team info from player data      if (Player* player = ObjectAccessor::FindPlayer(guid))      { -        player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);          // delete all info regarding this team          for (uint32 i = 0; i < ARENA_TEAM_END; ++i)              player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); @@ -330,19 +331,18 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)  void ArenaTeam::Disband(WorldSession* session)  { -    // Remove all members from arena team -    while (!Members.empty()) -        DelMember(Members.front().Guid, false); -      // Broadcast update      if (session)      {          BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); -          if (Player* player = session->GetPlayer())              sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId());      } +    // Remove all members from arena team +    while (!Members.empty()) +        DelMember(Members.front().Guid, false); +      // Update database      SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -580,7 +580,7 @@ uint32 ArenaTeam::GetAverageMMR(Group* group) const          if (!ObjectAccessor::FindPlayer(itr->Guid))              continue; -        // Skip if player is not member of group +        // Skip if player is not a member of group          if (!group->IsMember(itr->Guid))              continue; @@ -604,7 +604,7 @@ float ArenaTeam::GetChanceAgainst(uint32 ownRating, uint32 opponentRating)      return 1.0f / (1.0f + exp(log(10.0f) * (float)((float)opponentRating - (float)ownRating) / 650.0f));  } -int32 ArenaTeam::GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won /*, float& confidence_factor*/) +int32 ArenaTeam::GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won)  {      // 'Chance' calculation - to beat the opponent      // This is a simulation. Not much info on how it really works @@ -683,17 +683,17 @@ void ArenaTeam::FinishGame(int32 mod)      }  } -int32 ArenaTeam::WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change) +int32 ArenaTeam::WonAgainst(uint32 ownMMRating, uint32 opponentMMRating, int32& ratingChange)  {      // Called when the team has won      // Change in Matchmaker rating -    int32 mod = GetMatchmakerRatingMod(Own_MMRating, Opponent_MMRating, true); +    int32 mod = GetMatchmakerRatingMod(ownMMRating, opponentMMRating, true);      // Change in Team Rating -    rating_change = GetRatingMod(Stats.Rating, Opponent_MMRating, true); +    ratingChange = GetRatingMod(Stats.Rating, opponentMMRating, true);      // Modify the team stats accordingly -    FinishGame(rating_change); +    FinishGame(ratingChange);      // Update number of wins per season and week      Stats.WeekWins += 1; @@ -703,23 +703,23 @@ int32 ArenaTeam::WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32      return mod;  } -int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change) +int32 ArenaTeam::LostAgainst(uint32 ownMMRating, uint32 opponentMMRating, int32& ratingChange)  {      // Called when the team has lost      // Change in Matchmaker Rating -    int32 mod = GetMatchmakerRatingMod(Own_MMRating, Opponent_MMRating, false); +    int32 mod = GetMatchmakerRatingMod(ownMMRating, opponentMMRating, false);      // Change in Team Rating -    rating_change = GetRatingMod(Stats.Rating, Opponent_MMRating, false); +    ratingChange = GetRatingMod(Stats.Rating, opponentMMRating, false);      // Modify the team stats accordingly -    FinishGame(rating_change); +    FinishGame(ratingChange);      // return the rating change, used to display it on the results screen      return mod;  } -void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) +void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 matchmakerRatingChange)  {      // Called for each participant of a match after losing      for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) @@ -731,7 +731,7 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32              itr->ModifyPersonalRating(player, mod, GetType());              // Update matchmaker rating -            itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot()); +            itr->ModifyMatchmakerRating(matchmakerRatingChange, GetSlot());              // Update personal played stats              itr->WeekGames +=1; @@ -745,7 +745,7 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32      }  } -void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) +void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 matchmakerRatingChange)  {      // Called for offline player after ending rated arena match!      for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) @@ -757,7 +757,7 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, i              itr->ModifyPersonalRating(NULL, mod, GetType());              // update matchmaker rating -            itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot()); +            itr->ModifyMatchmakerRating(matchmakerRatingChange, GetSlot());              // update personal played stats              itr->WeekGames += 1; @@ -767,7 +767,7 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, i      }  } -void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) +void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 matchmakerRatingChange)  {      // called for each participant after winning a match      for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) @@ -779,7 +779,7 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32              itr->ModifyPersonalRating(player, mod, GetType());              // update matchmaker rating -            itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot()); +            itr->ModifyMatchmakerRating(matchmakerRatingChange, GetSlot());              // update personal stats              itr->WeekGames +=1; diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index dc75ff64575..59b1275a549 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.h @@ -19,9 +19,10 @@  #ifndef TRINITYCORE_ARENATEAM_H  #define TRINITYCORE_ARENATEAM_H +#include "Define.h"  #include "QueryResult.h" -#include <ace/Singleton.h>  #include <list> +#include <string>  #include <map>  class WorldSession; @@ -72,14 +73,6 @@ enum ArenaTeamEvents      ERR_ARENA_TEAM_DISBANDED_S              = 8             // captain name + arena team name  }; -/* -need info how to send these ones: -ERR_ARENA_TEAM_YOU_JOIN_S - client show it automatically when accept invite -ERR_ARENA_TEAM_TARGET_TOO_LOW_S -ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S -ERR_ARENA_TEAM_LEVEL_TOO_LOW_I -*/ -  enum ArenaTeamTypes  {      ARENA_TEAM_2v2      = 2, @@ -121,18 +114,20 @@ class ArenaTeam          ArenaTeam();          ~ArenaTeam(); -        bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor); +        bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, +                                      uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, +                                      uint8 borderStyle, uint32 borderColor);          void Disband(WorldSession* session);          typedef std::list<ArenaTeamMember> MemberList; -        uint32 GetId() const              { return TeamId; } -        uint32 GetType() const            { return Type; } -        uint8  GetSlot() const            { return GetSlotByType(GetType()); } +        uint32 GetId() const { return TeamId; } +        uint32 GetType() const { return Type; } +        uint8  GetSlot() const { return GetSlotByType(GetType()); }          static uint8 GetSlotByType(uint32 type);          static uint8 GetTypeBySlot(uint8 slot); -        uint64 GetCaptain() const  { return CaptainGuid; } -        std::string const& GetName() const       { return TeamName; } +        uint64 GetCaptain() const { return CaptainGuid; } +        std::string const& GetName() const { return TeamName; }          const ArenaTeamStats& GetStats() const { return Stats; }          uint32 GetRating() const          { return Stats.Rating; } @@ -140,15 +135,10 @@ class ArenaTeam          void SetCaptain(uint64 guid);          bool AddMember(uint64 PlayerGuid); - -        // Shouldn't be uint64 ed, because than can reference guid from members on Disband -        // and this method removes given record from list. So invalid reference can happen.          void DelMember(uint64 guid, bool cleanDb);          size_t GetMembersSize() const         { return Members.size(); }          bool   Empty() const                  { return Members.empty(); } -        MemberList::iterator m_membersBegin() { return Members.begin(); } -        MemberList::iterator m_membersEnd()   { return Members.end(); }          bool IsMember(uint64 guid) const;          ArenaTeamMember* GetMember(uint64 guid); @@ -172,24 +162,26 @@ class ArenaTeam          void SendStats(WorldSession* session);          void Inspect(WorldSession* session, uint64 guid); -        int32  GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won); -        int32  GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won); -        float  GetChanceAgainst(uint32 ownRating, uint32 opponentRating); -        int32  WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change); -        void   MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange); -        int32  LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change); -        void   MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12); -        void   OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12); +        static int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won); +        static int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won); +        static float GetChanceAgainst(uint32 ownRating, uint32 opponentRating); + +        int32 WonAgainst(uint32 ownMMRating, uint32 opponentMMRating, int32& rating_change); +        void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 matchmakerRatingChange = 12); + +        int32 LostAgainst(uint32 ownMMRating, uint32 opponentMMRating, int32& rating_change); +        void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 matchmakerRatingChange = -12); +        void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 matchmakerRatingChange = -12);          void FinishWeek();          void FinishGame(int32 mod);      protected: -        uint32      TeamId; -        uint8       Type; +        uint32 TeamId; +        uint8  Type;          std::string TeamName; -        uint64      CaptainGuid; +        uint64 CaptainGuid;          uint32 BackgroundColor; // ARGB format          uint8  EmblemStyle;     // icon id @@ -197,7 +189,7 @@ class ArenaTeam          uint8  BorderStyle;     // border image id          uint32 BorderColor;     // ARGB format -        MemberList     Members; +        MemberList Members;          ArenaTeamStats Stats;  };  #endif diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 1464dfece95..249c1696348 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -430,7 +430,6 @@ void ThreatManager::doAddThreat(Unit* victim, float threat)      }      _addThreat(victim, threat); -  }  void ThreatManager::_addThreat(Unit* victim, float threat) diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 06c7cd17492..bc1fd27e093 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -794,7 +794,7 @@ void ConditionMgr::LoadConditions(bool isReload)      if (!result)      { -        sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!"); +        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions. DB table `conditions` is empty!");          return;      } diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index a931d61f740..0f23925cc2b 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -282,7 +282,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)      if (!result)      { -        sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!"); +        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!");          return;      } diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index ce761db2dcb..9644d4d5a6c 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -680,8 +680,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,  void Transport::UpdatePosition(MovementInfo* mi)  {      float transport_o = mi->pos.GetOrientation() - mi->t_pos.GetOrientation(); -    float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY*sin(transport_o)); -    float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX*sin(transport_o)); +    float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY * std::sin(transport_o)); +    float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX * std::sin(transport_o));      float transport_z = mi->pos.m_positionZ - mi->t_pos.m_positionZ;      Relocate(transport_x, transport_y, transport_z, transport_o); @@ -715,7 +715,7 @@ void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float&  void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)  { -    o = o - GetOrientation(); +    o -= GetOrientation();      z -= GetPositionZ();      y -= GetPositionY();    // y = searchedY * std::cos(o) + searchedX * std::sin(o)      x -= GetPositionX();    // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi) diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index b11a0996196..16a90018293 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -466,7 +466,6 @@ void Vehicle::RelocatePassengers()              float px, py, pz, po;              passenger->m_movementInfo.t_pos.GetPosition(px, py, pz, po);              CalculatePassengerPosition(px, py, pz, po); -              passenger->UpdatePosition(px, py, pz, po);          }      } diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 82bf4702c53..051d76f46ed 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -211,7 +211,6 @@ void GameEventMgr::LoadFromDB()          {              mGameEvent.clear();              sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game events. DB table `game_event` is empty."); -              return;          } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c4721f3cc09..acbdfa6a4a2 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1186,7 +1186,6 @@ void ObjectMgr::LoadLinkedRespawn()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); -          return;      } @@ -1417,7 +1416,6 @@ void ObjectMgr::LoadCreatures()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures. DB table `creature` is empty."); -          return;      } @@ -1725,7 +1723,7 @@ void ObjectMgr::LoadGameobjects()      if (!result)      { -        sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); +        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects. DB table `gameobject` is empty.");          return;      } @@ -2626,7 +2624,6 @@ void ObjectMgr::LoadVehicleTemplateAccessories()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); -          return;      } @@ -2721,7 +2718,6 @@ void ObjectMgr::LoadPetLevelInfo()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); -          return;      } @@ -2859,7 +2855,6 @@ void ObjectMgr::LoadPlayerInfo()          if (!result)          { -              sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");              exit(1);          } @@ -3018,7 +3013,6 @@ void ObjectMgr::LoadPlayerInfo()          if (!result)          {              sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); -          }          else          { @@ -3080,7 +3074,6 @@ void ObjectMgr::LoadPlayerInfo()          if (!result)          {              sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); -          }          else          { @@ -3126,7 +3119,6 @@ void ObjectMgr::LoadPlayerInfo()          if (!result)          {              sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); -              exit(1);          } @@ -3239,7 +3231,6 @@ void ObjectMgr::LoadPlayerInfo()          if (!result)          {              sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); -              exit(1);          } @@ -4935,7 +4926,6 @@ void ObjectMgr::LoadInstanceEncounters()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance encounters, table is empty!"); -          return;      } @@ -6396,7 +6386,6 @@ void ObjectMgr::LoadExplorationBaseXP()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); -          return;      } @@ -6551,7 +6540,7 @@ void ObjectMgr::LoadReputationRewardRate()      QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, creature_rate, spell_rate FROM reputation_reward_rate");      if (!result)      { -        sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!"); +        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_reward_rate`, table is empty!");          return;      } @@ -6640,7 +6629,6 @@ void ObjectMgr::LoadReputationOnKill()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); -          return;      } @@ -6828,7 +6816,6 @@ void ObjectMgr::LoadPointsOfInterest()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); -          return;      } @@ -6874,7 +6861,6 @@ void ObjectMgr::LoadQuestPOI()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); -          return;      } @@ -6942,7 +6928,6 @@ void ObjectMgr::LoadNPCSpellClickSpells()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); -          return;      } @@ -7419,7 +7404,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max      if (!result)      {          if (min_value == MIN_TRINITY_STRING_ID)              // error only in case internal strings -            sLog->outError(LOG_FILTER_SERVER_LOADING, ">>  Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); +            sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);          else              sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table); @@ -7496,7 +7481,6 @@ void ObjectMgr::LoadFishingBaseSkillLevel()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); -          return;      } @@ -7622,8 +7606,7 @@ void ObjectMgr::LoadGameTele()      if (!result)      { -        sLog->outError(LOG_FILTER_SERVER_LOADING, ">>  Loaded 0 GameTeleports. DB table `game_tele` is empty!"); - +        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");          return;      } @@ -7762,8 +7745,7 @@ void ObjectMgr::LoadMailLevelRewards()      if (!result)      { -        sLog->outError(LOG_FILTER_SERVER_LOADING, ">>  Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); - +        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");          return;      } @@ -8033,7 +8015,6 @@ void ObjectMgr::LoadGossipMenu()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0  gossip_menu entries. DB table `gossip_menu` is empty!"); -          return;      } @@ -8079,7 +8060,6 @@ void ObjectMgr::LoadGossipMenuItems()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); -          return;      } @@ -8292,8 +8272,7 @@ void ObjectMgr::LoadScriptNames()      if (!result)      { - -        sLog->outError(LOG_FILTER_SQL, ">> Loaded empty set of Script Names!"); +        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded empty set of Script Names!");          return;      } @@ -8470,7 +8449,6 @@ void ObjectMgr::LoadFactionChangeAchievements()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); -          return;      } @@ -8541,7 +8519,6 @@ void ObjectMgr::LoadFactionChangeSpells()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); -          return;      } diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp index 7e62280f17c..68c93259fcb 100644 --- a/src/server/game/Handlers/AddonHandler.cpp +++ b/src/server/game/Handlers/AddonHandler.cpp @@ -30,7 +30,7 @@ AddonHandler::~AddonHandler()  {  } -bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target) +bool AddonHandler::BuildAddonPacket(WorldPacket* source, WorldPacket* target)  {      ByteBuffer AddOnPacked;      uLongf AddonRealSize; @@ -38,10 +38,10 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)      uint32 TempValue;      // broken addon packet, can't be received from real client -    if (Source->rpos() + 4 > Source->size()) +    if (source->rpos() + 4 > source->size())          return false; -    *Source >> TempValue;                                   // get real size of the packed structure +    *source >> TempValue;                                   // get real size of the packed structure      // empty addon packet, nothing process, can't be received from real client      if (!TempValue) @@ -49,13 +49,13 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)      AddonRealSize = TempValue;                              // temp value because ZLIB only excepts uLongf -    CurrentPosition = Source->rpos();                       // get the position of the pointer in the structure +    CurrentPosition = source->rpos();                       // get the position of the pointer in the structure      AddOnPacked.resize(AddonRealSize);                      // resize target for zlib action -    if (!uncompress(const_cast<uint8*>(AddOnPacked.contents()), &AddonRealSize, const_cast<uint8*>((*Source).contents() + CurrentPosition), (*Source).size() - CurrentPosition)!= Z_OK) +    if (!uncompress(AddOnPacked.contents(), &AddonRealSize, source->contents() + CurrentPosition, source->size() - CurrentPosition)!= Z_OK)      { -        Target->Initialize(SMSG_ADDON_INFO); +        target->Initialize(SMSG_ADDON_INFO);          uint32 addonsCount;          AddOnPacked >> addonsCount;                         // addons count? @@ -81,14 +81,14 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)              sLog->outDebug(LOG_FILTER_NETWORKIO, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2);              uint8 state = (enabled ? 2 : 1); -            *Target << uint8(state); +            *target << uint8(state);              uint8 unk1 = (enabled ? 1 : 0); -            *Target << uint8(unk1); +            *target << uint8(unk1);              if (unk1)              {                  uint8 unk = (crc != 0x4c1c776d);           // If addon is Standard addon CRC -                *Target << uint8(unk); +                *target << uint8(unk);                  if (unk)                  {                      unsigned char tdata[256] = @@ -110,18 +110,18 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)                          0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,                          0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2                      }; -                    Target->append(tdata, sizeof(tdata)); +                    target->append(tdata, sizeof(tdata));                  } -                *Target << uint32(0); +                *target << uint32(0);              }              uint8 unk3 = (enabled ? 0 : 1); -            *Target << uint8(unk3); +            *target << uint8(unk3);              if (unk3)              {                  // String, 256 (null terminated?) -                *Target << uint8(0); +                *target << uint8(0);              }          } @@ -129,7 +129,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)          AddOnPacked >> unk4;          uint32 count = 0; -        *Target << uint32(count); +        *target << uint32(count);          if (AddOnPacked.rpos() != AddOnPacked.size())              sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under read!"); diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index ef8b39a926d..07ade9456b1 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -556,7 +556,7 @@ void WorldSession::SendLfgBootProposalUpdate(LfgPlayerBoot const& boot)          GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != LFG_ANSWER_PENDING),          uint8(playerVote == LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum,          secsleft, LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str()); -    WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length()); +    WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());      data << uint8(boot.inProgress);                        // Vote in progress      data << uint8(playerVote != LFG_ANSWER_PENDING);       // Did Vote      data << uint8(playerVote == LFG_ANSWER_AGREE);         // Agree diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 579b4f38a5c..a748b6ebad7 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -975,7 +975,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recvData)      dest.resize(decompressedSize);      uLongf realSize = decompressedSize; -    if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recvData.contents() + recvData.rpos()), recvData.size() - recvData.rpos()) != Z_OK) +    if (uncompress(dest.contents(), &realSize, recvData.contents() + recvData.rpos(), recvData.size() - recvData.rpos()) != Z_OK)      {          recvData.rfinish();                   // unnneded warning spam in this case          sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Failed to decompress account data"); @@ -1016,7 +1016,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recvData)      ByteBuffer dest;      dest.resize(destSize); -    if (size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK) +    if (size && compress(dest.contents(), &destSize, (uint8 const*)adata->Data.c_str(), size) != Z_OK)      {          sLog->outDebug(LOG_FILTER_NETWORKIO, "RAD: Failed to compress account data");          return; diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 4463613a97b..2da2735a3f9 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -69,7 +69,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)              dest.resize(decompressedSize);              uLongf realSize = decompressedSize; -            if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recvData.contents() + pos), recvData.size() - pos) == Z_OK) +            if (uncompress(dest.contents(), &realSize, recvData.contents() + pos, recvData.size() - pos) == Z_OK)              {                  dest >> chatLog;                  ticket->SetChatLog(times, chatLog); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 0a66c781c8f..3828005b041 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1210,14 +1210,10 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint  {      float chance = RawTotalChance();      if (chance > 101.0f)                                    // TODO: replace with 100% when DBs will be ready -    {          sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance); -    }      if (chance >= 100.0f && !EqualChanced.empty()) -    {          sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance); -    }  }  void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, LootIdSet* ref_set) const diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index b56833214d6..e811a25f730 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -1920,10 +1920,10 @@ bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, floa  bool Map::getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)  { -    Vector3 startPos = Vector3(x1, y1, z1); -    Vector3 dstPos = Vector3(x2, y2, z2); +    G3D::Vector3 startPos(x1, y1, z1); +    G3D::Vector3 dstPos(x2, y2, z2); -    Vector3 resultPos; +    G3D::Vector3 resultPos;      bool result = _dynamicTree.getObjectHitPos(phasemask, startPos, dstPos, resultPos, modifyDist);      rx = resultPos.x; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index f5c748c7b88..3a061910faa 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -36,7 +36,6 @@ enum SpellEffIndex  #define EFFECT_FIRST_FOUND 254  #define EFFECT_ALL 255 -  // loot modes for creatures and gameobjects, bitmask!  enum LootModes  { @@ -2835,7 +2834,7 @@ enum CreatureTypeFlags2      CREATURE_TYPEFLAGS_2_UNK5           = 0x00000010,      CREATURE_TYPEFLAGS_2_UNK6           = 0x00000020,      CREATURE_TYPEFLAGS_2_UNK7           = 0x00000040, -    CREATURE_TYPEFLAGS_2_UNK8           = 0x00000080, +    CREATURE_TYPEFLAGS_2_UNK8           = 0x00000080  };  enum CreatureEliteType @@ -2885,7 +2884,7 @@ enum HolidayIds      HOLIDAY_RATED_BG_25_VS_25        = 443,      HOLIDAY_ANNIVERSARY_7_YEARS      = 467,      HOLIDAY_DARKMOON_FAIRE_TEROKKAR  = 479, -    HOLIDAY_ANNIVERSARY_8_YEARS      = 484, +    HOLIDAY_ANNIVERSARY_8_YEARS      = 484  };  // values based at QuestInfo.dbc @@ -3150,7 +3149,7 @@ enum SkillType      SKILL_PET_SHALE_SPIDER         = 817,      SKILL_PET_BEETLE               = 818,      SKILL_ALL_GUILD_PERKS          = 821, -    SKILL_PET_HYDRA                = 824, +    SKILL_PET_HYDRA                = 824  };  #define MAX_SKILL_TYPE               825 @@ -3325,7 +3324,7 @@ enum ChatMsg      CHAT_MSG_ACHIEVEMENT            = 0x30,      CHAT_MSG_GUILD_ACHIEVEMENT      = 0x31,      CHAT_MSG_ARENA_POINTS           = 0x32, -    CHAT_MSG_PARTY_LEADER           = 0x33, +    CHAT_MSG_PARTY_LEADER           = 0x33  };  #define MAX_CHAT_MSG_TYPE 0x34 @@ -3343,14 +3342,14 @@ enum ChatLinkColors  // Values from ItemPetFood (power of (value-1) used for compare with CreatureFamilyEntry.petDietMask  enum PetDiet  { -    PET_DIET_MEAT       = 1, -    PET_DIET_FISH       = 2, -    PET_DIET_CHEESE     = 3, -    PET_DIET_BREAD      = 4, -    PET_DIET_FUNGAS     = 5, -    PET_DIET_FRUIT      = 6, -    PET_DIET_RAW_MEAT   = 7, -    PET_DIET_RAW_FISH   = 8 +    PET_DIET_MEAT     = 1, +    PET_DIET_FISH     = 2, +    PET_DIET_CHEESE   = 3, +    PET_DIET_BREAD    = 4, +    PET_DIET_FUNGAS   = 5, +    PET_DIET_FRUIT    = 6, +    PET_DIET_RAW_MEAT = 7, +    PET_DIET_RAW_FISH = 8  };  #define MAX_PET_DIET 9 diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 937a2ddef72..6fba8308077 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -49,7 +49,6 @@ void WaypointMgr::Load()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); -          return;      } @@ -87,7 +86,6 @@ void WaypointMgr::Load()      while (result->NextRow());      sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); -  }  void WaypointMgr::ReloadPath(uint32 id) diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index 649f4130c06..fe8b6804020 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -55,7 +55,7 @@ void PacketLog::LogPacket(WorldPacket const& packet, Direction direction)      data << uint8(direction);      for (uint32 i = 0; i < packet.size(); i++) -        data << const_cast<WorldPacket&>(packet)[i]; +        data << packet[i];      fwrite(data.contents(), 1, data.size(), _file);      fflush(_file); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index bb108b0d1fa..97ac6c0440e 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -862,7 +862,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)      ByteBuffer addonInfo;      addonInfo.resize(size); -    if (uncompress(const_cast<uint8*>(addonInfo.contents()), &uSize, const_cast<uint8*>(data.contents() + pos), data.size() - pos) == Z_OK) +    if (uncompress(addonInfo.contents(), &uSize, data.contents() + pos, data.size() - pos) == Z_OK)      {          uint32 addonsCount;          addonInfo >> addonsCount;                         // addons count diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 9fc426323d1..e6ba28d5f1c 100644 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -56,7 +56,6 @@ void LoadSkillDiscoveryTable()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); -          return;      } @@ -154,7 +153,6 @@ void LoadSkillDiscoveryTable()      }      sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); -  }  uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index 170cf0e57a2..5c3b69e48d2 100644 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -61,7 +61,6 @@ void LoadSkillExtraItemTable()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); -          return;      } @@ -75,28 +74,28 @@ void LoadSkillExtraItemTable()          if (!sSpellMgr->GetSpellInfo(spellId))          { -            sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId); +            sLog->outError(LOG_FILTER_SQL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);              continue;          }          uint32 requiredSpecialization = fields[1].GetUInt32();          if (!sSpellMgr->GetSpellInfo(requiredSpecialization))          { -            sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); +            sLog->outError(LOG_FILTER_SQL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);              continue;          }          float additionalCreateChance = fields[2].GetFloat();          if (additionalCreateChance <= 0.0f)          { -            sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); +            sLog->outError(LOG_FILTER_SQL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);              continue;          }          uint8 additionalMaxNum = fields[3].GetUInt8();          if (!additionalMaxNum)          { -            sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); +            sLog->outError(LOG_FILTER_SQL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);              continue;          } @@ -111,7 +110,6 @@ void LoadSkillExtraItemTable()      while (result->NextRow());      sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); -  }  bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance, uint8 &additionalMax) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index ef0587feb53..3e22f8f25ff 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -582,7 +582,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)              break;      } -    GetBase()->CallScriptEffectCalcAmountHandlers(const_cast<AuraEffect const*>(this), amount, m_canBeRecalculated); +    GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated);      amount *= GetBase()->GetStackAmount();      return amount;  } @@ -616,7 +616,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= tru              break;      } -    GetBase()->CallScriptEffectCalcPeriodicHandlers(const_cast<AuraEffect const*>(this), m_isPeriodic, m_amplitude); +    GetBase()->CallScriptEffectCalcPeriodicHandlers(this, m_isPeriodic, m_amplitude);      if (!m_isPeriodic)          return; @@ -688,7 +688,7 @@ void AuraEffect::CalculateSpellMod()          default:              break;      } -    GetBase()->CallScriptEffectCalcSpellModHandlers(const_cast<AuraEffect const*>(this), m_spellmod); +    GetBase()->CallScriptEffectCalcSpellModHandlers(this, m_spellmod);  }  void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply) @@ -747,15 +747,15 @@ void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply)      // call scripts helping/replacing effect handlers      bool prevented = false;      if (apply) -        prevented = GetBase()->CallScriptEffectApplyHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode); +        prevented = GetBase()->CallScriptEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);      else -        prevented = GetBase()->CallScriptEffectRemoveHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode); +        prevented = GetBase()->CallScriptEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);      // check if script events have removed the aura or if default effect prevention was requested      if ((apply && aurApp->GetRemoveMode()) || prevented)          return; -    (*this.*AuraEffectHandler [GetAuraType()])(const_cast<AuraApplication const*>(aurApp), mode, apply); +    (*this.*AuraEffectHandler[GetAuraType()])(aurApp, mode, apply);      // check if script events have removed the aura or if default effect prevention was requested      if (apply && aurApp->GetRemoveMode()) @@ -763,9 +763,9 @@ void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply)      // call scripts triggering additional events after apply/remove      if (apply) -        GetBase()->CallScriptAfterEffectApplyHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode); +        GetBase()->CallScriptAfterEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);      else -        GetBase()->CallScriptAfterEffectRemoveHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode); +        GetBase()->CallScriptAfterEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);  }  void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply) @@ -1069,7 +1069,7 @@ void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const  void AuraEffect::HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)  { -    bool prevented = GetBase()->CallScriptEffectProcHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), eventInfo); +    bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);      if (prevented)          return; @@ -1094,7 +1094,7 @@ void AuraEffect::HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)              break;      } -    GetBase()->CallScriptAfterEffectProcHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), eventInfo); +    GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);  }  void AuraEffect::CleanupTriggeredSpells(Unit* target) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 64b8d889519..4abca023dd3 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1770,14 +1770,14 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event  void Aura::TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo)  { -    CallScriptProcHandlers(const_cast<AuraApplication const*>(aurApp), eventInfo); +    CallScriptProcHandlers(aurApp, eventInfo);      for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)          if (aurApp->HasEffect(i))              // OnEffectProc / AfterEffectProc hooks handled in AuraEffect::HandleProc()              GetEffect(i)->HandleProc(aurApp, eventInfo); -    CallScriptAfterProcHandlers(const_cast<AuraApplication const*>(aurApp), eventInfo); +    CallScriptAfterProcHandlers(aurApp, eventInfo);      // Remove aura if we've used last charge to proc      if (IsUsingCharges() && !GetCharges()) diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index f030b3dc6f2..55b4d3f2e22 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -41,7 +41,7 @@ GmTicket::GmTicket(Player* player, WorldPacket& recvData) : _createTime(time(NUL      _playerGuid = player->GetGUID();      uint32 mapId; -    recvData >> mapId; // Map is sent as UInt32! +    recvData >> mapId;                      // Map is sent as UInt32!      _mapId = mapId;      recvData >> _posX; diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index 379b6fc6225..29d96cc0cfe 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -23,7 +23,6 @@  #include "Database/DatabaseEnv.h"  #include "SpellMgr.h"  #include "DBCStores.h" -#include "AchievementMgr.h"  void CharacterDatabaseCleaner::CleanDatabase()  { diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index a99688c8844..af695c482cf 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -219,7 +219,7 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)  void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)  { -    _warden->DecryptData(const_cast<uint8*>(recvData.contents()), recvData.size()); +    _warden->DecryptData(recvData.contents(), recvData.size());      uint8 opcode;      recvData >> opcode;      sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index c6542c68360..ec271192450 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -44,7 +44,6 @@ void WardenCheckMgr::LoadWardenChecks()      if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))      {          sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped."); -          return;      } @@ -53,7 +52,6 @@ void WardenCheckMgr::LoadWardenChecks()      if (!result)      {          sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); -          return;      } @@ -145,8 +143,7 @@ void WardenCheckMgr::LoadWardenChecks()      }      while (result->NextRow()); -    sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden checks.", count); - +    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u warden checks.", count);  }  void WardenCheckMgr::LoadWardenOverrides() @@ -155,7 +152,6 @@ void WardenCheckMgr::LoadWardenOverrides()      if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))      {          sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped."); -          return;      } @@ -165,7 +161,6 @@ void WardenCheckMgr::LoadWardenOverrides()      if (!result)      {          sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); -          return;      } @@ -194,8 +189,7 @@ void WardenCheckMgr::LoadWardenOverrides()      }      while (result->NextRow()); -    sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden action overrides.", count); - +    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u warden action overrides.", count);  }  WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id) diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 7c2979e0dc6..fa84cd216b6 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -206,7 +206,7 @@ void WardenMac::RequestData()      buff.hexlike();      // Encrypt with warden RC4 key. -    EncryptData(const_cast<uint8*>(buff.contents()), buff.size()); +    EncryptData(buff.contents(), buff.size());      WorldPacket pkt(SMSG_WARDEN_DATA, buff.size());      pkt.append(buff); diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 4da05eded0c..bf423459222 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -310,7 +310,7 @@ void WardenWin::RequestData()      buff.hexlike();      // Encrypt with warden RC4 key -    EncryptData(const_cast<uint8*>(buff.contents()), buff.size()); +    EncryptData(buff.contents(), buff.size());      WorldPacket pkt(SMSG_WARDEN_DATA, buff.size());      pkt.append(buff); diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 8bfa74d07e5..5eff13725b9 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -98,7 +98,6 @@ void LoadWeatherData()      if (!result)      {          sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 weather definitions. DB table `game_weather` is empty."); -          return;      } @@ -142,7 +141,6 @@ void LoadWeatherData()      while (result->NextRow());      sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); -  }  void SendFineWeatherUpdateToPlayer(Player* player) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 879f3865302..62e792a711a 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -776,7 +776,7 @@ void World::LoadConfigSettings(bool reload)      m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0);      if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)      { -        sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0.." UI64FMTD ". Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); +        sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0.." UI64FMTD ". Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], uint64(MAX_MONEY_AMOUNT), 0);          m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;      }      else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > 0x7FFFFFFF-1) // TODO: (See MAX_MONEY_AMOUNT) diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp index d7441d6311b..fe7f3f47161 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp @@ -16,6 +16,11 @@   */  #include "baradin_hold.h" +#include "InstanceScript.h" +#include "ScriptMgr.h" +#include "Player.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h"  enum Texts  { @@ -137,7 +142,7 @@ class boss_alizabal : public CreatureScript                  }              } -            void MovementInform(uint32 type, uint32 pointId) +            void MovementInform(uint32 /*type*/, uint32 pointId)              {                  switch (pointId)                  { diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp index 9bbfebecf2c..0e2b7107548 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp @@ -15,7 +15,9 @@  * with this program. If not, see <http://www.gnu.org/licenses/>.  */ -#include"baradin_hold.h" +#include "baradin_hold.h" +#include "InstanceScript.h" +#include "ScriptMgr.h"  DoorData const doorData[] =  { @@ -94,7 +96,8 @@ public:                  default:                      break;              } -            return NULL; + +            return 0;          }          void OnGameObjectRemove(GameObject* go) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index 9c17ed10d9c..78b655bb73b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -122,7 +122,7 @@ public:          bool IsEncounterInProgress() const          { -            if (const_cast<instance_dark_portal_InstanceMapScript*>(this)->GetData(TYPE_MEDIVH) == IN_PROGRESS) +            if (GetData(TYPE_MEDIVH) == IN_PROGRESS)                  return true;              return false; diff --git a/src/server/scripts/Kalimdor/Firelands/firelands.h b/src/server/scripts/Kalimdor/Firelands/firelands.h index 330158d6c94..cf12892b2c9 100644 --- a/src/server/scripts/Kalimdor/Firelands/firelands.h +++ b/src/server/scripts/Kalimdor/Firelands/firelands.h @@ -19,7 +19,7 @@  #define FIRELANDS_H_  #include "Map.h" -#include "Creature.h" +#include "CreatureAI.h"  #define FirelandsScriptName "instance_firelands" diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp index 1ea0ee0a343..2169320621b 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp @@ -86,8 +86,8 @@ public:          return true;      }  protected: -    InstanceScript* _instance;      Unit* _owner; +    InstanceScript* _instance;  };  class boss_earthrager_ptah : public CreatureScript @@ -262,8 +262,8 @@ public:          }      protected: -        bool _hasDispersed;          uint8 _summonDeaths; +        bool _hasDispersed;      };      CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 59d69d658cc..af727348719 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1249,7 +1249,6 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader                  OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);                  OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);                  OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); -                OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);              }              WorldObject* target; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 5a38d163da3..dffdadc5b9c 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -554,7 +554,7 @@ class spell_paralyze_pinnacle : public SpellScriptLoader              void FilterTargets(std::list<WorldObject*>& unitList)              { -                unitList.remove_if (RitualTargetCheck(GetCaster())); +                unitList.remove_if(RitualTargetCheck(GetCaster()));              }              void Register() diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 3fc6649bd4d..227680b2d6b 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -26,7 +26,7 @@ void LoginDatabaseConnection::DoPrepareStatements()      PrepareStatement(LOGIN_DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);      PrepareStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);      PrepareStatement(LOGIN_SEL_IP_BANNED, "SELECT * FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH); -    PrepareStatement(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban')", CONNECTION_ASYNC); +    PrepareStatement(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban')", CONNECTION_ASYNC);      PrepareStatement(LOGIN_SEL_IP_BANNED_ALL, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) ORDER BY unbandate", CONNECTION_SYNCH);      PrepareStatement(LOGIN_SEL_IP_BANNED_BY_IP, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) AND ip LIKE CONCAT('%%', ?, '%%') ORDER BY unbandate", CONNECTION_SYNCH);      PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED, "SELECT bandate, unbandate FROM account_banned WHERE id = ? AND active = 1", CONNECTION_SYNCH); @@ -47,7 +47,7 @@ void LoginDatabaseConnection::DoPrepareStatements()      PrepareStatement(LOGIN_SEL_NUM_CHARS_ON_REALM, "SELECT numchars FROM realmcharacters WHERE realmid = ? AND acctid= ?", CONNECTION_SYNCH);      PrepareStatement(LOGIN_SEL_ACCOUNT_BY_IP, "SELECT id, username FROM account WHERE last_ip = ?", CONNECTION_SYNCH);      PrepareStatement(LOGIN_SEL_ACCOUNT_BY_ID, "SELECT 1 FROM account WHERE id = ?", CONNECTION_SYNCH); -    PrepareStatement(LOGIN_INS_IP_BANNED, "INSERT INTO ip_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?)", CONNECTION_ASYNC); +    PrepareStatement(LOGIN_INS_IP_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?)", CONNECTION_ASYNC);      PrepareStatement(LOGIN_DEL_IP_NOT_BANNED, "DELETE FROM ip_banned WHERE ip = ?", CONNECTION_ASYNC);      PrepareStatement(LOGIN_INS_ACCOUNT_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC);      PrepareStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED, "UPDATE account_banned SET active = 0 WHERE id = ? AND active != 0", CONNECTION_ASYNC); diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 25141815de6..e29459299f7 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -20,12 +20,12 @@  AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags, uint64 fileSize):      Appender(id, name, APPENDER_FILE, level, _flags), +    logfile(NULL),      filename(_filename),      logDir(_logDir),      mode(_mode),      maxFileSize(fileSize), -    fileSize(0), -    logfile(NULL) +    fileSize(0)  {      dynamicName = std::string::npos != filename.find("%s");      backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 68d86406faa..c0a5daedf25 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -523,6 +523,8 @@ class ByteBuffer              return *this;          } +        uint8 * contents() { return &_storage[0]; } +          const uint8 *contents() const { return &_storage[0]; }          size_t size() const { return _storage.size(); } diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index e0f4e7f0de6..94950703271 100644 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -388,7 +388,8 @@ void RASocket::zprint(void* callbackArg, const char * szText)      ACE_Message_Block* mb = new ACE_Message_Block(sz);      mb->copy(szText, sz); -    if (socket->putq(mb, const_cast<ACE_Time_Value*>(&ACE_Time_Value::zero)) == -1) +    ACE_Time_Value tv = ACE_Time_Value::zero; +    if (socket->putq(mb, &tv) == -1)      {          sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));          mb->release(); diff --git a/src/tools/mmaps_generator/TerrainBuilder.cpp b/src/tools/mmaps_generator/TerrainBuilder.cpp index a42cd2b9bc6..3a87da3d4f1 100644 --- a/src/tools/mmaps_generator/TerrainBuilder.cpp +++ b/src/tools/mmaps_generator/TerrainBuilder.cpp @@ -674,14 +674,14 @@ namespace MMAP                  // transform data                  float scale = instance.iScale;                  G3D::Matrix3 rotation = G3D::Matrix3::fromEulerAnglesXYZ(G3D::pi()*instance.iRot.z/-180.f, G3D::pi()*instance.iRot.x/-180.f, G3D::pi()*instance.iRot.y/-180.f); -                Vector3 position = instance.iPos; +                G3D::Vector3 position = instance.iPos;                  position.x -= 32*GRID_SIZE;                  position.y -= 32*GRID_SIZE;                  for (std::vector<GroupModel>::iterator it = groupModels.begin(); it != groupModels.end(); ++it)                  { -                    std::vector<Vector3> tempVertices; -                    std::vector<Vector3> transformedVertices; +                    std::vector<G3D::Vector3> tempVertices; +                    std::vector<G3D::Vector3> transformedVertices;                      std::vector<MeshTriangle> tempTriangles;                      WmoLiquid* liquid = NULL; @@ -698,10 +698,10 @@ namespace MMAP                      // now handle liquid data                      if (liquid)                      { -                        std::vector<Vector3> liqVerts; +                        std::vector<G3D::Vector3> liqVerts;                          std::vector<int> liqTris;                          uint32 tilesX, tilesY, vertsX, vertsY; -                        Vector3 corner; +                        G3D::Vector3 corner;                          liquid->getPosInfo(tilesX, tilesY, corner);                          vertsX = tilesX + 1;                          vertsY = tilesY + 1; @@ -730,11 +730,11 @@ namespace MMAP                          // tile   = x*tilesY+y                          // flag   = y*tilesY+x -                        Vector3 vert; +                        G3D::Vector3 vert;                          for (uint32 x = 0; x < vertsX; ++x)                              for (uint32 y = 0; y < vertsY; ++y)                              { -                                vert = Vector3(corner.x + x * GRID_PART_SIZE, corner.y + y * GRID_PART_SIZE, data[y*vertsX + x]); +                                vert = G3D::Vector3(corner.x + x * GRID_PART_SIZE, corner.y + y * GRID_PART_SIZE, data[y*vertsX + x]);                                  vert = vert * rotation * scale + position;                                  vert.x *= -1.f;                                  vert.y *= -1.f; @@ -785,12 +785,12 @@ namespace MMAP      }      /**************************************************************************/ -    void TerrainBuilder::transform(std::vector<Vector3> &source, std::vector<Vector3> &transformedVertices, float scale, G3D::Matrix3 &rotation, Vector3 &position) +    void TerrainBuilder::transform(std::vector<G3D::Vector3> &source, std::vector<G3D::Vector3> &transformedVertices, float scale, G3D::Matrix3 &rotation, G3D::Vector3 &position)      { -        for (std::vector<Vector3>::iterator it = source.begin(); it != source.end(); ++it) +        for (std::vector<G3D::Vector3>::iterator it = source.begin(); it != source.end(); ++it)          {              // apply tranform, then mirror along the horizontal axes -            Vector3 v((*it) * rotation * scale + position); +            G3D::Vector3 v((*it) * rotation * scale + position);              v.x *= -1.f;              v.y *= -1.f;              transformedVertices.push_back(v); @@ -798,9 +798,9 @@ namespace MMAP      }      /**************************************************************************/ -    void TerrainBuilder::copyVertices(std::vector<Vector3> &source, G3D::Array<float> &dest) +    void TerrainBuilder::copyVertices(std::vector<G3D::Vector3> &source, G3D::Array<float> &dest)      { -        for (std::vector<Vector3>::iterator it = source.begin(); it != source.end(); ++it) +        for (std::vector<G3D::Vector3>::iterator it = source.begin(); it != source.end(); ++it)          {              dest.push_back((*it).y);              dest.push_back((*it).z); diff --git a/src/tools/mmaps_generator/VMapExtensions.cpp b/src/tools/mmaps_generator/VMapExtensions.cpp index 972f222bba6..08929e5259d 100644 --- a/src/tools/mmaps_generator/VMapExtensions.cpp +++ b/src/tools/mmaps_generator/VMapExtensions.cpp @@ -47,7 +47,7 @@ namespace VMAP      }      // declared in src/shared/vmap/WorldModel.h -    void GroupModel::getMeshData(std::vector<Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid) +    void GroupModel::getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid)      {          vertices = this->vertices;          triangles = this->triangles; @@ -61,7 +61,7 @@ namespace VMAP      }      // declared in src/shared/vmap/WorldModel.h -    void WmoLiquid::getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const +    void WmoLiquid::getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const      {          tilesX = iTilesX;          tilesY = iTilesY;  | 
