refactor(Core/Misc): enforce east-const style and add codestyle check (#26492)

Co-authored-by: Ludwig <sudlud@users.noreply.github.com>
This commit is contained in:
Kitzunu
2026-07-21 06:13:51 +02:00
committed by GitHub
parent 9a9924ed43
commit 8eb009fdfc
361 changed files with 1016 additions and 980 deletions
+45 -9
View File
@@ -6,6 +6,30 @@ import re
# Get the src directory of the project # Get the src directory of the project
src_directory = os.path.join(os.getcwd(), 'src') src_directory = os.path.join(os.getcwd(), 'src')
# Matches west-const declarations: "const <type> &" / "const <type> *".
# <type> may be a (qualified) identifier, an optional unsigned/signed/long/short
# prefix and an optional (single level of nested) template argument list.
qualifier_align_regex = re.compile(
r'\bconst\s+('
r'(?:(?:unsigned|signed|long|short)\s+)*'
r'(?:::)?[A-Za-z_]\w*(?:::[A-Za-z_]\w*)*'
r'(?:\s*<[^<>;{}]*(?:<[^<>;{}]*>[^<>;{}]*)*>)?'
r')\s*([&*])')
# Matches a raw string, line comment, block comment, string literal or char literal
# (whichever starts first at any position, so // inside a string or " inside a comment
# is handled). The raw string alternative comes first so R"delim(...)delim" - which may
# contain unescaped quotes - is consumed whole rather than as a plain "..." string.
literal_or_comment_regex = re.compile(
r'R"([^()\\ \t\r\n]{0,16})\(.*?\)\1"'
r'|//[^\n]*|/\*.*?\*/|"(?:\\.|[^"\\])*"|\'(?:\\.|[^\'\\])*\'', re.DOTALL)
# Replaces the contents of string/char literals and comments with spaces so the
# qualifier-alignment check never matches text inside them. Whitespace (including
# newlines) is preserved so line numbers stay accurate.
def blank_non_code(text: str) -> str:
return literal_or_comment_regex.sub(lambda m: re.sub(r'\S', ' ', m.group()), text)
# Global variables # Global variables
error_handler = False error_handler = False
results = { results = {
@@ -16,7 +40,8 @@ results = {
"GetTypeId() check": "Passed", "GetTypeId() check": "Passed",
"NpcFlagHelpers check": "Passed", "NpcFlagHelpers check": "Passed",
"ItemFlagHelpers check": "Passed", "ItemFlagHelpers check": "Passed",
"ItemTemplateFlagHelpers check": "Passed" "ItemTemplateFlagHelpers check": "Passed",
"Qualifier alignment check": "Passed"
} }
# Main function to parse all the files of the project # Main function to parse all the files of the project
@@ -46,6 +71,7 @@ def parsing_file(directory: str) -> None:
itemflag_helpers_check(file, file_path) itemflag_helpers_check(file, file_path)
if file_name != 'ItemTemplate.h': if file_name != 'ItemTemplate.h':
itemtemplateflag_helpers_check(file, file_path) itemtemplateflag_helpers_check(file, file_path)
qualifier_alignment_check(file, file_path)
except UnicodeDecodeError: except UnicodeDecodeError:
print(f"\nCould not decode file {file_path}") print(f"\nCould not decode file {file_path}")
sys.exit(1) sys.exit(1)
@@ -214,6 +240,24 @@ def itemtemplateflag_helpers_check(file: io, file_path: str) -> None:
error_handler = True error_handler = True
results["ItemTemplateFlagHelpers check"] = "Failed" results["ItemTemplateFlagHelpers check"] = "Failed"
# Codestyle patterns enforcing east-const: "const T&" -> "T const&", "const T*" -> "T const*"
def qualifier_alignment_check(file: io, file_path: str) -> None:
global error_handler, results
file.seek(0) # Reset file pointer to the beginning
check_failed = False
# Blank out strings/comments so we never match inside them, then check line by line
masked_lines = blank_non_code(file.read()).split('\n')
for line_number, line in enumerate(masked_lines, start = 1):
for match in qualifier_align_regex.finditer(line):
type_name, symbol = match.group(1).strip(), match.group(2)
print(
f"Please use the '{type_name} const{symbol}' syntax instead of 'const {type_name}{symbol}': {file_path} at line {line_number}")
check_failed = True
# Handle the script error and update the result output
if check_failed:
error_handler = True
results["Qualifier alignment check"] = "Failed"
# Codestyle patterns checking for various codestyle issues # Codestyle patterns checking for various codestyle issues
def misc_codestyle_check(file: io, file_path: str) -> None: def misc_codestyle_check(file: io, file_path: str) -> None:
global error_handler, results global error_handler, results
@@ -229,14 +273,6 @@ def misc_codestyle_check(file: io, file_path: str) -> None:
# Parse all the file # Parse all the file
for line_number, line in enumerate(file, start = 1): for line_number, line in enumerate(file, start = 1):
if 'const auto&' in line:
print(
f"Please use the 'auto const&' syntax instead of 'const auto&': {file_path} at line {line_number}")
check_failed = True
if re.search(r'\bconst\s+\w+\s*\*\b', line):
print(
f"Please use the 'Class/ObjectType const*' syntax instead of 'const Class/ObjectType*': {file_path} at line {line_number}")
check_failed = True
if [match for match in [' if(', ' if ( '] if match in line]: if [match for match in [' if(', ' if ( '] if match in line]:
print( print(
f"Please use the 'if (XXXX)' syntax instead of 'if(XXXX)': {file_path} at line {line_number}") f"Please use the 'if (XXXX)' syntax instead of 'if(XXXX)': {file_path} at line {line_number}")
@@ -78,7 +78,7 @@ private:
public: public:
BIH() { init_empty(); } BIH() { init_empty(); }
template< class BoundsFunc, class PrimArray > template< class BoundsFunc, class PrimArray >
void build(const PrimArray& primitives, BoundsFunc& GetBounds, uint32 leafSize = 3, bool printStats = false) void build(PrimArray const& primitives, BoundsFunc& GetBounds, uint32 leafSize = 3, bool printStats = false)
{ {
if (primitives.size() == 0) if (primitives.size() == 0)
{ {
@@ -120,7 +120,7 @@ public:
G3D::AABox const& bound() const { return bounds; } G3D::AABox const& bound() const { return bounds; }
template<typename RayCallback> template<typename RayCallback>
void intersectRay(const G3D::Ray& r, RayCallback& intersectCallback, float& maxDist, bool stopAtFirstHit) const void intersectRay(G3D::Ray const& r, RayCallback& intersectCallback, float& maxDist, bool stopAtFirstHit) const
{ {
float intervalMin = -1.f; float intervalMin = -1.f;
float intervalMax = -1.f; float intervalMax = -1.f;
@@ -283,7 +283,7 @@ public:
} }
template<typename IsectCallback> template<typename IsectCallback>
void intersectPoint(const G3D::Vector3& p, IsectCallback& intersectCallback) const void intersectPoint(G3D::Vector3 const& p, IsectCallback& intersectCallback) const
{ {
if (!bounds.contains(p)) if (!bounds.contains(p))
{ {
@@ -29,20 +29,20 @@ class BIHWrap
template<class RayCallback> template<class RayCallback>
struct MDLCallback struct MDLCallback
{ {
const T* const* objects; T const* const* objects;
RayCallback& _callback; RayCallback& _callback;
uint32 objects_size; uint32 objects_size;
MDLCallback(RayCallback& callback, const T* const* objects_array, uint32 objects_size ) : objects(objects_array), _callback(callback), objects_size(objects_size) { } MDLCallback(RayCallback& callback, T const* const* objects_array, uint32 objects_size ) : objects(objects_array), _callback(callback), objects_size(objects_size) { }
/// Intersect ray /// Intersect ray
bool operator() (const G3D::Ray& ray, uint32 idx, float& maxDist, bool stopAtFirstHit) bool operator() (G3D::Ray const& ray, uint32 idx, float& maxDist, bool stopAtFirstHit)
{ {
if (idx >= objects_size) if (idx >= objects_size)
{ {
return false; return false;
} }
if (const T* obj = objects[idx]) if (T const* obj = objects[idx])
{ {
return _callback(ray, *obj, maxDist, stopAtFirstHit); return _callback(ray, *obj, maxDist, stopAtFirstHit);
} }
@@ -50,41 +50,41 @@ class BIHWrap
} }
/// Intersect point /// Intersect point
void operator() (const G3D::Vector3& p, uint32 idx) void operator() (G3D::Vector3 const& p, uint32 idx)
{ {
if (idx >= objects_size) if (idx >= objects_size)
{ {
return; return;
} }
if (const T* obj = objects[idx]) if (T const* obj = objects[idx])
{ {
_callback(p, *obj); _callback(p, *obj);
} }
} }
}; };
typedef G3D::Array<const T*> ObjArray; typedef G3D::Array<T const*> ObjArray;
BIH m_tree; BIH m_tree;
ObjArray m_objects; ObjArray m_objects;
G3D::Table<const T*, uint32> m_obj2Idx; G3D::Table<T const*, uint32> m_obj2Idx;
G3D::Set<const T*> m_objects_to_push; G3D::Set<T const*> m_objects_to_push;
int unbalanced_times; int unbalanced_times;
public: public:
BIHWrap() : unbalanced_times(0) { } BIHWrap() : unbalanced_times(0) { }
void insert(const T& obj) void insert(T const& obj)
{ {
++unbalanced_times; ++unbalanced_times;
m_objects_to_push.insert(&obj); m_objects_to_push.insert(&obj);
} }
void remove(const T& obj) void remove(T const& obj)
{ {
++unbalanced_times; ++unbalanced_times;
uint32 Idx = 0; uint32 Idx = 0;
const T* temp; T const* temp;
if (m_obj2Idx.getRemove(&obj, temp, Idx)) if (m_obj2Idx.getRemove(&obj, temp, Idx))
{ {
m_objects[Idx] = nullptr; m_objects[Idx] = nullptr;
@@ -112,7 +112,7 @@ public:
} }
template<typename RayCallback> template<typename RayCallback>
void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& maxDist, bool stopAtFirstHit) void intersectRay(G3D::Ray const& ray, RayCallback& intersectCallback, float& maxDist, bool stopAtFirstHit)
{ {
balance(); balance();
MDLCallback<RayCallback> temp_cb(intersectCallback, m_objects.getCArray(), m_objects.size()); MDLCallback<RayCallback> temp_cb(intersectCallback, m_objects.getCArray(), m_objects.size());
@@ -120,7 +120,7 @@ public:
} }
template<typename IsectCallback> template<typename IsectCallback>
void intersectPoint(const G3D::Vector3& point, IsectCallback& intersectCallback) void intersectPoint(G3D::Vector3 const& point, IsectCallback& intersectCallback)
{ {
balance(); balance();
MDLCallback<IsectCallback> callback(intersectCallback, m_objects.getCArray(), m_objects.size()); MDLCallback<IsectCallback> callback(intersectCallback, m_objects.getCArray(), m_objects.size());
+13 -13
View File
@@ -40,18 +40,18 @@ namespace
template<> struct HashTrait< GameObjectModel> template<> struct HashTrait< GameObjectModel>
{ {
static std::size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; } static std::size_t hashCode(GameObjectModel const& g) { return (size_t)(void*)&g; }
}; };
template<> struct PositionTrait< GameObjectModel> template<> struct PositionTrait< GameObjectModel>
{ {
static void GetPosition(const GameObjectModel& g, G3D::Vector3& p) { p = g.GetPosition(); } static void GetPosition(GameObjectModel const& g, G3D::Vector3& p) { p = g.GetPosition(); }
}; };
template<> struct BoundsTrait< GameObjectModel> template<> struct BoundsTrait< GameObjectModel>
{ {
static void GetBounds(const GameObjectModel& g, G3D::AABox& out) { out = g.GetBounds();} static void GetBounds(GameObjectModel const& g, G3D::AABox& out) { out = g.GetBounds();}
static void GetBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->GetBounds();} static void GetBounds2(GameObjectModel const* g, G3D::AABox& out) { out = g->GetBounds();}
}; };
typedef RegularGrid2D<GameObjectModel, BIHWrap<GameObjectModel>> ParentTree; typedef RegularGrid2D<GameObjectModel, BIHWrap<GameObjectModel>> ParentTree;
@@ -67,13 +67,13 @@ struct DynTreeImpl : public ParentTree
{ {
} }
void insert(const Model& mdl) void insert(Model const& mdl)
{ {
base::insert(mdl); base::insert(mdl);
++unbalanced_times; ++unbalanced_times;
} }
void remove(const Model& mdl) void remove(Model const& mdl)
{ {
base::remove(mdl); base::remove(mdl);
++unbalanced_times; ++unbalanced_times;
@@ -114,17 +114,17 @@ DynamicMapTree::~DynamicMapTree()
delete impl; delete impl;
} }
void DynamicMapTree::insert(const GameObjectModel& mdl) void DynamicMapTree::insert(GameObjectModel const& mdl)
{ {
impl->insert(mdl); impl->insert(mdl);
} }
void DynamicMapTree::remove(const GameObjectModel& mdl) void DynamicMapTree::remove(GameObjectModel const& mdl)
{ {
impl->remove(mdl); impl->remove(mdl);
} }
bool DynamicMapTree::contains(const GameObjectModel& mdl) const bool DynamicMapTree::contains(GameObjectModel const& mdl) const
{ {
return impl->contains(mdl); return impl->contains(mdl);
} }
@@ -149,7 +149,7 @@ struct DynamicTreeIntersectionCallback
DynamicTreeIntersectionCallback(uint32 phasemask, VMAP::ModelIgnoreFlags ignoreFlags) : DynamicTreeIntersectionCallback(uint32 phasemask, VMAP::ModelIgnoreFlags ignoreFlags) :
_didHit(false), _phaseMask(phasemask), _ignoreFlags(ignoreFlags) { } _didHit(false), _phaseMask(phasemask), _ignoreFlags(ignoreFlags) { }
bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance, bool stopAtFirstHit) bool operator()(G3D::Ray const& r, GameObjectModel const& obj, float& distance, bool stopAtFirstHit)
{ {
bool result = obj.intersectRay(r, distance, stopAtFirstHit, _phaseMask, _ignoreFlags); bool result = obj.intersectRay(r, distance, stopAtFirstHit, _phaseMask, _ignoreFlags);
if (result) if (result)
@@ -196,7 +196,7 @@ private:
GameObjectModel const* _hitModel; GameObjectModel const* _hitModel;
}; };
bool DynamicMapTree::GetIntersectionTime(const uint32 phasemask, const G3D::Ray& ray, const G3D::Vector3& endPos, float& maxDist) const bool DynamicMapTree::GetIntersectionTime(const uint32 phasemask, G3D::Ray const& ray, G3D::Vector3 const& endPos, float& maxDist) const
{ {
float distance = maxDist; float distance = maxDist;
DynamicTreeIntersectionCallback callback(phasemask, VMAP::ModelIgnoreFlags::Nothing); DynamicTreeIntersectionCallback callback(phasemask, VMAP::ModelIgnoreFlags::Nothing);
@@ -208,8 +208,8 @@ bool DynamicMapTree::GetIntersectionTime(const uint32 phasemask, const G3D::Ray&
return callback.didHit(); return callback.didHit();
} }
bool DynamicMapTree::GetObjectHitPos(const uint32 phasemask, const G3D::Vector3& startPos, bool DynamicMapTree::GetObjectHitPos(const uint32 phasemask, G3D::Vector3 const& startPos,
const G3D::Vector3& endPos, G3D::Vector3& resultHit, G3D::Vector3 const& endPos, G3D::Vector3& resultHit,
float modifyDist) const float modifyDist) const
{ {
bool result = false; bool result = false;
+6 -6
View File
@@ -46,19 +46,19 @@ public:
[[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, VMAP::ModelIgnoreFlags ignoreFlags) const; [[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, VMAP::ModelIgnoreFlags ignoreFlags) const;
bool GetIntersectionTime(uint32 phasemask, const G3D::Ray& ray, const G3D::Vector3& endPos, float& maxDist) const; bool GetIntersectionTime(uint32 phasemask, G3D::Ray const& ray, G3D::Vector3 const& endPos, float& maxDist) const;
bool GetAreaAndLiquidData(float x, float y, float z, uint32 phasemask, Optional<uint8> reqLiquidType, VMAP::AreaAndLiquidData& data) const; bool GetAreaAndLiquidData(float x, float y, float z, uint32 phasemask, Optional<uint8> reqLiquidType, VMAP::AreaAndLiquidData& data) const;
bool GetObjectHitPos(uint32 phasemask, const G3D::Vector3& pPos1, bool GetObjectHitPos(uint32 phasemask, G3D::Vector3 const& pPos1,
const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos, G3D::Vector3 const& pPos2, G3D::Vector3& pResultHitPos,
float pModifyDist) const; float pModifyDist) const;
[[nodiscard]] float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const; [[nodiscard]] float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;
void insert(const GameObjectModel&); void insert(GameObjectModel const&);
void remove(const GameObjectModel&); void remove(GameObjectModel const&);
[[nodiscard]] bool contains(const GameObjectModel&) const; [[nodiscard]] bool contains(GameObjectModel const&) const;
[[nodiscard]] int size() const; [[nodiscard]] int size() const;
void balance(); void balance();
+1 -1
View File
@@ -90,7 +90,7 @@ namespace VMAP
virtual ~IVMapMgr() = default; virtual ~IVMapMgr() = default;
virtual LoadResult existsMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0; virtual LoadResult existsMap(char const* pBasePath, unsigned int pMapId, int x, int y) = 0;
/** /**
send debug commands send debug commands
+1 -1
View File
@@ -59,7 +59,7 @@ namespace VMAP
return fname.str(); return fname.str();
} }
LoadResult VMapMgr2::existsMap(const char* basePath, unsigned int mapId, int x, int y) LoadResult VMapMgr2::existsMap(char const* basePath, unsigned int mapId, int x, int y)
{ {
return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y); return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y);
} }
+1 -1
View File
@@ -72,7 +72,7 @@ namespace VMAP
{ {
return getMapFileName(mapId); return getMapFileName(mapId);
} }
LoadResult existsMap(const char* basePath, unsigned int mapId, int x, int y) override; LoadResult existsMap(char const* basePath, unsigned int mapId, int x, int y) override;
typedef uint32(*GetLiquidFlagsFn)(uint32 liquidType); typedef uint32(*GetLiquidFlagsFn)(uint32 liquidType);
GetLiquidFlagsFn GetLiquidFlagsPtr; GetLiquidFlagsFn GetLiquidFlagsPtr;
+1 -1
View File
@@ -45,7 +45,7 @@ struct MmapTileRecastConfig
float cellSizeVertical; float cellSizeVertical;
float maxSimplificationError; float maxSimplificationError;
bool operator==(const MmapTileRecastConfig& b) const { bool operator==(MmapTileRecastConfig const& b) const {
return walkableSlopeAngle == b.walkableSlopeAngle && return walkableSlopeAngle == b.walkableSlopeAngle &&
walkableRadius == b.walkableRadius && walkableRadius == b.walkableRadius &&
walkableHeight == b.walkableHeight && walkableHeight == b.walkableHeight &&
+10 -10
View File
@@ -36,7 +36,7 @@ namespace VMAP
{ {
public: public:
MapRayCallback(ModelInstance* val, ModelIgnoreFlags ignoreFlags): prims(val), flags(ignoreFlags), hit(false) { } MapRayCallback(ModelInstance* val, ModelIgnoreFlags ignoreFlags): prims(val), flags(ignoreFlags), hit(false) { }
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool StopAtFirstHit) bool operator()(G3D::Ray const& ray, uint32 entry, float& distance, bool StopAtFirstHit)
{ {
bool result = prims[entry].intersectRay(ray, distance, StopAtFirstHit, flags); bool result = prims[entry].intersectRay(ray, distance, StopAtFirstHit, flags);
if (result) if (result)
@@ -56,7 +56,7 @@ namespace VMAP
{ {
public: public:
LocationInfoCallback(ModelInstance* val, LocationInfo& info): prims(val), locInfo(info), result(false) {} LocationInfoCallback(ModelInstance* val, LocationInfo& info): prims(val), locInfo(info), result(false) {}
void operator()(const Vector3& point, uint32 entry) void operator()(Vector3 const& point, uint32 entry)
{ {
#if defined(VMAP_DEBUG) #if defined(VMAP_DEBUG)
LOG_DEBUG("maps", "LocationInfoCallback: trying to intersect '{}'", prims[entry].name); LOG_DEBUG("maps", "LocationInfoCallback: trying to intersect '{}'", prims[entry].name);
@@ -84,14 +84,14 @@ namespace VMAP
return tilefilename.str(); return tilefilename.str();
} }
bool StaticMapTree::GetLocationInfo(const Vector3& pos, LocationInfo& info) const bool StaticMapTree::GetLocationInfo(Vector3 const& pos, LocationInfo& info) const
{ {
LocationInfoCallback intersectionCallBack(iTreeValues, info); LocationInfoCallback intersectionCallBack(iTreeValues, info);
iTree.intersectPoint(pos, intersectionCallBack); iTree.intersectPoint(pos, intersectionCallBack);
return intersectionCallBack.result; return intersectionCallBack.result;
} }
StaticMapTree::StaticMapTree(uint32 mapID, const std::string& basePath) StaticMapTree::StaticMapTree(uint32 mapID, std::string const& basePath)
: iMapID(mapID), iIsTiled(false), iTreeValues(0), iBasePath(basePath) : iMapID(mapID), iIsTiled(false), iTreeValues(0), iBasePath(basePath)
{ {
if (iBasePath.length() > 0 && iBasePath[iBasePath.length() - 1] != '/' && iBasePath[iBasePath.length() - 1] != '\\') if (iBasePath.length() > 0 && iBasePath[iBasePath.length() - 1] != '/' && iBasePath[iBasePath.length() - 1] != '\\')
@@ -113,7 +113,7 @@ namespace VMAP
Else, pMaxDist is not modified and returns false; Else, pMaxDist is not modified and returns false;
*/ */
bool StaticMapTree::GetIntersectionTime(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const bool StaticMapTree::GetIntersectionTime(G3D::Ray const& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const
{ {
float distance = pMaxDist; float distance = pMaxDist;
MapRayCallback intersectionCallBack(iTreeValues, ignoreFlags); MapRayCallback intersectionCallBack(iTreeValues, ignoreFlags);
@@ -126,7 +126,7 @@ namespace VMAP
} }
//========================================================= //=========================================================
bool StaticMapTree::isInLineOfSight(const Vector3& pos1, const Vector3& pos2, ModelIgnoreFlags ignoreFlags) const bool StaticMapTree::isInLineOfSight(Vector3 const& pos1, Vector3 const& pos2, ModelIgnoreFlags ignoreFlags) const
{ {
float maxDist = (pos2 - pos1).magnitude(); float maxDist = (pos2 - pos1).magnitude();
// return false if distance is over max float, in case of cheater teleporting to the end of the universe // return false if distance is over max float, in case of cheater teleporting to the end of the universe
@@ -153,7 +153,7 @@ namespace VMAP
Return the hit pos or the original dest pos Return the hit pos or the original dest pos
*/ */
bool StaticMapTree::GetObjectHitPos(const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const bool StaticMapTree::GetObjectHitPos(Vector3 const& pPos1, Vector3 const& pPos2, Vector3& pResultHitPos, float pModifyDist) const
{ {
bool result = false; bool result = false;
float maxDist = (pPos2 - pPos1).magnitude(); float maxDist = (pPos2 - pPos1).magnitude();
@@ -198,7 +198,7 @@ namespace VMAP
//========================================================= //=========================================================
float StaticMapTree::getHeight(const Vector3& pPos, float maxSearchDist) const float StaticMapTree::getHeight(Vector3 const& pPos, float maxSearchDist) const
{ {
float height = G3D::finf(); float height = G3D::finf();
Vector3 dir = Vector3(0, 0, -1); Vector3 dir = Vector3(0, 0, -1);
@@ -213,7 +213,7 @@ namespace VMAP
//========================================================= //=========================================================
LoadResult StaticMapTree::CanLoadMap(const std::string& vmapPath, uint32 mapID, uint32 tileX, uint32 tileY) LoadResult StaticMapTree::CanLoadMap(std::string const& vmapPath, uint32 mapID, uint32 tileX, uint32 tileY)
{ {
std::string basePath = vmapPath; std::string basePath = vmapPath;
if (basePath.length() > 0 && basePath[basePath.length() - 1] != '/' && basePath[basePath.length() - 1] != '\\') if (basePath.length() > 0 && basePath[basePath.length() - 1] != '/' && basePath[basePath.length() - 1] != '\\')
@@ -260,7 +260,7 @@ namespace VMAP
//========================================================= //=========================================================
bool StaticMapTree::InitMap(const std::string& fname) bool StaticMapTree::InitMap(std::string const& fname)
{ {
//VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : initializing StaticMapTree '{}'", fname); //VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : initializing StaticMapTree '{}'", fname);
bool success = false; bool success = false;
+11 -11
View File
@@ -32,15 +32,15 @@ namespace VMAP
struct GroupLocationInfo struct GroupLocationInfo
{ {
const GroupModel* hitModel = nullptr; GroupModel const* hitModel = nullptr;
int32 rootId = -1; int32 rootId = -1;
}; };
struct LocationInfo struct LocationInfo
{ {
LocationInfo(): ground_Z(-G3D::inf()) { } LocationInfo(): ground_Z(-G3D::inf()) { }
const ModelInstance* hitInstance{nullptr}; ModelInstance const* hitInstance{nullptr};
const GroupModel* hitModel{nullptr}; GroupModel const* hitModel{nullptr};
float ground_Z; float ground_Z;
int32 rootId = -1; int32 rootId = -1;
}; };
@@ -63,23 +63,23 @@ namespace VMAP
std::string iBasePath; std::string iBasePath;
private: private:
bool GetIntersectionTime(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const; bool GetIntersectionTime(G3D::Ray const& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const;
//bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); } //bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); }
public: public:
static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY); static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY);
static uint32 packTileID(uint32 tileX, uint32 tileY) { return tileX << 16 | tileY; } static uint32 packTileID(uint32 tileX, uint32 tileY) { return tileX << 16 | tileY; }
static void unpackTileID(uint32 ID, uint32& tileX, uint32& tileY) { tileX = ID >> 16; tileY = ID & 0xFF; } static void unpackTileID(uint32 ID, uint32& tileX, uint32& tileY) { tileX = ID >> 16; tileY = ID & 0xFF; }
static LoadResult CanLoadMap(const std::string& basePath, uint32 mapID, uint32 tileX, uint32 tileY); static LoadResult CanLoadMap(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY);
StaticMapTree(uint32 mapID, const std::string& basePath); StaticMapTree(uint32 mapID, std::string const& basePath);
~StaticMapTree(); ~StaticMapTree();
[[nodiscard]] bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2, ModelIgnoreFlags ignoreFlags) const; [[nodiscard]] bool isInLineOfSight(G3D::Vector3 const& pos1, G3D::Vector3 const& pos2, ModelIgnoreFlags ignoreFlags) const;
bool GetObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const; bool GetObjectHitPos(G3D::Vector3 const& pos1, G3D::Vector3 const& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const;
[[nodiscard]] float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const; [[nodiscard]] float getHeight(G3D::Vector3 const& pPos, float maxSearchDist) const;
bool GetLocationInfo(const G3D::Vector3& pos, LocationInfo& info) const; bool GetLocationInfo(G3D::Vector3 const& pos, LocationInfo& info) const;
bool InitMap(const std::string& fname); bool InitMap(std::string const& fname);
void UnloadMap(); void UnloadMap();
bool LoadMapTile(uint32 tileX, uint32 tileY); bool LoadMapTile(uint32 tileX, uint32 tileY);
void UnloadMapTile(uint32 tileX, uint32 tileY); void UnloadMapTile(uint32 tileX, uint32 tileY);
+8 -8
View File
@@ -32,18 +32,18 @@ using std::pair;
template<> struct BoundsTrait<VMAP::ModelSpawn*> template<> struct BoundsTrait<VMAP::ModelSpawn*>
{ {
static void GetBounds(const VMAP::ModelSpawn* const& obj, G3D::AABox& out) { out = obj->GetBounds(); } static void GetBounds(VMAP::ModelSpawn const* const& obj, G3D::AABox& out) { out = obj->GetBounds(); }
}; };
namespace VMAP namespace VMAP
{ {
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len) bool readChunk(FILE* rf, char* dest, char const* compare, uint32 len)
{ {
if (fread(dest, sizeof(char), len, rf) != len) { return false; } if (fread(dest, sizeof(char), len, rf) != len) { return false; }
return memcmp(dest, compare, len) == 0; return memcmp(dest, compare, len) == 0;
} }
Vector3 ModelPosition::transform(const Vector3& pIn) const Vector3 ModelPosition::transform(Vector3 const& pIn) const
{ {
Vector3 out = pIn * iScale; Vector3 out = pIn * iScale;
out = iRotation * out; out = iRotation * out;
@@ -52,7 +52,7 @@ namespace VMAP
//================================================================= //=================================================================
TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName) TileAssembler::TileAssembler(std::string const& pSrcDirName, std::string const& pDestDirName)
: iDestDir(pDestDirName), iSrcDir(pSrcDirName) : iDestDir(pDestDirName), iSrcDir(pSrcDirName)
{ {
boost::filesystem::create_directory(iDestDir); boost::filesystem::create_directory(iDestDir);
@@ -156,7 +156,7 @@ namespace VMAP
TileMap::iterator tile; TileMap::iterator tile;
for (tile = tileEntries.begin(); tile != tileEntries.end(); ++tile) for (tile = tileEntries.begin(); tile != tileEntries.end(); ++tile)
{ {
const ModelSpawn& spawn = map_iter->second->UniqueEntries[tile->second]; ModelSpawn const& spawn = map_iter->second->UniqueEntries[tile->second];
if (spawn.flags & MOD_WORLDSPAWN) // WDT spawn, saved as tile 65/65 currently... if (spawn.flags & MOD_WORLDSPAWN) // WDT spawn, saved as tile 65/65 currently...
{ {
continue; continue;
@@ -181,7 +181,7 @@ namespace VMAP
{ {
++tile; ++tile;
} }
const ModelSpawn& spawn2 = map_iter->second->UniqueEntries[tile->second]; ModelSpawn const& spawn2 = map_iter->second->UniqueEntries[tile->second];
success = success && ModelSpawn::writeToFile(tilefile, spawn2); success = success && ModelSpawn::writeToFile(tilefile, spawn2);
// MapTree nodes to update when loading tile: // MapTree nodes to update when loading tile:
std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID); std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID);
@@ -331,7 +331,7 @@ namespace VMAP
}; };
#pragma pack(pop) #pragma pack(pop)
//================================================================= //=================================================================
bool TileAssembler::convertRawFile(const std::string& pModelFilename) bool TileAssembler::convertRawFile(std::string const& pModelFilename)
{ {
bool success = true; bool success = true;
std::string filename = iSrcDir; std::string filename = iSrcDir;
@@ -566,7 +566,7 @@ namespace VMAP
delete liquid; delete liquid;
} }
bool WorldModel_Raw::Read(const char* path) bool WorldModel_Raw::Read(char const* path)
{ {
FILE* rf = fopen(path, "rb"); FILE* rf = fopen(path, "rb");
if (!rf) if (!rf)
+5 -5
View File
@@ -47,8 +47,8 @@ namespace VMAP
{ {
iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif() * iDir.y / 180.f, G3D::pif() * iDir.x / 180.f, G3D::pif() * iDir.z / 180.f); iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif() * iDir.y / 180.f, G3D::pif() * iDir.x / 180.f, G3D::pif() * iDir.z / 180.f);
} }
[[nodiscard]] G3D::Vector3 transform(const G3D::Vector3& pIn) const; [[nodiscard]] G3D::Vector3 transform(G3D::Vector3 const& pIn) const;
void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; } void moveToBasePos(G3D::Vector3 const& pBasePos) { iPos -= pBasePos; }
}; };
typedef std::map<uint32, ModelSpawn> UniqueEntryMap; typedef std::map<uint32, ModelSpawn> UniqueEntryMap;
@@ -86,7 +86,7 @@ namespace VMAP
uint32 RootWMOID; uint32 RootWMOID;
std::vector<GroupModel_Raw> groupsArray; std::vector<GroupModel_Raw> groupsArray;
bool Read(const char* path); bool Read(char const* path);
}; };
class TileAssembler class TileAssembler
@@ -99,7 +99,7 @@ namespace VMAP
std::set<std::string> spawnedModelFiles; std::set<std::string> spawnedModelFiles;
public: public:
TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName); TileAssembler(std::string const& pSrcDirName, std::string const& pDestDirName);
virtual ~TileAssembler(); virtual ~TileAssembler();
bool convertWorld2(); bool convertWorld2();
@@ -107,7 +107,7 @@ namespace VMAP
bool calculateTransformedBound(ModelSpawn& spawn); bool calculateTransformedBound(ModelSpawn& spawn);
void exportGameobjectModels(); void exportGameobjectModels();
bool convertRawFile(const std::string& pModelFilename); bool convertRawFile(std::string const& pModelFilename);
}; };
} // VMAP } // VMAP
@@ -170,7 +170,7 @@ GameObjectModel* GameObjectModel::Create(std::unique_ptr<GameObjectModelOwnerBas
return mdl; return mdl;
} }
bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask, VMAP::ModelIgnoreFlags ignoreFlags) const bool GameObjectModel::intersectRay(G3D::Ray const& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask, VMAP::ModelIgnoreFlags ignoreFlags) const
{ {
if (!(phasemask & ph_mask) || !owner->IsSpawned()) if (!(phasemask & ph_mask) || !owner->IsSpawned())
{ {
@@ -57,11 +57,11 @@ class GameObjectModel
public: public:
std::string name; std::string name;
[[nodiscard]] const G3D::AABox& GetBounds() const { return iBound; } [[nodiscard]] G3D::AABox const& GetBounds() const { return iBound; }
~GameObjectModel() = default; ~GameObjectModel() = default;
[[nodiscard]] const G3D::Vector3& GetPosition() const { return iPos; } [[nodiscard]] G3D::Vector3 const& GetPosition() const { return iPos; }
/** Enables\disables collision. */ /** Enables\disables collision. */
void disable() { phasemask = 0; } void disable() { phasemask = 0; }
@@ -70,7 +70,7 @@ public:
[[nodiscard]] bool isEnabled() const { return phasemask != 0; } [[nodiscard]] bool isEnabled() const { return phasemask != 0; }
[[nodiscard]] bool IsMapObject() const { return isWmo; } [[nodiscard]] bool IsMapObject() const { return isWmo; }
bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask, VMAP::ModelIgnoreFlags ignoreFlags) const; bool intersectRay(G3D::Ray const& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask, VMAP::ModelIgnoreFlags ignoreFlags) const;
bool GetLocationInfo(G3D::Vector3 const& point, VMAP::LocationInfo& info, uint32 ph_mask) const; bool GetLocationInfo(G3D::Vector3 const& point, VMAP::LocationInfo& info, uint32 ph_mask) const;
bool GetLiquidLevel(G3D::Vector3 const& point, VMAP::LocationInfo& info, float& liqHeight) const; bool GetLiquidLevel(G3D::Vector3 const& point, VMAP::LocationInfo& info, float& liqHeight) const;
@@ -24,13 +24,13 @@ using G3D::Ray;
namespace VMAP namespace VMAP
{ {
ModelInstance::ModelInstance(const ModelSpawn& spawn, std::shared_ptr<WorldModel> model): ModelSpawn(spawn), iModel(model) ModelInstance::ModelInstance(ModelSpawn const& spawn, std::shared_ptr<WorldModel> model): ModelSpawn(spawn), iModel(model)
{ {
iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi() * iRot.y / 180.f, G3D::pi() * iRot.x / 180.f, G3D::pi() * iRot.z / 180.f).inverse(); iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi() * iRot.y / 180.f, G3D::pi() * iRot.x / 180.f, G3D::pi() * iRot.z / 180.f).inverse();
iInvScale = 1.f / iScale; iInvScale = 1.f / iScale;
} }
bool ModelInstance::intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const bool ModelInstance::intersectRay(G3D::Ray const& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const
{ {
if (!iModel) if (!iModel)
{ {
@@ -63,7 +63,7 @@ namespace VMAP
return hit; return hit;
} }
bool ModelInstance::GetLocationInfo(const G3D::Vector3& p, LocationInfo& info) const bool ModelInstance::GetLocationInfo(G3D::Vector3 const& p, LocationInfo& info) const
{ {
if (!iModel) if (!iModel)
{ {
@@ -107,7 +107,7 @@ namespace VMAP
return false; return false;
} }
bool ModelInstance::GetLiquidLevel(const G3D::Vector3& p, LocationInfo& info, float& liqHeight) const bool ModelInstance::GetLiquidLevel(G3D::Vector3 const& p, LocationInfo& info, float& liqHeight) const
{ {
// child bounds are defined in object space: // child bounds are defined in object space:
Vector3 pModel = iInvRot * (p - iPos) * iInvScale; Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
@@ -170,7 +170,7 @@ namespace VMAP
return true; return true;
} }
bool ModelSpawn::writeToFile(FILE* wf, const ModelSpawn& spawn) bool ModelSpawn::writeToFile(FILE* wf, ModelSpawn const& spawn)
{ {
uint32 check = 0; uint32 check = 0;
check += fwrite(&spawn.flags, sizeof(uint32), 1, wf); check += fwrite(&spawn.flags, sizeof(uint32), 1, wf);
+7 -7
View File
@@ -51,23 +51,23 @@ namespace VMAP
float iScale; float iScale;
G3D::AABox iBound; G3D::AABox iBound;
std::string name; std::string name;
bool operator==(const ModelSpawn& other) const { return ID == other.ID; } bool operator==(ModelSpawn const& other) const { return ID == other.ID; }
//uint32 hashCode() const { return ID; } //uint32 hashCode() const { return ID; }
// temp? // temp?
[[nodiscard]] const G3D::AABox& GetBounds() const { return iBound; } [[nodiscard]] G3D::AABox const& GetBounds() const { return iBound; }
static bool readFromFile(FILE* rf, ModelSpawn& spawn); static bool readFromFile(FILE* rf, ModelSpawn& spawn);
static bool writeToFile(FILE* rw, const ModelSpawn& spawn); static bool writeToFile(FILE* rw, ModelSpawn const& spawn);
}; };
class ModelInstance: public ModelSpawn class ModelInstance: public ModelSpawn
{ {
public: public:
ModelInstance() { } ModelInstance() { }
ModelInstance(const ModelSpawn& spawn, std::shared_ptr<WorldModel> model); ModelInstance(ModelSpawn const& spawn, std::shared_ptr<WorldModel> model);
bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const; bool intersectRay(G3D::Ray const& pRay, float& pMaxDist, bool StopAtFirstHit, ModelIgnoreFlags ignoreFlags) const;
bool GetLocationInfo(const G3D::Vector3& p, LocationInfo& info) const; bool GetLocationInfo(G3D::Vector3 const& p, LocationInfo& info) const;
bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo& info, float& liqHeight) const; bool GetLiquidLevel(G3D::Vector3 const& p, LocationInfo& info, float& liqHeight) const;
WorldModel* getWorldModel() { return iModel.get(); } WorldModel* getWorldModel() { return iModel.get(); }
protected: protected:
G3D::Matrix3 iInvRot; G3D::Matrix3 iInvRot;
+19 -19
View File
@@ -26,12 +26,12 @@ using G3D::Vector3;
template<> struct BoundsTrait<VMAP::GroupModel> template<> struct BoundsTrait<VMAP::GroupModel>
{ {
static void GetBounds(const VMAP::GroupModel& obj, G3D::AABox& out) { out = obj.GetBound(); } static void GetBounds(VMAP::GroupModel const& obj, G3D::AABox& out) { out = obj.GetBound(); }
}; };
namespace VMAP namespace VMAP
{ {
bool IntersectTriangle(const MeshTriangle& tri, std::vector<Vector3>::const_iterator points, const G3D::Ray& ray, float& distance) bool IntersectTriangle(MeshTriangle const& tri, std::vector<Vector3>::const_iterator points, G3D::Ray const& ray, float& distance)
{ {
static const float EPS = 1e-5f; static const float EPS = 1e-5f;
@@ -88,7 +88,7 @@ namespace VMAP
{ {
public: public:
TriBoundFunc(std::vector<Vector3>& vert): vertices(vert.begin()) { } TriBoundFunc(std::vector<Vector3>& vert): vertices(vert.begin()) { }
void operator()(const MeshTriangle& tri, G3D::AABox& out) const void operator()(MeshTriangle const& tri, G3D::AABox& out) const
{ {
G3D::Vector3 lo = vertices[tri.idx0]; G3D::Vector3 lo = vertices[tri.idx0];
G3D::Vector3 hi = lo; G3D::Vector3 hi = lo;
@@ -104,7 +104,7 @@ namespace VMAP
// ===================== WmoLiquid ================================== // ===================== WmoLiquid ==================================
WmoLiquid::WmoLiquid(uint32 width, uint32 height, const Vector3& corner, uint32 type): WmoLiquid::WmoLiquid(uint32 width, uint32 height, Vector3 const& corner, uint32 type):
iTilesX(width), iTilesY(height), iCorner(corner), iType(type) iTilesX(width), iTilesY(height), iCorner(corner), iType(type)
{ {
if (width && height) if (width && height)
@@ -119,7 +119,7 @@ namespace VMAP
} }
} }
WmoLiquid::WmoLiquid(const WmoLiquid& other): iHeight(0), iFlags(0) WmoLiquid::WmoLiquid(WmoLiquid const& other): iHeight(0), iFlags(0)
{ {
*this = other; // use assignment operator... *this = other; // use assignment operator...
} }
@@ -130,7 +130,7 @@ namespace VMAP
delete[] iFlags; delete[] iFlags;
} }
WmoLiquid& WmoLiquid::operator=(const WmoLiquid& other) WmoLiquid& WmoLiquid::operator=(WmoLiquid const& other)
{ {
if (this == &other) if (this == &other)
{ {
@@ -163,7 +163,7 @@ namespace VMAP
return *this; return *this;
} }
bool WmoLiquid::GetLiquidHeight(const Vector3& pos, float& liqHeight) const bool WmoLiquid::GetLiquidHeight(Vector3 const& pos, float& liqHeight) const
{ {
// simple case // simple case
if (!iFlags) if (!iFlags)
@@ -311,7 +311,7 @@ namespace VMAP
// ===================== GroupModel ================================== // ===================== GroupModel ==================================
GroupModel::GroupModel(const GroupModel& other): GroupModel::GroupModel(GroupModel const& other):
iBound(other.iBound), iMogpFlags(other.iMogpFlags), iGroupWMOID(other.iGroupWMOID), iBound(other.iBound), iMogpFlags(other.iMogpFlags), iGroupWMOID(other.iGroupWMOID),
vertices(other.vertices), triangles(other.triangles), meshTree(other.meshTree), iLiquid(0) vertices(other.vertices), triangles(other.triangles), meshTree(other.meshTree), iLiquid(0)
{ {
@@ -426,9 +426,9 @@ namespace VMAP
struct GModelRayCallback struct GModelRayCallback
{ {
GModelRayCallback(const std::vector<MeshTriangle>& tris, const std::vector<Vector3>& vert): GModelRayCallback(std::vector<MeshTriangle> const& tris, std::vector<Vector3> const& vert):
vertices(vert.begin()), triangles(tris.begin()), hit(false) { } vertices(vert.begin()), triangles(tris.begin()), hit(false) { }
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*StopAtFirstHit*/) bool operator()(G3D::Ray const& ray, uint32 entry, float& distance, bool /*StopAtFirstHit*/)
{ {
bool result = IntersectTriangle(triangles[entry], vertices, ray, distance); bool result = IntersectTriangle(triangles[entry], vertices, ray, distance);
if (result) { hit = true; } if (result) { hit = true; }
@@ -439,7 +439,7 @@ namespace VMAP
bool hit; bool hit;
}; };
bool GroupModel::IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const bool GroupModel::IntersectRay(G3D::Ray const& ray, float& distance, bool stopAtFirstHit) const
{ {
if (triangles.empty()) if (triangles.empty())
{ {
@@ -451,7 +451,7 @@ namespace VMAP
return callback.hit; return callback.hit;
} }
inline bool IsInsideOrAboveBound(G3D::AABox const& bounds, const G3D::Point3& point) inline bool IsInsideOrAboveBound(G3D::AABox const& bounds, G3D::Point3 const& point)
{ {
return point.x >= bounds.low().x return point.x >= bounds.low().x
&& point.y >= bounds.low().y && point.y >= bounds.low().y
@@ -493,7 +493,7 @@ namespace VMAP
return OUT_OF_BOUNDS; return OUT_OF_BOUNDS;
} }
bool GroupModel::GetLiquidLevel(const Vector3& pos, float& liqHeight) const bool GroupModel::GetLiquidLevel(Vector3 const& pos, float& liqHeight) const
{ {
if (iLiquid) if (iLiquid)
{ {
@@ -528,8 +528,8 @@ namespace VMAP
struct WModelRayCallBack struct WModelRayCallBack
{ {
WModelRayCallBack(const std::vector<GroupModel>& mod): models(mod.begin()), hit(false) { } WModelRayCallBack(std::vector<GroupModel> const& mod): models(mod.begin()), hit(false) { }
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool StopAtFirstHit) bool operator()(G3D::Ray const& ray, uint32 entry, float& distance, bool StopAtFirstHit)
{ {
bool result = models[entry].IntersectRay(ray, distance, StopAtFirstHit); bool result = models[entry].IntersectRay(ray, distance, StopAtFirstHit);
if (result) { hit = true; } if (result) { hit = true; }
@@ -539,7 +539,7 @@ namespace VMAP
bool hit; bool hit;
}; };
bool WorldModel::IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) const bool WorldModel::IntersectRay(G3D::Ray const& ray, float& distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) const
{ {
// If the caller asked us to ignore certain objects we should check flags // If the caller asked us to ignore certain objects we should check flags
if ((ignoreFlags & ModelIgnoreFlags::M2) != ModelIgnoreFlags::Nothing) if ((ignoreFlags & ModelIgnoreFlags::M2) != ModelIgnoreFlags::Nothing)
@@ -591,7 +591,7 @@ namespace VMAP
} }
}; };
bool WorldModel::GetLocationInfo(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, GroupLocationInfo& info) const bool WorldModel::GetLocationInfo(G3D::Vector3 const& p, G3D::Vector3 const& down, float& dist, GroupLocationInfo& info) const
{ {
if (groupModels.empty()) if (groupModels.empty())
{ {
@@ -623,7 +623,7 @@ namespace VMAP
return false; return false;
} }
bool WorldModel::writeFile(const std::string& filename) bool WorldModel::writeFile(std::string const& filename)
{ {
FILE* wf = fopen(filename.c_str(), "wb"); FILE* wf = fopen(filename.c_str(), "wb");
if (!wf) if (!wf)
@@ -660,7 +660,7 @@ namespace VMAP
return result; return result;
} }
bool WorldModel::readFile(const std::string& filename) bool WorldModel::readFile(std::string const& filename)
{ {
FILE* rf = fopen(filename.c_str(), "rb"); FILE* rf = fopen(filename.c_str(), "rb");
if (!rf) if (!rf)
+12 -12
View File
@@ -46,11 +46,11 @@ namespace VMAP
class WmoLiquid class WmoLiquid
{ {
public: public:
WmoLiquid(uint32 width, uint32 height, const G3D::Vector3& corner, uint32 type); WmoLiquid(uint32 width, uint32 height, G3D::Vector3 const& corner, uint32 type);
WmoLiquid(const WmoLiquid& other); WmoLiquid(WmoLiquid const& other);
~WmoLiquid(); ~WmoLiquid();
WmoLiquid& operator=(const WmoLiquid& other); WmoLiquid& operator=(WmoLiquid const& other);
bool GetLiquidHeight(const G3D::Vector3& pos, float& liqHeight) const; bool GetLiquidHeight(G3D::Vector3 const& pos, float& liqHeight) const;
[[nodiscard]] uint32 GetType() const { return iType; } [[nodiscard]] uint32 GetType() const { return iType; }
float* GetHeightStorage() { return iHeight; } float* GetHeightStorage() { return iHeight; }
uint8* GetFlagsStorage() { return iFlags; } uint8* GetFlagsStorage() { return iFlags; }
@@ -73,18 +73,18 @@ namespace VMAP
{ {
public: public:
GroupModel() { } GroupModel() { }
GroupModel(const GroupModel& other); GroupModel(GroupModel const& other);
GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox& bound): GroupModel(uint32 mogpFlags, uint32 groupWMOID, G3D::AABox const& bound):
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(nullptr) { } iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(nullptr) { }
~GroupModel() { delete iLiquid; } ~GroupModel() { delete iLiquid; }
//! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry!
void setMeshData(std::vector<G3D::Vector3>& vert, std::vector<MeshTriangle>& tri); void setMeshData(std::vector<G3D::Vector3>& vert, std::vector<MeshTriangle>& tri);
void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = nullptr; } void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = nullptr; }
bool IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const; bool IntersectRay(G3D::Ray const& ray, float& distance, bool stopAtFirstHit) const;
enum InsideResult { INSIDE = 0, MAYBE_INSIDE = 1, ABOVE = 2, OUT_OF_BOUNDS = -1 }; enum InsideResult { INSIDE = 0, MAYBE_INSIDE = 1, ABOVE = 2, OUT_OF_BOUNDS = -1 };
InsideResult IsInsideObject(G3D::Ray const& ray, float& z_dist) const; InsideResult IsInsideObject(G3D::Ray const& ray, float& z_dist) const;
bool GetLiquidLevel(const G3D::Vector3& pos, float& liqHeight) const; bool GetLiquidLevel(G3D::Vector3 const& pos, float& liqHeight) const;
[[nodiscard]] uint32 GetLiquidType() const; [[nodiscard]] uint32 GetLiquidType() const;
bool writeToFile(FILE* wf); bool writeToFile(FILE* wf);
bool readFromFile(FILE* rf); bool readFromFile(FILE* rf);
@@ -111,10 +111,10 @@ namespace VMAP
//! pass group models to WorldModel and create BIH. Passed vector is swapped with old geometry! //! pass group models to WorldModel and create BIH. Passed vector is swapped with old geometry!
void setGroupModels(std::vector<GroupModel>& models); void setGroupModels(std::vector<GroupModel>& models);
void setRootWmoID(uint32 id) { RootWMOID = id; } void setRootWmoID(uint32 id) { RootWMOID = id; }
bool IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) const; bool IntersectRay(G3D::Ray const& ray, float& distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) const;
bool GetLocationInfo(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, GroupLocationInfo& info) const; bool GetLocationInfo(G3D::Vector3 const& p, G3D::Vector3 const& down, float& dist, GroupLocationInfo& info) const;
bool writeFile(const std::string& filename); bool writeFile(std::string const& filename);
bool readFile(const std::string& filename); bool readFile(std::string const& filename);
void GetGroupModels(std::vector<GroupModel>& outGroupModels); void GetGroupModels(std::vector<GroupModel>& outGroupModels);
uint32 Flags; uint32 Flags;
protected: protected:
+9 -9
View File
@@ -51,7 +51,7 @@ public:
#define HGRID_MAP_SIZE (533.33333f * 64.f) // shouldn't be changed #define HGRID_MAP_SIZE (533.33333f * 64.f) // shouldn't be changed
#define CELL_SIZE float(HGRID_MAP_SIZE/(float)CELL_NUMBER) #define CELL_SIZE float(HGRID_MAP_SIZE/(float)CELL_NUMBER)
typedef G3D::Table<const T*, NodeArray<Node>> MemberTable; typedef G3D::Table<T const*, NodeArray<Node>> MemberTable;
MemberTable memberTable; MemberTable memberTable;
Node* nodes[CELL_NUMBER][CELL_NUMBER]; Node* nodes[CELL_NUMBER][CELL_NUMBER];
@@ -70,7 +70,7 @@ public:
} }
} }
void insert(const T& value) void insert(T const& value)
{ {
G3D::Vector3 pos[9]; G3D::Vector3 pos[9];
pos[0] = value.GetBounds().corner(0); pos[0] = value.GetBounds().corner(0);
@@ -110,7 +110,7 @@ public:
memberTable.set(&value, na); memberTable.set(&value, na);
} }
void remove(const T& value) void remove(T const& value)
{ {
NodeArray<Node>& na = memberTable[&value]; NodeArray<Node>& na = memberTable[&value];
for (uint8 i = 0; i < 9; ++i) for (uint8 i = 0; i < 9; ++i)
@@ -139,13 +139,13 @@ public:
} }
} }
bool contains(const T& value) const { return memberTable.containsKey(&value); } bool contains(T const& value) const { return memberTable.containsKey(&value); }
int size() const { return memberTable.size(); } int size() const { return memberTable.size(); }
struct Cell struct Cell
{ {
int x, y; int x, y;
bool operator == (const Cell& c2) const { return x == c2.x && y == c2.y;} bool operator == (Cell const& c2) const { return x == c2.x && y == c2.y;}
static Cell ComputeCell(float fx, float fy) static Cell ComputeCell(float fx, float fy)
{ {
@@ -173,13 +173,13 @@ public:
} }
template<typename RayCallback> template<typename RayCallback>
void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float max_dist, bool stopAtFirstHit) void intersectRay(G3D::Ray const& ray, RayCallback& intersectCallback, float max_dist, bool stopAtFirstHit)
{ {
intersectRay(ray, intersectCallback, max_dist, ray.origin() + ray.direction() * max_dist, stopAtFirstHit); intersectRay(ray, intersectCallback, max_dist, ray.origin() + ray.direction() * max_dist, stopAtFirstHit);
} }
template<typename RayCallback> template<typename RayCallback>
void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist, const G3D::Vector3& end, bool stopAtFirstHit) void intersectRay(G3D::Ray const& ray, RayCallback& intersectCallback, float& max_dist, G3D::Vector3 const& end, bool stopAtFirstHit)
{ {
Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y); Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);
if (!cell.isValid()) if (!cell.isValid())
@@ -261,7 +261,7 @@ public:
} }
template<typename IsectCallback> template<typename IsectCallback>
void intersectPoint(const G3D::Vector3& point, IsectCallback& intersectCallback) void intersectPoint(G3D::Vector3 const& point, IsectCallback& intersectCallback)
{ {
Cell cell = Cell::ComputeCell(point.x, point.y); Cell cell = Cell::ComputeCell(point.x, point.y);
if (!cell.isValid()) if (!cell.isValid())
@@ -276,7 +276,7 @@ public:
// Optimized verson of intersectRay function for rays with vertical directions // Optimized verson of intersectRay function for rays with vertical directions
template<typename RayCallback> template<typename RayCallback>
void intersectZAllignedRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist) void intersectZAllignedRay(G3D::Ray const& ray, RayCallback& intersectCallback, float& max_dist)
{ {
Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y); Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);
if (!cell.isValid()) if (!cell.isValid())
+1 -1
View File
@@ -27,6 +27,6 @@ namespace VMAP
const char GAMEOBJECT_MODELS[] = "GameObjectModels.dtree"; const char GAMEOBJECT_MODELS[] = "GameObjectModels.dtree";
// defined in TileAssembler.cpp currently... // defined in TileAssembler.cpp currently...
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len); bool readChunk(FILE* rf, char* dest, char const* compare, uint32 len);
} }
#endif #endif
+6 -6
View File
@@ -37,7 +37,7 @@ namespace VMAP
G3D::Vector3 hitLocation; G3D::Vector3 hitLocation;
G3D::Vector3 hitNormal; G3D::Vector3 hitNormal;
void operator()(const G3D::Ray& ray, const TValue* entity, bool StopAtFirstHit, float& distance) void operator()(G3D::Ray const& ray, TValue const* entity, bool StopAtFirstHit, float& distance)
{ {
entity->intersect(ray, distance, StopAtFirstHit, hitLocation, hitNormal); entity->intersect(ray, distance, StopAtFirstHit, hitLocation, hitNormal);
} }
@@ -51,9 +51,9 @@ namespace VMAP
{ {
public: public:
static bool collisionLocationForMovingPointFixedAABox( static bool collisionLocationForMovingPointFixedAABox(
const G3D::Vector3& origin, G3D::Vector3 const& origin,
const G3D::Vector3& dir, G3D::Vector3 const& dir,
const G3D::AABox& box, G3D::AABox const& box,
G3D::Vector3& location, G3D::Vector3& location,
bool& Inside) bool& Inside)
{ {
@@ -61,8 +61,8 @@ namespace VMAP
#define IR(x) (reinterpret_cast<G3D::uint32 const&>(x)) #define IR(x) (reinterpret_cast<G3D::uint32 const&>(x))
Inside = true; Inside = true;
const G3D::Vector3& MinB = box.low(); G3D::Vector3 const& MinB = box.low();
const G3D::Vector3& MaxB = box.high(); G3D::Vector3 const& MaxB = box.high();
G3D::Vector3 MaxT(-1.0f, -1.0f, -1.0f); G3D::Vector3 MaxT(-1.0f, -1.0f, -1.0f);
// Find candidate planes. // Find candidate planes.
+1 -1
View File
@@ -75,7 +75,7 @@ bool IsLocaleValid(std::string const& locale)
return false; return false;
} }
LocaleConstant GetLocaleByName(const std::string& name) LocaleConstant GetLocaleByName(std::string const& name)
{ {
for (uint32 i = 0; i < TOTAL_LOCALES; ++i) for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
if (name == localeNames[i]) if (name == localeNames[i])
+1 -1
View File
@@ -144,7 +144,7 @@ enum LocaleConstant
AC_COMMON_API extern char const* localeNames[TOTAL_LOCALES]; AC_COMMON_API extern char const* localeNames[TOTAL_LOCALES];
AC_COMMON_API bool IsLocaleValid(std::string const& locale); AC_COMMON_API bool IsLocaleValid(std::string const& locale);
AC_COMMON_API LocaleConstant GetLocaleByName(const std::string& name); AC_COMMON_API LocaleConstant GetLocaleByName(std::string const& name);
AC_COMMON_API const std::string GetNameByLocaleConstant(LocaleConstant localeConstant); AC_COMMON_API const std::string GetNameByLocaleConstant(LocaleConstant localeConstant);
AC_COMMON_API void CleanStringForMysqlQuery(std::string& str); AC_COMMON_API void CleanStringForMysqlQuery(std::string& str);
+2 -2
View File
@@ -359,7 +359,7 @@ namespace
{ {
return ParseFile(file, isOptional, isReload); return ParseFile(file, isOptional, isReload);
} }
catch (const std::exception& e) catch (std::exception const& e)
{ {
PrintError(file, "> {}", e.what()); PrintError(file, "> {}", e.what());
} }
@@ -376,7 +376,7 @@ namespace
{ {
std::string result; std::string result;
const char* str = key.c_str(); char const* str = key.c_str();
std::size_t n = key.length(); std::size_t n = key.length();
char curr; char curr;
+1 -1
View File
@@ -307,7 +307,7 @@ char* DBCFileLoader::AutoProduceStrings(char const* format, char* dataTable)
char** slot = (char**)(&dataTable[offset]); char** slot = (char**)(&dataTable[offset]);
if (!*slot || !** slot) if (!*slot || !** slot)
{ {
const char* st = getRecord(y).getString(x); char const* st = getRecord(y).getString(x);
*slot = stringPool + (st - (char const*)stringTable); *slot = stringPool + (st - (char const*)stringTable);
} }
offset += sizeof(char*); offset += sizeof(char*);
+3 -3
View File
@@ -41,7 +41,7 @@ public:
DBCFileLoader(); DBCFileLoader();
~DBCFileLoader(); ~DBCFileLoader();
bool Load(const char* filename, const char* fmt); bool Load(char const* filename, char const* fmt);
class Record class Record
{ {
@@ -68,7 +68,7 @@ public:
return *reinterpret_cast<uint8*>(offset + file.GetOffset(field)); return *reinterpret_cast<uint8*>(offset + file.GetOffset(field));
} }
[[nodiscard]] const char* getString(std::size_t field) const [[nodiscard]] char const* getString(std::size_t field) const
{ {
ASSERT(field < file.fieldCount); ASSERT(field < file.fieldCount);
std::size_t stringOffset = getUInt(field); std::size_t stringOffset = getUInt(field);
@@ -94,7 +94,7 @@ public:
[[nodiscard]] bool IsLoaded() const { return data != nullptr; } [[nodiscard]] bool IsLoaded() const { return data != nullptr; }
char* AutoProduceData(char const* fmt, uint32& count, char**& indexTable); char* AutoProduceData(char const* fmt, uint32& count, char**& indexTable);
char* AutoProduceStrings(char const* fmt, char* dataTable); char* AutoProduceStrings(char const* fmt, char* dataTable);
static uint32 GetFormatRecordSize(const char* format, int32* index_pos = nullptr); static uint32 GetFormatRecordSize(char const* format, int32* index_pos = nullptr);
private: private:
uint32 recordSize; uint32 recordSize;
@@ -1589,7 +1589,7 @@ DWORD_PTR WheatyExceptionReport::DereferenceUnsafePointer(DWORD_PTR address)
// Helper function that writes to the report file, and allows the user to use // Helper function that writes to the report file, and allows the user to use
// printf style formating // printf style formating
//============================================================================ //============================================================================
int __cdecl WheatyExceptionReport::Log(const TCHAR* format, ...) int __cdecl WheatyExceptionReport::Log(TCHAR const* format, ...)
{ {
int retValue; int retValue;
va_list argptr; va_list argptr;
@@ -1609,7 +1609,7 @@ int __cdecl WheatyExceptionReport::Log(const TCHAR* format, ...)
return retValue; return retValue;
} }
int __cdecl WheatyExceptionReport::StackLog(const TCHAR* format, va_list argptr) int __cdecl WheatyExceptionReport::StackLog(TCHAR const* format, va_list argptr)
{ {
int retValue; int retValue;
DWORD cbWritten; DWORD cbWritten;
@@ -1621,7 +1621,7 @@ int __cdecl WheatyExceptionReport::StackLog(const TCHAR* format, va_list argptr)
return retValue; return retValue;
} }
int __cdecl WheatyExceptionReport::HeapLog(const TCHAR* format, va_list argptr) int __cdecl WheatyExceptionReport::HeapLog(TCHAR const* format, va_list argptr)
{ {
int retValue = 0; int retValue = 0;
DWORD cbWritten; DWORD cbWritten;
+3 -3
View File
@@ -169,9 +169,9 @@ private:
static BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase); static BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase);
static DWORD_PTR DereferenceUnsafePointer(DWORD_PTR address); static DWORD_PTR DereferenceUnsafePointer(DWORD_PTR address);
static int __cdecl Log(const TCHAR* format, ...); static int __cdecl Log(TCHAR const* format, ...);
static int __cdecl StackLog(const TCHAR* format, va_list argptr); static int __cdecl StackLog(TCHAR const* format, va_list argptr);
static int __cdecl HeapLog(const TCHAR* format, va_list argptr); static int __cdecl HeapLog(TCHAR const* format, va_list argptr);
static bool StoreSymbol(DWORD type, DWORD_PTR offset); static bool StoreSymbol(DWORD type, DWORD_PTR offset);
static void ClearSymbols(); static void ClearSymbols();
+2 -2
View File
@@ -136,7 +136,7 @@ public:
//} //}
ContainerMapList<OBJECT_TYPES>& GetElements() { return i_elements; } ContainerMapList<OBJECT_TYPES>& GetElements() { return i_elements; }
[[nodiscard]] const ContainerMapList<OBJECT_TYPES>& GetElements() const { return i_elements;} [[nodiscard]] ContainerMapList<OBJECT_TYPES> const& GetElements() const { return i_elements;}
private: private:
ContainerMapList<OBJECT_TYPES> i_elements; ContainerMapList<OBJECT_TYPES> i_elements;
@@ -163,7 +163,7 @@ public:
} }
ContainerVector<OBJECT_TYPES>& GetElements() { return i_elements; } ContainerVector<OBJECT_TYPES>& GetElements() { return i_elements; }
[[nodiscard]] const ContainerVector<OBJECT_TYPES>& GetElements() const { return i_elements; } [[nodiscard]] ContainerVector<OBJECT_TYPES> const& GetElements() const { return i_elements; }
private: private:
ContainerVector<OBJECT_TYPES> i_elements; ContainerVector<OBJECT_TYPES> i_elements;
+10 -10
View File
@@ -156,31 +156,31 @@ namespace Acore
/* ContainerMapList Helpers */ /* ContainerMapList Helpers */
// count functions // count functions
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
std::size_t Count(const ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* /*fake*/) std::size_t Count(ContainerMapList<SPECIFIC_TYPE> const& elements, SPECIFIC_TYPE* /*fake*/)
{ {
return elements._element.getSize(); return elements._element.getSize();
} }
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
std::size_t Count(const ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*fake*/) std::size_t Count(ContainerMapList<TypeNull> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
{ {
return 0; return 0;
} }
template<class SPECIFIC_TYPE, class T> template<class SPECIFIC_TYPE, class T>
std::size_t Count(const ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*fake*/) std::size_t Count(ContainerMapList<T> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
{ {
return 0; return 0;
} }
template<class SPECIFIC_TYPE, class T> template<class SPECIFIC_TYPE, class T>
std::size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T>>& elements, SPECIFIC_TYPE* fake) std::size_t Count(ContainerMapList<TypeList<SPECIFIC_TYPE, T>> const& elements, SPECIFIC_TYPE* fake)
{ {
return Count(elements._elements, fake); return Count(elements._elements, fake);
} }
template<class SPECIFIC_TYPE, class H, class T> template<class SPECIFIC_TYPE, class H, class T>
std::size_t Count(const ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* fake) std::size_t Count(ContainerMapList<TypeList<H, T>> const& elements, SPECIFIC_TYPE* fake)
{ {
return Count(elements._TailElements, fake); return Count(elements._TailElements, fake);
} }
@@ -243,31 +243,31 @@ namespace Acore
/* ContainerVector Helpers */ /* ContainerVector Helpers */
// count functions // count functions
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
std::size_t Count(const ContainerVector<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* /*fake*/) std::size_t Count(ContainerVector<SPECIFIC_TYPE> const& elements, SPECIFIC_TYPE* /*fake*/)
{ {
return elements._element.getSize(); return elements._element.getSize();
} }
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>
std::size_t Count(const ContainerVector<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*fake*/) std::size_t Count(ContainerVector<TypeNull> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
{ {
return 0; return 0;
} }
template<class SPECIFIC_TYPE, class T> template<class SPECIFIC_TYPE, class T>
std::size_t Count(const ContainerVector<T>& /*elements*/, SPECIFIC_TYPE* /*fake*/) std::size_t Count(ContainerVector<T> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
{ {
return 0; return 0;
} }
template<class SPECIFIC_TYPE, class T> template<class SPECIFIC_TYPE, class T>
std::size_t Count(const ContainerVector<TypeList<SPECIFIC_TYPE, T>>& elements, SPECIFIC_TYPE* fake) std::size_t Count(ContainerVector<TypeList<SPECIFIC_TYPE, T>> const& elements, SPECIFIC_TYPE* fake)
{ {
return Count(elements._elements, fake); return Count(elements._elements, fake);
} }
template<class SPECIFIC_TYPE, class H, class T> template<class SPECIFIC_TYPE, class H, class T>
std::size_t Count(const ContainerVector<TypeList<H, T>>& elements, SPECIFIC_TYPE* fake) std::size_t Count(ContainerVector<TypeList<H, T>> const& elements, SPECIFIC_TYPE* fake)
{ {
return Count(elements._TailElements, fake); return Count(elements._TailElements, fake);
} }
@@ -81,23 +81,23 @@ namespace Acore
} }
// const find functions // const find functions
template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<SPECIFIC_TYPE>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE> const& Find(ContainerMapList<SPECIFIC_TYPE> const& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{ {
typename CountedPtr<SPECIFIC_TYPE>::iterator iter = elements._element.find(hdl); typename CountedPtr<SPECIFIC_TYPE>::iterator iter = elements._element.find(hdl);
return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr) : iter->second); return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr) : iter->second);
}; };
template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeNull>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE> const& Find(ContainerMapList<TypeNull> const& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{ {
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr); return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);
} }
template<class SPECIFIC_TYPE, class T> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<T>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) template<class SPECIFIC_TYPE, class T> CountedPtr<SPECIFIC_TYPE> const& Find(ContainerMapList<T> const& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{ {
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr); return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);
} }
template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeList<H, T>>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake) template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<TypeList<H, T>> const& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake)
{ {
CountedPtr<SPECIFIC_TYPE>& t = Find(elements._elements, hdl, fake); CountedPtr<SPECIFIC_TYPE>& t = Find(elements._elements, hdl, fake);
if (!t) if (!t)
+1 -1
View File
@@ -111,7 +111,7 @@ public:
VisitorHelper(i_visitor, c); VisitorHelper(i_visitor, c);
} }
void Visit(const TYPE_CONTAINER& c) const void Visit(TYPE_CONTAINER const& c) const
{ {
VisitorHelper(i_visitor, c); VisitorHelper(i_visitor, c);
} }
+1 -1
View File
@@ -315,7 +315,7 @@ void Metric::ScheduleOverallStatusLog()
if (_enabled) if (_enabled)
{ {
_overallStatusTimer->expires_at(Acore::Asio::SteadyTimer::GetExpirationTime(_overallStatusTimerInterval)); _overallStatusTimer->expires_at(Acore::Asio::SteadyTimer::GetExpirationTime(_overallStatusTimerInterval));
_overallStatusTimer->async_wait([this](const boost::system::error_code&) _overallStatusTimer->async_wait([this](boost::system::error_code const&)
{ {
_overallStatusTimerTriggered = true; _overallStatusTimerTriggered = true;
ScheduleOverallStatusLog(); ScheduleOverallStatusLog();
+4 -4
View File
@@ -6,10 +6,10 @@
#include "DetourCommon.h" #include "DetourCommon.h"
#include "Geometry.h" #include "Geometry.h"
float dtQueryFilterExt::getCost(const float* pa, const float* pb, float dtQueryFilterExt::getCost(float const* pa, float const* pb,
const dtPolyRef /*prevRef*/, const dtMeshTile* /*prevTile*/, const dtPoly* /*prevPoly*/, const dtPolyRef /*prevRef*/, dtMeshTile const* /*prevTile*/, dtPoly const* /*prevPoly*/,
const dtPolyRef /*curRef*/, const dtMeshTile* /*curTile*/, const dtPoly* curPoly, const dtPolyRef /*curRef*/, dtMeshTile const* /*curTile*/, dtPoly const* curPoly,
const dtPolyRef /*nextRef*/, const dtMeshTile* /*nextTile*/, const dtPoly* /*nextPoly*/) const const dtPolyRef /*nextRef*/, dtMeshTile const* /*nextTile*/, dtPoly const* /*nextPoly*/) const
{ {
float startX = pa[2], startY = pa[0], startZ = pa[1]; float startX = pa[2], startY = pa[0], startZ = pa[1];
float destX = pb[2], destY = pb[0], destZ = pb[1]; float destX = pb[2], destY = pb[0], destZ = pb[1];
+4 -4
View File
@@ -10,10 +10,10 @@
class dtQueryFilterExt: public dtQueryFilter class dtQueryFilterExt: public dtQueryFilter
{ {
public: public:
float getCost(const float* pa, const float* pb, float getCost(float const* pa, float const* pb,
const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly, const dtPolyRef prevRef, dtMeshTile const* prevTile, dtPoly const* prevPoly,
const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly, const dtPolyRef curRef, dtMeshTile const* curTile, dtPoly const* curPoly,
const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const override; const dtPolyRef nextRef, dtMeshTile const* nextTile, dtPoly const* nextPoly) const override;
}; };
#endif // _ACORE_DETOUR_EXTENDED_H #endif // _ACORE_DETOUR_EXTENDED_H
+1 -1
View File
@@ -49,7 +49,7 @@ public:
* *
* @param item The item to be added to the queue. * @param item The item to be added to the queue.
*/ */
void add(const T& item) void add(T const& item)
{ {
std::lock_guard<std::mutex> lock(_lock); std::lock_guard<std::mutex> lock(_lock);
_queue.push_back(std::move(item)); _queue.push_back(std::move(item));
+1 -1
View File
@@ -36,7 +36,7 @@ private:
public: public:
ProducerConsumerQueue() = default; ProducerConsumerQueue() = default;
void Push(const T& value) void Push(T const& value)
{ {
{ {
std::lock_guard<std::mutex> lock(_queueLock); std::lock_guard<std::mutex> lock(_queueLock);
+2 -2
View File
@@ -68,8 +68,8 @@ namespace Acore
static std::thread::id currentId(); static std::thread::id currentId();
private: private:
Thread(const Thread&); Thread(Thread const&);
Thread& operator=(const Thread&); Thread& operator=(Thread const&);
static void ThreadTask(void* param); static void ThreadTask(void* param);
+8 -8
View File
@@ -41,8 +41,8 @@ namespace Acore
} }
private: private:
GeneralLock(const GeneralLock&); GeneralLock(GeneralLock const&);
GeneralLock& operator=(const GeneralLock&); GeneralLock& operator=(GeneralLock const&);
MUTEX& i_mutex; MUTEX& i_mutex;
}; };
@@ -55,11 +55,11 @@ namespace Acore
Lock() Lock()
{ {
} }
Lock(const T&) Lock(T const&)
{ {
} }
Lock(const SingleThreaded<T>&) // for single threaded we ignore this Lock(SingleThreaded<T> const&) // for single threaded we ignore this
{ {
} }
}; };
@@ -90,8 +90,8 @@ namespace Acore
private: private:
// prevent the compiler creating a copy construct // prevent the compiler creating a copy construct
ObjectLevelLockable(const ObjectLevelLockable<T, MUTEX>&); ObjectLevelLockable(ObjectLevelLockable<T, MUTEX> const&);
ObjectLevelLockable<T, MUTEX>& operator=(const ObjectLevelLockable<T, MUTEX>&); ObjectLevelLockable<T, MUTEX>& operator=(ObjectLevelLockable<T, MUTEX> const&);
MUTEX i_mtx; MUTEX i_mtx;
}; };
@@ -109,12 +109,12 @@ namespace Acore
class Lock class Lock
{ {
public: public:
Lock(const T& /*host*/) Lock(T const& /*host*/)
{ {
ClassLevelLockable<T, MUTEX>::si_mtx.lock(); ClassLevelLockable<T, MUTEX>::si_mtx.lock();
} }
Lock(const ClassLevelLockable<T, MUTEX>&) Lock(ClassLevelLockable<T, MUTEX> const&)
{ {
ClassLevelLockable<T, MUTEX>::si_mtx.lock(); ClassLevelLockable<T, MUTEX>::si_mtx.lock();
} }
+6 -6
View File
@@ -85,13 +85,13 @@ public:
Iterator() : _index(EnumUtils::Count<Enum>()) {} Iterator() : _index(EnumUtils::Count<Enum>()) {}
explicit Iterator(std::size_t index) : _index(index) { } explicit Iterator(std::size_t index) : _index(index) { }
bool operator==(const Iterator& other) const { return other._index == _index; } bool operator==(Iterator const& other) const { return other._index == _index; }
bool operator!=(const Iterator& other) const { return !operator==(other); } bool operator!=(Iterator const& other) const { return !operator==(other); }
difference_type operator-(Iterator const& other) const { return _index - other._index; } difference_type operator-(Iterator const& other) const { return _index - other._index; }
bool operator<(const Iterator& other) const { return _index < other._index; } bool operator<(Iterator const& other) const { return _index < other._index; }
bool operator<=(const Iterator& other) const { return _index <= other._index; } bool operator<=(Iterator const& other) const { return _index <= other._index; }
bool operator>(const Iterator& other) const { return _index > other._index; } bool operator>(Iterator const& other) const { return _index > other._index; }
bool operator>=(const Iterator& other) const { return _index >= other._index; } bool operator>=(Iterator const& other) const { return _index >= other._index; }
value_type operator[](difference_type d) const { return FromIndex<Enum>(_index + d); } value_type operator[](difference_type d) const { return FromIndex<Enum>(_index + d); }
value_type operator*() const { return operator[](0); } value_type operator*() const { return operator[](0); }
+2 -2
View File
@@ -19,7 +19,7 @@
#include "Define.h" #include "Define.h"
template<class Str> template<class Str>
AC_COMMON_API Str Acore::String::Trim(const Str& s, const std::locale& loc /*= std::locale()*/) AC_COMMON_API Str Acore::String::Trim(Str const& s, std::locale const& loc /*= std::locale()*/)
{ {
typename Str::const_iterator first = s.begin(); typename Str::const_iterator first = s.begin();
typename Str::const_iterator end = s.end(); typename Str::const_iterator end = s.end();
@@ -78,4 +78,4 @@ std::string Acore::String::AddSuffixIfNotExists(std::string str, const char suff
} }
// Template Trim // Template Trim
template AC_COMMON_API std::string Acore::String::Trim<std::string>(const std::string& s, const std::locale& loc /*= std::locale()*/); template AC_COMMON_API std::string Acore::String::Trim<std::string>(std::string const& s, std::locale const& loc /*= std::locale()*/);
+1 -1
View File
@@ -110,7 +110,7 @@ namespace Acore
namespace Acore::String namespace Acore::String
{ {
template<class Str> template<class Str>
AC_COMMON_API Str Trim(const Str& s, const std::locale& loc = std::locale()); AC_COMMON_API Str Trim(Str const& s, std::locale const& loc = std::locale());
AC_COMMON_API std::string TrimRightInPlace(std::string& str); AC_COMMON_API std::string TrimRightInPlace(std::string& str);
+5 -5
View File
@@ -160,7 +160,7 @@ Optional<int32> MoneyStringToMoney(std::string_view moneyString)
return money; return money;
} }
uint32 TimeStringToSecs(const std::string& timestring) uint32 TimeStringToSecs(std::string const& timestring)
{ {
uint32 secs = 0; uint32 secs = 0;
uint32 buffer = 0; uint32 buffer = 0;
@@ -291,7 +291,7 @@ bool Utf8toWStr(char const* utf8str, std::size_t csize, wchar_t* wstr, std::size
{ {
// Replace the converted string with an error message if there is enough space // Replace the converted string with an error message if there is enough space
// Otherwise just return an empty string // Otherwise just return an empty string
const wchar_t* errorMessage = L"An error occurred converting string from UTF-8 to WStr"; wchar_t const* errorMessage = L"An error occurred converting string from UTF-8 to WStr";
std::size_t errorMessageLength = std::char_traits<wchar_t>::length(errorMessage); std::size_t errorMessageLength = std::char_traits<wchar_t>::length(errorMessage);
if (wsize >= errorMessageLength) if (wsize >= errorMessageLength)
{ {
@@ -421,7 +421,7 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32_t declension)
std::size_t const thisLen = wname.length(); std::size_t const thisLen = wname.length();
std::array<std::wstring const*, 7> const& endings = dropEnds[declension]; std::array<std::wstring const*, 7> const& endings = dropEnds[declension];
for (const std::wstring* endingPtr : endings) for (std::wstring const* endingPtr : endings)
{ {
if (endingPtr == nullptr) if (endingPtr == nullptr)
{ {
@@ -498,7 +498,7 @@ bool Utf8FitTo(std::string_view str, std::wstring_view search)
return true; return true;
} }
void utf8printf(FILE* out, const char* str, ...) void utf8printf(FILE* out, char const* str, ...)
{ {
va_list ap; va_list ap;
va_start(ap, str); va_start(ap, str);
@@ -506,7 +506,7 @@ void utf8printf(FILE* out, const char* str, ...)
va_end(ap); va_end(ap);
} }
void vutf8printf(FILE* out, const char* str, va_list* ap) void vutf8printf(FILE* out, char const* str, va_list* ap)
{ {
#if AC_PLATFORM == AC_PLATFORM_WINDOWS #if AC_PLATFORM == AC_PLATFORM_WINDOWS
char temp_buf[32 * 1024]; char temp_buf[32 * 1024];
+6 -6
View File
@@ -37,7 +37,7 @@ template<typename T, class S> struct Finder
T S::* idMember_; T S::* idMember_;
Finder(T val, T S::* idMember) : val_(val), idMember_(idMember) {} Finder(T val, T S::* idMember) : val_(val), idMember_(idMember) {}
bool operator()(const std::pair<int, S>& obj) { return obj.second.*idMember_ == val_; } bool operator()(std::pair<int, S> const& obj) { return obj.second.*idMember_ == val_; }
}; };
void stripLineInvisibleChars(std::string& src); void stripLineInvisibleChars(std::string& src);
@@ -45,7 +45,7 @@ void stripLineInvisibleChars(std::string& src);
AC_COMMON_API Optional<int32> MoneyStringToMoney(std::string_view moneyString); AC_COMMON_API Optional<int32> MoneyStringToMoney(std::string_view moneyString);
std::string secsToTimeString(uint64 timeInSecs, bool shortText = false); std::string secsToTimeString(uint64 timeInSecs, bool shortText = false);
uint32 TimeStringToSecs(const std::string& timestring); uint32 TimeStringToSecs(std::string const& timestring);
// Percentage calculation // Percentage calculation
template <class T, class U> template <class T, class U>
@@ -353,13 +353,13 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension);
AC_COMMON_API bool utf8ToConsole(std::string_view utf8str, std::string& conStr); AC_COMMON_API bool utf8ToConsole(std::string_view utf8str, std::string& conStr);
AC_COMMON_API bool consoleToUtf8(std::string_view conStr, std::string& utf8str); AC_COMMON_API bool consoleToUtf8(std::string_view conStr, std::string& utf8str);
AC_COMMON_API bool Utf8FitTo(std::string_view str, std::wstring_view search); AC_COMMON_API bool Utf8FitTo(std::string_view str, std::wstring_view search);
AC_COMMON_API void utf8printf(FILE* out, const char* str, ...); AC_COMMON_API void utf8printf(FILE* out, char const* str, ...);
AC_COMMON_API void vutf8printf(FILE* out, const char* str, va_list* ap); AC_COMMON_API void vutf8printf(FILE* out, char const* str, va_list* ap);
AC_COMMON_API bool Utf8ToUpperOnlyLatin(std::string& utf8String); AC_COMMON_API bool Utf8ToUpperOnlyLatin(std::string& utf8String);
bool IsIPAddress(char const* ipaddress); bool IsIPAddress(char const* ipaddress);
uint32 CreatePIDFile(const std::string& filename); uint32 CreatePIDFile(std::string const& filename);
uint32 GetPID(); uint32 GetPID();
namespace Acore::Impl namespace Acore::Impl
@@ -506,7 +506,7 @@ public:
part[2] = right.part[2]; part[2] = right.part[2];
return *this; return *this;
} }
flag96(const flag96&) = default; flag96(flag96 const&) = default;
flag96(flag96&&) = default; flag96(flag96&&) = default;
inline flag96 operator&(flag96 const& right) const inline flag96 operator&(flag96 const& right) const
@@ -23,7 +23,7 @@
#include <chrono> #include <chrono>
#include <memory> #include <memory>
void ACSoapThread(const std::string& host, uint16 port) void ACSoapThread(std::string const& host, uint16 port)
{ {
struct soap soap; struct soap soap;
soap_init(&soap); soap_init(&soap);
+1 -1
View File
@@ -23,7 +23,7 @@
#include <memory> #include <memory>
void process_message(struct soap* soap_message); void process_message(struct soap* soap_message);
void ACSoapThread(const std::string& host, uint16 port); void ACSoapThread(std::string const& host, uint16 port);
class SOAPCommand class SOAPCommand
{ {
@@ -120,7 +120,7 @@ std::string RASession::ReadString()
return line; return line;
} }
bool RASession::CheckAccessLevel(const std::string& user) bool RASession::CheckAccessLevel(std::string const& user)
{ {
std::string safeUser = user; std::string safeUser = user;
@@ -152,7 +152,7 @@ bool RASession::CheckAccessLevel(const std::string& user)
return true; return true;
} }
bool RASession::CheckPassword(const std::string& user, const std::string& pass) bool RASession::CheckPassword(std::string const& user, std::string const& pass)
{ {
std::string safe_user = user; std::string safe_user = user;
std::transform(safe_user.begin(), safe_user.end(), safe_user.begin(), ::toupper); std::transform(safe_user.begin(), safe_user.end(), safe_user.begin(), ::toupper);
@@ -38,8 +38,8 @@ public:
private: private:
int Send(std::string_view data); int Send(std::string_view data);
std::string ReadString(); std::string ReadString();
bool CheckAccessLevel(const std::string& user); bool CheckAccessLevel(std::string const& user);
bool CheckPassword(const std::string& user, const std::string& pass); bool CheckPassword(std::string const& user, std::string const& pass);
bool ProcessCommand(std::string& command); bool ProcessCommand(std::string& command);
static void CommandPrint(void* callbackArg, std::string_view text); static void CommandPrint(void* callbackArg, std::string_view text);
@@ -399,7 +399,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
{ {
stmt = std::get<PreparedStatementBase*>(data.element); stmt = std::get<PreparedStatementBase*>(data.element);
} }
catch (const std::bad_variant_access& ex) catch (std::bad_variant_access const& ex)
{ {
LOG_FATAL("sql.sql", "> PreparedStatementBase not found in SQLElementData. {}", ex.what()); LOG_FATAL("sql.sql", "> PreparedStatementBase not found in SQLElementData. {}", ex.what());
ABORT(); ABORT();
@@ -424,7 +424,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
{ {
sql = std::get<std::string>(data.element); sql = std::get<std::string>(data.element);
} }
catch (const std::bad_variant_access& ex) catch (std::bad_variant_access const& ex)
{ {
LOG_FATAL("sql.sql", "> std::string not found in SQLElementData. {}", ex.what()); LOG_FATAL("sql.sql", "> std::string not found in SQLElementData. {}", ex.what());
ABORT(); ABORT();
@@ -453,7 +453,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
return 0; return 0;
} }
std::size_t MySQLConnection::EscapeString(char* to, const char* from, std::size_t length) std::size_t MySQLConnection::EscapeString(char* to, char const* from, std::size_t length)
{ {
return mysql_real_escape_string(m_Mysql, to, from, length); return mysql_real_escape_string(m_Mysql, to, from, length);
} }
@@ -79,7 +79,7 @@ public:
void RollbackTransaction(); void RollbackTransaction();
void CommitTransaction(); void CommitTransaction();
int ExecuteTransaction(std::shared_ptr<TransactionBase> transaction); int ExecuteTransaction(std::shared_ptr<TransactionBase> transaction);
std::size_t EscapeString(char* to, const char* from, std::size_t length); std::size_t EscapeString(char* to, char const* from, std::size_t length);
void Ping(); void Ping();
uint32 GetLastError(); uint32 GetLastError();
+1 -1
View File
@@ -39,7 +39,7 @@ struct ResultIterator
pointer operator->() { return _ptr; } pointer operator->() { return _ptr; }
ResultIterator& operator++() { if (!_ptr->NextRow()) _ptr = nullptr; return *this; } ResultIterator& operator++() { if (!_ptr->NextRow()) _ptr = nullptr; return *this; }
bool operator!=(const ResultIterator& right) { return _ptr != right._ptr; } bool operator!=(ResultIterator const& right) { return _ptr != right._ptr; }
private: private:
pointer _ptr; pointer _ptr;
+2 -2
View File
@@ -66,7 +66,7 @@ void TransactionBase::Cleanup()
delete stmt; delete stmt;
} }
catch (const std::bad_variant_access& ex) catch (std::bad_variant_access const& ex)
{ {
LOG_FATAL("sql.sql", "> PreparedStatementBase not found in SQLElementData. {}", ex.what()); LOG_FATAL("sql.sql", "> PreparedStatementBase not found in SQLElementData. {}", ex.what());
ABORT(); ABORT();
@@ -79,7 +79,7 @@ void TransactionBase::Cleanup()
{ {
std::get<std::string>(data.element).clear(); std::get<std::string>(data.element).clear();
} }
catch (const std::bad_variant_access& ex) catch (std::bad_variant_access const& ex)
{ {
LOG_FATAL("sql.sql", "> std::string not found in SQLElementData. {}", ex.what()); LOG_FATAL("sql.sql", "> std::string not found in SQLElementData. {}", ex.what());
ABORT(); ABORT();
+3 -3
View File
@@ -175,7 +175,7 @@ bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool)
{ {
LOG_WARN("sql.updates", "Database \"{}\" does not exist", pool.GetConnectionInfo()->database); LOG_WARN("sql.updates", "Database \"{}\" does not exist", pool.GetConnectionInfo()->database);
const char* disableInteractive = std::getenv("AC_DISABLE_INTERACTIVE"); char const* disableInteractive = std::getenv("AC_DISABLE_INTERACTIVE");
if (!sConfigMgr->isDryRun() && (disableInteractive == nullptr || std::strcmp(disableInteractive, "1") != 0)) if (!sConfigMgr->isDryRun() && (disableInteractive == nullptr || std::strcmp(disableInteractive, "1") != 0))
{ {
@@ -402,7 +402,7 @@ bool DBUpdater<T>::Populate(DatabaseWorkerPool<T>& pool)
std::vector<std::filesystem::path> sqlFiles; std::vector<std::filesystem::path> sqlFiles;
for (const auto &entry : std::filesystem::directory_iterator(DirPath)) for (auto const& entry : std::filesystem::directory_iterator(DirPath))
{ {
if (entry.path().extension() == ".sql") if (entry.path().extension() == ".sql")
sqlFiles.push_back(entry.path()); sqlFiles.push_back(entry.path());
@@ -410,7 +410,7 @@ bool DBUpdater<T>::Populate(DatabaseWorkerPool<T>& pool)
std::sort(sqlFiles.begin(), sqlFiles.end()); std::sort(sqlFiles.begin(), sqlFiles.end());
for (const auto &file : sqlFiles) for (auto const& file : sqlFiles)
{ {
LOG_INFO("sql.updates", ">> Applying \'{}\'...", file.filename().generic_string()); LOG_INFO("sql.updates", ">> Applying \'{}\'...", file.filename().generic_string());
+1 -1
View File
@@ -494,7 +494,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
// Check pet's attackers first to prevent dragging mobs back to owner // Check pet's attackers first to prevent dragging mobs back to owner
if (me->HasTauntAura()) if (me->HasTauntAura())
{ {
const Unit::AuraEffectList& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); Unit::AuraEffectList const& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT);
if (!tauntAuras.empty()) if (!tauntAuras.empty())
for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr)
if (Unit* caster = (*itr)->GetCaster()) if (Unit* caster = (*itr)->GetCaster())
+1 -1
View File
@@ -625,7 +625,7 @@ void CreatureAI::SetBoundary(CreatureBoundary const* boundary, bool negateBounda
me->DoImmediateBoundaryCheck(); me->DoImmediateBoundaryCheck();
} }
Creature* CreatureAI::DoSummon(uint32 entry, const Position& pos, uint32 despawnTime, TempSummonType summonType) Creature* CreatureAI::DoSummon(uint32 entry, Position const& pos, uint32 despawnTime, TempSummonType summonType)
{ {
return me->SummonCreature(entry, pos, summonType, despawnTime); return me->SummonCreature(entry, pos, summonType, despawnTime);
} }
@@ -244,7 +244,7 @@ struct ScriptedAI : public CreatureAI
* Hodir is in room until his Y position is below the Door position: * Hodir is in room until his Y position is below the Door position:
* IsInRoom(doorPosition, AXIS_Y, false); * IsInRoom(doorPosition, AXIS_Y, false);
*/ */
bool IsInRoom(const Position* pos, Axis axis, bool above) bool IsInRoom(Position const* pos, Axis axis, bool above)
{ {
if (!pos) if (!pos)
{ {
@@ -389,7 +389,7 @@ struct ScriptedAI : public CreatureAI
bool Is25ManRaid() const { return _difficulty & RAID_DIFFICULTY_MASK_25MAN; } bool Is25ManRaid() const { return _difficulty & RAID_DIFFICULTY_MASK_25MAN; }
template<class T> inline template<class T> inline
const T& DUNGEON_MODE(const T& normal5, const T& heroic10) const T const& DUNGEON_MODE(T const& normal5, T const& heroic10) const
{ {
switch (_difficulty) switch (_difficulty)
{ {
@@ -405,7 +405,7 @@ struct ScriptedAI : public CreatureAI
} }
template<class T> inline template<class T> inline
const T& RAID_MODE(const T& normal10, const T& normal25) const T const& RAID_MODE(T const& normal10, T const& normal25) const
{ {
switch (_difficulty) switch (_difficulty)
{ {
@@ -421,7 +421,7 @@ struct ScriptedAI : public CreatureAI
} }
template<class T> inline template<class T> inline
const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25) const T const& RAID_MODE(T const& normal10, T const& normal25, T const& heroic10, T const& heroic25) const
{ {
switch (_difficulty) switch (_difficulty)
{ {
@@ -257,7 +257,7 @@ void FollowerAI::MovementInform(uint32 motionType, uint32 pointId)
} }
} }
void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Quest* quest, bool inheritWalkState, bool inheritSpeed) void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, Quest const* quest, bool inheritWalkState, bool inheritSpeed)
{ {
if (me->GetVictim()) if (me->GetVictim())
{ {
@@ -55,7 +55,7 @@ public:
void UpdateAI(uint32) override; //the "internal" update, calls UpdateFollowerAI() void UpdateAI(uint32) override; //the "internal" update, calls UpdateFollowerAI()
virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc) virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc)
void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = nullptr, bool inheritWalkState = true, bool inheritSpeed = true); void StartFollow(Player* player, uint32 factionForFollower = 0, Quest const* quest = nullptr, bool inheritWalkState = true, bool inheritSpeed = true);
void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow
void SetFollowComplete(bool bWithEndEvent = false); void SetFollowComplete(bool bWithEndEvent = false);
@@ -75,7 +75,7 @@ private:
uint32 m_uiUpdateFollowTimer; uint32 m_uiUpdateFollowTimer;
uint32 m_uiFollowState; uint32 m_uiFollowState;
const Quest* m_pQuestForFollow; //normally we have a quest Quest const* m_pQuestForFollow; //normally we have a quest
}; };
#endif #endif
+2 -2
View File
@@ -1151,7 +1151,7 @@ void SmartAI::sGossipSelect(Player* player, uint32 sender, uint32 action)
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_SELECT, player, sender, action); GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_SELECT, player, sender, action);
} }
void SmartAI::sGossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) void SmartAI::sGossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/)
{ {
} }
@@ -1404,7 +1404,7 @@ bool SmartGameObjectAI::GossipSelect(Player* player, uint32 sender, uint32 actio
} }
// Called when a player selects a gossip with a code in the gameobject's gossip menu. // Called when a player selects a gossip with a code in the gameobject's gossip menu.
bool SmartGameObjectAI::GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) bool SmartGameObjectAI::GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/)
{ {
return false; return false;
} }
+2 -2
View File
@@ -190,7 +190,7 @@ public:
void sGossipHello(Player* player) override; void sGossipHello(Player* player) override;
void sGossipSelect(Player* player, uint32 sender, uint32 action) override; void sGossipSelect(Player* player, uint32 sender, uint32 action) override;
void sGossipSelectCode(Player* player, uint32 sender, uint32 action, const char* code) override; void sGossipSelectCode(Player* player, uint32 sender, uint32 action, char const* code) override;
void sQuestAccept(Player* player, Quest const* quest) override; void sQuestAccept(Player* player, Quest const* quest) override;
//void sQuestSelect(Player* player, Quest const* quest); //void sQuestSelect(Player* player, Quest const* quest);
//void sQuestComplete(Player* player, Quest const* quest); //void sQuestComplete(Player* player, Quest const* quest);
@@ -298,7 +298,7 @@ public:
bool GossipHello(Player* player, bool reportUse) override; bool GossipHello(Player* player, bool reportUse) override;
bool GossipSelect(Player* player, uint32 sender, uint32 action) override; bool GossipSelect(Player* player, uint32 sender, uint32 action) override;
bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) override; bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) override;
bool QuestAccept(Player* player, Quest const* quest) override; bool QuestAccept(Player* player, Quest const* quest) override;
bool QuestReward(Player* player, Quest const* quest, uint32 opt) override; bool QuestReward(Player* player, Quest const* quest, uint32 opt) override;
void Destroyed(Player* player, uint32 eventId) override; void Destroyed(Player* player, uint32 eventId) override;
@@ -1085,7 +1085,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
uint32 counter = 0; uint32 counter = 0;
const RewardedQuestSet& rewQuests = GetPlayer()->getRewardedQuests(); RewardedQuestSet const& rewQuests = GetPlayer()->getRewardedQuests();
for (RewardedQuestSet::const_iterator itr = rewQuests.begin(); itr != rewQuests.end(); ++itr) for (RewardedQuestSet::const_iterator itr = rewQuests.begin(); itr != rewQuests.end(); ++itr)
{ {
Quest const* quest = sObjectMgr->GetQuestTemplate(*itr); Quest const* quest = sObjectMgr->GetQuestTemplate(*itr);
@@ -2186,7 +2186,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
sScriptMgr->OnPlayerCriteriaProgress(GetPlayer(), entry); sScriptMgr->OnPlayerCriteriaProgress(GetPlayer(), entry);
} }
void AchievementMgr::RemoveCriteriaProgress(const AchievementCriteriaEntry* entry) void AchievementMgr::RemoveCriteriaProgress(AchievementCriteriaEntry const* entry)
{ {
CriteriaProgressMap::iterator criteriaProgress = _criteriaProgress.find(entry->ID); CriteriaProgressMap::iterator criteriaProgress = _criteriaProgress.find(entry->ID);
if (criteriaProgress == _criteriaProgress.end()) if (criteriaProgress == _criteriaProgress.end())
@@ -2974,7 +2974,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint16 achievementId = fields[0].Get<uint16>(); uint16 achievementId = fields[0].Get<uint16>();
const AchievementEntry* achievement = sAchievementStore.LookupEntry(achievementId); AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementId);
if (!achievement) if (!achievement)
{ {
// Remove non existent achievements from all characters // Remove non existent achievements from all characters
+1 -1
View File
@@ -104,7 +104,7 @@ namespace AddonMgr
m_knownAddons.emplace_back(addon.Name, addon.CRC); m_knownAddons.emplace_back(addon.Name, addon.CRC);
} }
SavedAddon const* GetAddonInfo(const std::string& name) SavedAddon const* GetAddonInfo(std::string const& name)
{ {
for (auto const& addon : m_knownAddons) for (auto const& addon : m_knownAddons)
{ {
+1 -1
View File
@@ -60,7 +60,7 @@ namespace AddonMgr
{ {
void LoadFromDB(); void LoadFromDB();
void SaveAddon(AddonInfo const& addon); void SaveAddon(AddonInfo const& addon);
SavedAddon const* GetAddonInfo(const std::string& name); SavedAddon const* GetAddonInfo(std::string const& name);
typedef std::list<BannedAddon> BannedAddonList; typedef std::list<BannedAddon> BannedAddonList;
BannedAddonList const* GetBannedAddons(); BannedAddonList const* GetBannedAddons();
@@ -113,7 +113,7 @@ bool ArenaSpectator::HandleSpectatorSpectateCommand(ChatHandler* handler, std::s
if (!player->m_Controlled.empty()) if (!player->m_Controlled.empty())
errors.push_back("Can't be controlling creatures."); errors.push_back("Can't be controlling creatures.");
const Unit::VisibleAuraMap* va = player->GetVisibleAuras(); Unit::VisibleAuraMap const* va = player->GetVisibleAuras();
for (auto itr = va->begin(); itr != va->end(); ++itr) for (auto itr = va->begin(); itr != va->end(); ++itr)
if (Aura* aura = itr->second->GetBase()) if (Aura* aura = itr->second->GetBase())
if (!itr->second->IsPositive() && !aura->IsPermanent() && aura->GetDuration() < HOUR * IN_MILLISECONDS) if (!itr->second->IsPositive() && !aura->IsPermanent() && aura->GetDuration() < HOUR * IN_MILLISECONDS)
@@ -310,7 +310,7 @@ AC_GAME_API void ArenaSpectator::SendPacketTo(Player const* player, std::string&
} }
template<> template<>
AC_GAME_API void ArenaSpectator::SendPacketTo(const Map* map, std::string&& message) AC_GAME_API void ArenaSpectator::SendPacketTo(Map const* map, std::string&& message)
{ {
if (!map->IsBattleArena()) if (!map->IsBattleArena())
return; return;
@@ -41,7 +41,7 @@ class WorldPacket;
namespace ArenaSpectator namespace ArenaSpectator
{ {
template<class T> template<class T>
AC_GAME_API void SendPacketTo(const T* object, std::string&& message); AC_GAME_API void SendPacketTo(T const* object, std::string&& message);
template<class T, typename Format, typename... Args> template<class T, typename Format, typename... Args>
inline void SendCommand(T* o, Format&& fmt, Args&& ... args) inline void SendCommand(T* o, Format&& fmt, Args&& ... args)
@@ -50,7 +50,7 @@ namespace ArenaSpectator
} }
template<class T> template<class T>
inline void SendCommand_String(T* o, ObjectGuid targetGUID, const char* prefix, const char* c) inline void SendCommand_String(T* o, ObjectGuid targetGUID, char const* prefix, char const* c)
{ {
if (!targetGUID.IsPlayer()) if (!targetGUID.IsPlayer())
return; return;
@@ -59,7 +59,7 @@ namespace ArenaSpectator
} }
template<class T> template<class T>
inline void SendCommand_UInt32Value(T* o, ObjectGuid targetGUID, const char* prefix, uint32 t) inline void SendCommand_UInt32Value(T* o, ObjectGuid targetGUID, char const* prefix, uint32 t)
{ {
if (!targetGUID.IsPlayer()) if (!targetGUID.IsPlayer())
return; return;
@@ -68,7 +68,7 @@ namespace ArenaSpectator
} }
template<class T> template<class T>
inline void SendCommand_GUID(T* o, ObjectGuid targetGUID, const char* prefix, ObjectGuid t) inline void SendCommand_GUID(T* o, ObjectGuid targetGUID, char const* prefix, ObjectGuid t)
{ {
if (!targetGUID.IsPlayer()) if (!targetGUID.IsPlayer())
return; return;
@@ -77,7 +77,7 @@ namespace ArenaSpectator
} }
template<class T> template<class T>
inline void SendCommand_Spell(T* o, ObjectGuid targetGUID, const char* prefix, uint32 id, int32 casttime) inline void SendCommand_Spell(T* o, ObjectGuid targetGUID, char const* prefix, uint32 id, int32 casttime)
{ {
if (!targetGUID.IsPlayer()) if (!targetGUID.IsPlayer())
return; return;
@@ -86,7 +86,7 @@ namespace ArenaSpectator
} }
template<class T> template<class T>
inline void SendCommand_Cooldown(T* o, ObjectGuid targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur) inline void SendCommand_Cooldown(T* o, ObjectGuid targetGUID, char const* prefix, uint32 id, uint32 dur, uint32 maxdur)
{ {
if (!targetGUID.IsPlayer()) if (!targetGUID.IsPlayer())
return; return;
@@ -99,7 +99,7 @@ namespace ArenaSpectator
} }
template<class T> template<class T>
inline void SendCommand_Aura(T* o, ObjectGuid targetGUID, const char* prefix, ObjectGuid caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove) inline void SendCommand_Aura(T* o, ObjectGuid targetGUID, char const* prefix, ObjectGuid caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove)
{ {
if (!targetGUID.IsPlayer()) if (!targetGUID.IsPlayer())
return; return;
@@ -52,7 +52,7 @@ struct ArenaSeasonReward
ArenaSeasonRewardType type{ARENA_SEASON_REWARD_TYPE_ITEM}; ArenaSeasonRewardType type{ARENA_SEASON_REWARD_TYPE_ITEM};
// Used in unit tests. // Used in unit tests.
bool operator==(const ArenaSeasonReward& other) const bool operator==(ArenaSeasonReward const& other) const
{ {
return entry == other.entry && type == other.type; return entry == other.entry && type == other.type;
} }
@@ -78,7 +78,7 @@ struct ArenaSeasonRewardGroup
std::vector<ArenaSeasonReward> achievementRewards; std::vector<ArenaSeasonReward> achievementRewards;
// Used in unit tests. // Used in unit tests.
bool operator==(const ArenaSeasonRewardGroup& other) const bool operator==(ArenaSeasonRewardGroup const& other) const
{ {
return minCriteria == other.minCriteria && return minCriteria == other.minCriteria &&
maxCriteria == other.maxCriteria && maxCriteria == other.maxCriteria &&
@@ -24,7 +24,7 @@
constexpr float minPctTeamGamesForMemberToGetReward = 30; constexpr float minPctTeamGamesForMemberToGetReward = 30;
void ArenaSeasonTeamRewarderImpl::RewardTeamWithRewardGroup(ArenaTeam *arenaTeam, const ArenaSeasonRewardGroup &rewardGroup) void ArenaSeasonTeamRewarderImpl::RewardTeamWithRewardGroup(ArenaTeam *arenaTeam, ArenaSeasonRewardGroup const& rewardGroup)
{ {
RewardWithMail(arenaTeam, rewardGroup); RewardWithMail(arenaTeam, rewardGroup);
RewardWithAchievements(arenaTeam, rewardGroup); RewardWithAchievements(arenaTeam, rewardGroup);
+4 -4
View File
@@ -778,7 +778,7 @@ int32 ArenaTeam::GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won
return (int32)ceil(mod); return (int32)ceil(mod);
} }
void ArenaTeam::FinishGame(int32 mod, const Map* bgMap) void ArenaTeam::FinishGame(int32 mod, Map const* bgMap)
{ {
// Rating can only drop to 0 // Rating can only drop to 0
if (int32(Stats.Rating) + mod < 0) if (int32(Stats.Rating) + mod < 0)
@@ -808,7 +808,7 @@ void ArenaTeam::FinishGame(int32 mod, const Map* bgMap)
} }
} }
int32 ArenaTeam::WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap) int32 ArenaTeam::WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, Map const* bgMap)
{ {
// Called when the team has won // Called when the team has won
// Change in Matchmaker rating // Change in Matchmaker rating
@@ -828,7 +828,7 @@ int32 ArenaTeam::WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32
return mod; return mod;
} }
int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap) int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, Map const* bgMap)
{ {
// Called when the team has lost // Called when the team has lost
// Change in Matchmaker Rating // Change in Matchmaker Rating
@@ -1013,7 +1013,7 @@ bool ArenaTeam::IsFighting() const
return false; return false;
} }
ArenaTeamMember* ArenaTeam::GetMember(const std::string& name) ArenaTeamMember* ArenaTeam::GetMember(std::string const& name)
{ {
return GetMember(sCharacterCache->GetCharacterGuidByName(name)); return GetMember(sCharacterCache->GetCharacterGuidByName(name));
} }
+4 -4
View File
@@ -152,7 +152,7 @@ public:
static uint8 GetReqPlayersForType(uint32 type); static uint8 GetReqPlayersForType(uint32 type);
[[nodiscard]] ObjectGuid GetCaptain() const { return CaptainGuid; } [[nodiscard]] ObjectGuid GetCaptain() const { return CaptainGuid; }
[[nodiscard]] std::string const& GetName() const { return TeamName; } [[nodiscard]] std::string const& GetName() const { return TeamName; }
[[nodiscard]] const ArenaTeamStats& GetStats() const { return Stats; } [[nodiscard]] ArenaTeamStats const& GetStats() const { return Stats; }
void SetArenaTeamStats(ArenaTeamStats& stats) { Stats = stats; } void SetArenaTeamStats(ArenaTeamStats& stats) { Stats = stats; }
[[nodiscard]] uint32 GetRating() const { return Stats.Rating; } [[nodiscard]] uint32 GetRating() const { return Stats.Rating; }
@@ -198,15 +198,15 @@ public:
int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won); int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won); int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
float GetChanceAgainst(uint32 ownRating, uint32 opponentRating); float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap); int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, Map const* bgMap);
void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange); void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, const Map* bgMap); int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change, Map const* bgMap);
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12); void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void UpdateArenaPointsHelper(std::map<ObjectGuid, uint32>& PlayerPoints); void UpdateArenaPointsHelper(std::map<ObjectGuid, uint32>& PlayerPoints);
bool FinishWeek(); // returns true if arena team played this week bool FinishWeek(); // returns true if arena team played this week
void FinishGame(int32 mod, const Map* bgMap); void FinishGame(int32 mod, Map const* bgMap);
void SetPreviousOpponents(uint32 arenaTeamId) { PreviousOpponents = arenaTeamId; } void SetPreviousOpponents(uint32 arenaTeamId) { PreviousOpponents = arenaTeamId; }
uint32 GetPreviousOpponents() { return PreviousOpponents; } uint32 GetPreviousOpponents() { return PreviousOpponents; }
@@ -55,7 +55,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamById(uint32 arenaTeamId) const
return nullptr; return nullptr;
} }
ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(const std::string& arenaTeamName) const ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(std::string const& arenaTeamName) const
{ {
std::string search = arenaTeamName; std::string search = arenaTeamName;
std::transform(search.begin(), search.end(), search.begin(), ::toupper); std::transform(search.begin(), search.end(), search.begin(), ::toupper);
+13 -13
View File
@@ -404,7 +404,7 @@ public:
void AddSpectator(Player* p) { m_Spectators.insert(p); } void AddSpectator(Player* p) { m_Spectators.insert(p); }
void RemoveSpectator(Player* p) { m_Spectators.erase(p); } void RemoveSpectator(Player* p) { m_Spectators.erase(p); }
bool HaveSpectators() { return !m_Spectators.empty(); } bool HaveSpectators() { return !m_Spectators.empty(); }
[[nodiscard]] const SpectatorList& GetSpectators() const { return m_Spectators; } [[nodiscard]] SpectatorList const& GetSpectators() const { return m_Spectators; }
void AddToBeTeleported(ObjectGuid spectator, ObjectGuid participant) { m_ToBeTeleported[spectator] = participant; } void AddToBeTeleported(ObjectGuid spectator, ObjectGuid participant) { m_ToBeTeleported[spectator] = participant; }
void RemoveToBeTeleported(ObjectGuid spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); } void RemoveToBeTeleported(ObjectGuid spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
void SpectatorsSendPacket(WorldPacket& data); void SpectatorsSendPacket(WorldPacket& data);
@@ -456,7 +456,7 @@ public:
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { } virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { }
void SendPacketToTeam(TeamId teamId, WorldPacket const* packet, Player* sender = nullptr, bool self = true); void SendPacketToTeam(TeamId teamId, WorldPacket const* packet, Player* sender = nullptr, bool self = true);
void SendPacketToAll(WorldPacket const* packet); void SendPacketToAll(WorldPacket const* packet);
void YellToAll(Creature* creature, const char* text, uint32 language); void YellToAll(Creature* creature, char const* text, uint32 language);
void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = nullptr); void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = nullptr);
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target = nullptr); void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target = nullptr);
@@ -576,37 +576,37 @@ public:
[[nodiscard]] uint8 GetUniqueBracketId() const; [[nodiscard]] uint8 GetUniqueBracketId() const;
BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return nullptr; } BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return nullptr; }
[[nodiscard]] BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return nullptr; } [[nodiscard]] BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV const*>(this); else return nullptr; }
BattlegroundWS* ToBattlegroundWS() { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return nullptr; } BattlegroundWS* ToBattlegroundWS() { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return nullptr; }
[[nodiscard]] BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return nullptr; } [[nodiscard]] BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS const*>(this); else return nullptr; }
BattlegroundAB* ToBattlegroundAB() { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return nullptr; } BattlegroundAB* ToBattlegroundAB() { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return nullptr; }
[[nodiscard]] BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return nullptr; } [[nodiscard]] BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB const*>(this); else return nullptr; }
BattlegroundNA* ToBattlegroundNA() { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return nullptr; } BattlegroundNA* ToBattlegroundNA() { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return nullptr; }
[[nodiscard]] BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return nullptr; } [[nodiscard]] BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA const*>(this); else return nullptr; }
BattlegroundBE* ToBattlegroundBE() { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return nullptr; } BattlegroundBE* ToBattlegroundBE() { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return nullptr; }
[[nodiscard]] BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return nullptr; } [[nodiscard]] BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE const*>(this); else return nullptr; }
BattlegroundEY* ToBattlegroundEY() { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return nullptr; } BattlegroundEY* ToBattlegroundEY() { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return nullptr; }
[[nodiscard]] BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return nullptr; } [[nodiscard]] BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY const*>(this); else return nullptr; }
BattlegroundRL* ToBattlegroundRL() { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return nullptr; } BattlegroundRL* ToBattlegroundRL() { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return nullptr; }
[[nodiscard]] BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return nullptr; } [[nodiscard]] BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL const*>(this); else return nullptr; }
BattlegroundSA* ToBattlegroundSA() { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return nullptr; } BattlegroundSA* ToBattlegroundSA() { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return nullptr; }
[[nodiscard]] BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return nullptr; } [[nodiscard]] BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA const*>(this); else return nullptr; }
BattlegroundDS* ToBattlegroundDS() { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return nullptr; } BattlegroundDS* ToBattlegroundDS() { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return nullptr; }
[[nodiscard]] BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return nullptr; } [[nodiscard]] BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS const*>(this); else return nullptr; }
BattlegroundRV* ToBattlegroundRV() { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return nullptr; } BattlegroundRV* ToBattlegroundRV() { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return nullptr; }
[[nodiscard]] BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return nullptr; } [[nodiscard]] BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV const*>(this); else return nullptr; }
BattlegroundIC* ToBattlegroundIC() { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return nullptr; } BattlegroundIC* ToBattlegroundIC() { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return nullptr; }
[[nodiscard]] BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return nullptr; } [[nodiscard]] BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC const*>(this); else return nullptr; }
protected: protected:
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground // this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
@@ -343,7 +343,7 @@ std::vector<Battleground const*> BattlegroundMgr::GetActiveBattlegrounds()
for (auto const& [bgType, bgData] : bgDataStore) for (auto const& [bgType, bgData] : bgDataStore)
for (auto const& [id, bg] : bgData._Battlegrounds) for (auto const& [id, bg] : bgData._Battlegrounds)
if (bg->GetStatus() == STATUS_WAIT_JOIN || bg->GetStatus() == STATUS_IN_PROGRESS) if (bg->GetStatus() == STATUS_WAIT_JOIN || bg->GetStatus() == STATUS_IN_PROGRESS)
result.push_back(static_cast<const Battleground*>(bg)); result.push_back(static_cast<Battleground const*>(bg));
return result; return result;
} }
@@ -135,7 +135,7 @@ void BattlegroundEY::UpdatePointsState()
_capturePointInfo[point]._playersCount[TEAM_HORDE] = 0; _capturePointInfo[point]._playersCount[TEAM_HORDE] = 0;
} }
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers(); BattlegroundPlayerMap const& bgPlayerMap = GetPlayers();
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr) for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
{ {
itr->second->SendUpdateWorldState(WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW); itr->second->SendUpdateWorldState(WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW);
+3 -3
View File
@@ -171,7 +171,7 @@ public:
void SetStatusTime(time_t statusTime) { _statusTime = statusTime; } void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
time_t GetStatusTime() const { return _statusTime; } time_t GetStatusTime() const { return _statusTime; }
void SetText(const std::string& text) { _text = text; } void SetText(std::string const& text) { _text = text; }
std::string GetText() const { return _text; } std::string GetText() const { return _text; }
void SetStatus(CalendarInviteStatus status) { _status = status; } void SetStatus(CalendarInviteStatus status) { _status = status; }
@@ -228,10 +228,10 @@ public:
void SetGuildId(uint32 guildId) { _guildId = guildId; } void SetGuildId(uint32 guildId) { _guildId = guildId; }
uint32 GetGuildId() const { return _guildId; } uint32 GetGuildId() const { return _guildId; }
void SetTitle(const std::string& title) { _title = title; } void SetTitle(std::string const& title) { _title = title; }
std::string GetTitle() const { return _title; } std::string GetTitle() const { return _title; }
void SetDescription(const std::string& description) { _description = description; } void SetDescription(std::string const& description) { _description = description; }
std::string GetDescription() const { return _description; } std::string GetDescription() const { return _description; }
void SetType(CalendarEventType type) { _type = type; } void SetType(CalendarEventType type) { _type = type; }
+3 -3
View File
@@ -1083,7 +1083,7 @@ void Channel::MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid g
*data << good; *data << good;
} }
void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string& name) void Channel::MakePlayerNotBanned(WorldPacket* data, std::string const& name)
{ {
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE); MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
*data << name; *data << name;
@@ -1121,13 +1121,13 @@ void Channel::MakeNotModerated(WorldPacket* data)
MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE); MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE);
} }
void Channel::MakePlayerInvited(WorldPacket* data, const std::string& name) void Channel::MakePlayerInvited(WorldPacket* data, std::string const& name)
{ {
MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE); MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE);
*data << name; *data << name;
} }
void Channel::MakePlayerInviteBanned(WorldPacket* data, const std::string& name) void Channel::MakePlayerInviteBanned(WorldPacket* data, std::string const& name)
{ {
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE); MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
*data << name; *data << name;
+1 -1
View File
@@ -119,7 +119,7 @@ class ChannelRights
{ {
public: public:
ChannelRights() = default; ChannelRights() = default;
ChannelRights(const uint32& f, const uint32& d, std::string jm, std::string sm, std::set<uint32> ml) : flags(f), speakDelay(d), joinMessage(std::move(jm)), speakMessage(std::move(sm)), moderators(std::move(ml)) {} ChannelRights(uint32 const& f, uint32 const& d, std::string jm, std::string sm, std::set<uint32> ml) : flags(f), speakDelay(d), joinMessage(std::move(jm)), speakMessage(std::move(sm)), moderators(std::move(ml)) {}
uint32 flags{0}; uint32 flags{0};
uint32 speakDelay{0}; uint32 speakDelay{0};
std::string joinMessage; std::string joinMessage;
+2 -2
View File
@@ -205,7 +205,7 @@ void ChannelMgr::LoadChannelRights()
LOG_INFO("server.loading", " "); LOG_INFO("server.loading", " ");
} }
const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name) ChannelRights const& ChannelMgr::GetChannelRightsFor(std::string const& name)
{ {
std::string nameStr = name; std::string nameStr = name;
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
@@ -215,7 +215,7 @@ const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name)
return channelRightsEmpty; return channelRightsEmpty;
} }
void ChannelMgr::SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set<uint32>& moderators) void ChannelMgr::SetChannelRightsFor(std::string const& name, uint32 const& flags, uint32 const& speakDelay, std::string const& joinmessage, std::string const& speakmessage, std::set<uint32> const& moderators)
{ {
std::string nameStr = name; std::string nameStr = name;
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
+2 -2
View File
@@ -43,8 +43,8 @@ public:
static void LoadChannels(); static void LoadChannels();
static void LoadChannelRights(); static void LoadChannelRights();
static const ChannelRights& GetChannelRightsFor(const std::string& name); static ChannelRights const& GetChannelRightsFor(std::string const& name);
static void SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set<uint32>& moderators); static void SetChannelRightsFor(std::string const& name, uint32 const& flags, uint32 const& speakDelay, std::string const& joinmessage, std::string const& speakmessage, std::set<uint32> const& moderators);
static uint32 _channelIdMax; static uint32 _channelIdMax;
private: private:
+3 -3
View File
@@ -191,7 +191,7 @@ void ChatHandler::SendSysMessage(std::string_view str, bool escapeCharacters)
} }
} }
void ChatHandler::SendGlobalSysMessage(const char* str) void ChatHandler::SendGlobalSysMessage(char const* str)
{ {
WorldPacket data; WorldPacket data;
for (std::string_view line : Acore::Tokenize(str, '\n', true)) for (std::string_view line : Acore::Tokenize(str, '\n', true))
@@ -201,7 +201,7 @@ void ChatHandler::SendGlobalSysMessage(const char* str)
} }
} }
void ChatHandler::SendGlobalGMSysMessage(const char* str) void ChatHandler::SendGlobalGMSysMessage(char const* str)
{ {
WorldPacket data; WorldPacket data;
for (std::string_view line : Acore::Tokenize(str, '\n', true)) for (std::string_view line : Acore::Tokenize(str, '\n', true))
@@ -928,7 +928,7 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
return true; return true;
} }
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline) bool ChatHandler::GetPlayerGroupAndGUIDByName(char const* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline)
{ {
player = nullptr; player = nullptr;
guid = ObjectGuid::Empty; guid = ObjectGuid::Empty;
+3 -3
View File
@@ -191,7 +191,7 @@ public:
bool _ParseCommands(std::string_view text); bool _ParseCommands(std::string_view text);
virtual bool ParseCommands(std::string_view text); virtual bool ParseCommands(std::string_view text);
void SendGlobalSysMessage(const char* str); void SendGlobalSysMessage(char const* str);
// function with different implementation for chat/console // function with different implementation for chat/console
virtual bool IsHumanReadable() const { return true; } virtual bool IsHumanReadable() const { return true; }
@@ -203,7 +203,7 @@ public:
bool HasLowerSecurity(Player* target, ObjectGuid guid = ObjectGuid::Empty, bool strong = false); bool HasLowerSecurity(Player* target, ObjectGuid guid = ObjectGuid::Empty, bool strong = false);
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false); bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
void SendGlobalGMSysMessage(const char* str); void SendGlobalGMSysMessage(char const* str);
Player* getSelectedPlayer() const; Player* getSelectedPlayer() const;
Creature* getSelectedCreature() const; Creature* getSelectedCreature() const;
Unit* getSelectedUnit() const; Unit* getSelectedUnit() const;
@@ -223,7 +223,7 @@ public:
uint32 extractSpellIdFromLink(char* text); uint32 extractSpellIdFromLink(char* text);
ObjectGuid::LowType extractLowGuidFromLink(char* text, HighGuid& guidHigh); ObjectGuid::LowType extractLowGuidFromLink(char* text, HighGuid& guidHigh);
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false); bool GetPlayerGroupAndGUIDByName(char const* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false);
std::string extractPlayerNameFromLink(char* text); std::string extractPlayerNameFromLink(char* text);
// select by arg (name/link) or in-game selection online/offline player // select by arg (name/link) or in-game selection online/offline player
bool extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid = nullptr, std::string* player_name = nullptr); bool extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid = nullptr, std::string* player_name = nullptr);
+4 -4
View File
@@ -217,7 +217,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself()) if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself())
{ {
// Xinef: cannot be null, checked at loading // Xinef: cannot be null, checked at loading
const Quest* quest = sObjectMgr->GetQuestTemplate(ConditionValue1); Quest const* quest = sObjectMgr->GetQuestTemplate(ConditionValue1);
condMeets = !player->IsQuestRewarded(ConditionValue1) && player->SatisfyQuestExclusiveGroup(quest, false); condMeets = !player->IsQuestRewarded(ConditionValue1) && player->SatisfyQuestExclusiveGroup(quest, false);
} }
} }
@@ -1083,7 +1083,7 @@ ConditionList ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, ui
return cond; return cond;
} }
ConditionList ConditionMgr::GetConditionsForObjectVisibility(const WorldObject* object) const ConditionList ConditionMgr::GetConditionsForObjectVisibility(WorldObject const* object) const
{ {
ConditionList cond; ConditionList cond;
@@ -1199,7 +1199,7 @@ void ConditionMgr::LoadConditions(bool isReload)
} }
cond->ReferenceId = uint32(std::abs(iConditionTypeOrReference)); cond->ReferenceId = uint32(std::abs(iConditionTypeOrReference));
const char* rowType = "reference template"; char const* rowType = "reference template";
if (iSourceTypeOrReferenceId >= 0) if (iSourceTypeOrReferenceId >= 0)
rowType = "reference"; rowType = "reference";
// check for useless data // check for useless data
@@ -2546,7 +2546,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
} }
case CONDITION_QUEST_OBJECTIVE_PROGRESS: case CONDITION_QUEST_OBJECTIVE_PROGRESS:
{ {
const Quest* quest = sObjectMgr->GetQuestTemplate(cond->ConditionValue1); Quest const* quest = sObjectMgr->GetQuestTemplate(cond->ConditionValue1);
if (!quest) if (!quest)
{ {
LOG_ERROR("sql.sql", "CONDITION_QUEST_OBJECTIVE_PROGRESS points to non-existing quest ({}), skipped.", cond->ConditionValue1); LOG_ERROR("sql.sql", "CONDITION_QUEST_OBJECTIVE_PROGRESS points to non-existing quest ({}), skipped.", cond->ConditionValue1);
+1 -1
View File
@@ -271,7 +271,7 @@ public:
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType); ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId); ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId); ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
ConditionList GetConditionsForObjectVisibility(const WorldObject* object) const; ConditionList GetConditionsForObjectVisibility(WorldObject const* object) const;
private: private:
bool isSourceTypeValid(Condition* cond); bool isSourceTypeValid(Condition* cond);
+3 -3
View File
@@ -201,7 +201,7 @@ typedef std::list<std::string> StoreProblemList;
uint32 DBCFileCount = 0; uint32 DBCFileCount = 0;
static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename) static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, std::string const& filename)
{ {
LOG_ERROR("dbc", "Size of '{}' set by format string ({}) not equal size of C++ structure ({}).", filename, fsize, rsize); LOG_ERROR("dbc", "Size of '{}' set by format string ({}) not equal size of C++ structure ({}).", filename, fsize, rsize);
@@ -258,7 +258,7 @@ inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCSt
} }
} }
void LoadDBCStores(const std::string& dataPath) void LoadDBCStores(std::string const& dataPath)
{ {
uint32 oldMSTime = getMSTime(); uint32 oldMSTime = getMSTime();
@@ -913,7 +913,7 @@ SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, u
return nullptr; return nullptr;
} }
const std::vector<SkillLineAbilityEntry const*>& GetSkillLineAbilitiesBySkillLine(uint32 skillLine) std::vector<SkillLineAbilityEntry const*> const& GetSkillLineAbilitiesBySkillLine(uint32 skillLine)
{ {
auto it = sSkillLineAbilityIndexBySkillLine.find(skillLine); auto it = sSkillLineAbilityIndexBySkillLine.find(skillLine);
if (it == sSkillLineAbilityIndexBySkillLine.end()) if (it == sSkillLineAbilityIndexBySkillLine.end())
+2 -2
View File
@@ -73,7 +73,7 @@ typedef std::pair<SkillRaceClassInfoMap::iterator, SkillRaceClassInfoMap::iterat
SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_); SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_);
typedef std::unordered_map<uint32 /* SkillLine */, std::vector<SkillLineAbilityEntry const*> > SkillLineAbilityIndexBySkillLine; typedef std::unordered_map<uint32 /* SkillLine */, std::vector<SkillLineAbilityEntry const*> > SkillLineAbilityIndexBySkillLine;
const std::vector<SkillLineAbilityEntry const*>& GetSkillLineAbilitiesBySkillLine(uint32 skillLine); std::vector<SkillLineAbilityEntry const*> const& GetSkillLineAbilitiesBySkillLine(uint32 skillLine);
extern DBCStorage <AchievementEntry> sAchievementStore; extern DBCStorage <AchievementEntry> sAchievementStore;
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore; extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
@@ -194,6 +194,6 @@ extern DBCStorage <WMOAreaTableEntry> sWMOAreaTableStore;
//extern DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates //extern DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates
extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore; extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore;
void LoadDBCStores(const std::string& dataPath); void LoadDBCStores(std::string const& dataPath);
#endif #endif
+7 -7
View File
@@ -182,7 +182,7 @@ namespace lfg
return 0; return 0;
} }
void insert(const ObjectGuid& g) void insert(ObjectGuid const& g)
{ {
// avoid loops for performance // avoid loops for performance
if (!guids[0]) if (!guids[0])
@@ -273,7 +273,7 @@ namespace lfg
guids[4] = g; guids[4] = g;
} }
void force_insert_front(const ObjectGuid& g) void force_insert_front(ObjectGuid const& g)
{ {
if (guids[3]) if (guids[3])
{ {
@@ -294,7 +294,7 @@ namespace lfg
guids[0] = g; guids[0] = g;
} }
void remove(const ObjectGuid& g) void remove(ObjectGuid const& g)
{ {
// avoid loops for performance // avoid loops for performance
if (guids[0] == g) if (guids[0] == g)
@@ -427,12 +427,12 @@ namespace lfg
} }
} }
[[nodiscard]] bool hasGuid(const ObjectGuid& g) const [[nodiscard]] bool hasGuid(ObjectGuid const& g) const
{ {
return g && (guids[0] == g || guids[1] == g || guids[2] == g || guids[3] == g || guids[4] == g); return g && (guids[0] == g || guids[1] == g || guids[2] == g || guids[3] == g || guids[4] == g);
} }
bool operator<(const Lfg5Guids& x) const bool operator<(Lfg5Guids const& x) const
{ {
if (guids[0] <= x.guids[0]) if (guids[0] <= x.guids[0])
{ {
@@ -474,12 +474,12 @@ namespace lfg
return false; return false;
} }
bool operator==(const Lfg5Guids& x) const bool operator==(Lfg5Guids const& x) const
{ {
return guids[0] == x.guids[0] && guids[1] == x.guids[1] && guids[2] == x.guids[2] && guids[3] == x.guids[3] && guids[4] == x.guids[4]; return guids[0] == x.guids[0] && guids[1] == x.guids[1] && guids[2] == x.guids[2] && guids[3] == x.guids[3] && guids[4] == x.guids[4];
} }
void operator=(const Lfg5Guids& x) void operator=(Lfg5Guids const& x)
{ {
guids = x.guids; guids = x.guids;
delete roles; delete roles;
+13 -13
View File
@@ -513,7 +513,7 @@ namespace lfg
else if (ar) else if (ar)
{ {
// Check required items // Check required items
for (const ProgressionRequirement* itemRequirement : ar->items) for (ProgressionRequirement const* itemRequirement : ar->items)
{ {
if (!itemRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) if (!itemRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{ {
@@ -529,7 +529,7 @@ namespace lfg
} }
//Check for quests //Check for quests
for (const ProgressionRequirement* questRequirement : ar->quests) for (ProgressionRequirement const* questRequirement : ar->quests)
{ {
if (!questRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) if (!questRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{ {
@@ -551,7 +551,7 @@ namespace lfg
} }
//Check if player has the required achievements //Check if player has the required achievements
for (const ProgressionRequirement* achievementRequirement : ar->achievements) for (ProgressionRequirement const* achievementRequirement : ar->achievements)
{ {
if (!achievementRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) if (!achievementRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{ {
@@ -595,7 +595,7 @@ namespace lfg
@param[in] dungeons Dungeons the player/group is applying for @param[in] dungeons Dungeons the player/group is applying for
@param[in] comment Player selected comment @param[in] comment Player selected comment
*/ */
void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const std::string& comment) void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment)
{ {
if (!player || dungeons.empty()) if (!player || dungeons.empty())
return; return;
@@ -919,7 +919,7 @@ namespace lfg
queue.RemoveFromQueue(gguid); queue.RemoveFromQueue(gguid);
uint32 dungeonId = GetDungeon(gguid); uint32 dungeonId = GetDungeon(gguid);
SetState(gguid, LFG_STATE_NONE); SetState(gguid, LFG_STATE_NONE);
const LfgGuidSet& players = GetPlayers(gguid); LfgGuidSet const& players = GetPlayers(gguid);
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{ {
SetState(*it, LFG_STATE_NONE); SetState(*it, LFG_STATE_NONE);
@@ -1318,7 +1318,7 @@ namespace lfg
} }
} }
void LFGMgr::RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer) void LFGMgr::RBPacketAppendGroup(RBInternalInfo const& info, ByteBuffer& buffer)
{ {
buffer << info.groupGuid; buffer << info.groupGuid;
uint32 flags = LFG_UPDATE_FLAG_COMMENT | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_BINDED; uint32 flags = LFG_UPDATE_FLAG_COMMENT | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_BINDED;
@@ -1334,7 +1334,7 @@ namespace lfg
buffer << (uint32)info.encounterMask; buffer << (uint32)info.encounterMask;
} }
void LFGMgr::RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer) void LFGMgr::RBPacketAppendPlayer(RBInternalInfo const& info, ByteBuffer& buffer)
{ {
buffer << info.guid; buffer << info.guid;
uint32 flags = LFG_UPDATE_FLAG_CHARACTERINFO | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_COMMENT | (info.groupGuid ? LFG_UPDATE_FLAG_GROUPGUID : LFG_UPDATE_FLAG_BINDED) | (info.isGroupLeader ? LFG_UPDATE_FLAG_GROUPLEADER : 0) | (!info.groupGuid || info.isGroupLeader ? LFG_UPDATE_FLAG_AREA : 0); uint32 flags = LFG_UPDATE_FLAG_CHARACTERINFO | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_COMMENT | (info.groupGuid ? LFG_UPDATE_FLAG_GROUPGUID : LFG_UPDATE_FLAG_BINDED) | (info.isGroupLeader ? LFG_UPDATE_FLAG_GROUPLEADER : 0) | (!info.groupGuid || info.isGroupLeader ? LFG_UPDATE_FLAG_AREA : 0);
@@ -1467,7 +1467,7 @@ namespace lfg
if (GetState(gguid) == LFG_STATE_QUEUED) if (GetState(gguid) == LFG_STATE_QUEUED)
{ {
SetState(gguid, LFG_STATE_NONE); SetState(gguid, LFG_STATE_NONE);
const LfgGuidSet& players = GetPlayers(gguid); LfgGuidSet const& players = GetPlayers(gguid);
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{ {
SetState(*it, LFG_STATE_NONE); SetState(*it, LFG_STATE_NONE);
@@ -2315,7 +2315,7 @@ namespace lfg
@param[in] guid Group guid @param[in] guid Group guid
@param[in] dungeonId Dungeonid @param[in] dungeonId Dungeonid
*/ */
void LFGMgr::FinishDungeon(ObjectGuid gguid, const uint32 dungeonId, const Map* currMap) void LFGMgr::FinishDungeon(ObjectGuid gguid, const uint32 dungeonId, Map const* currMap)
{ {
uint32 gDungeonId = GetDungeon(gguid); uint32 gDungeonId = GetDungeon(gguid);
if (gDungeonId != dungeonId) if (gDungeonId != dungeonId)
@@ -2333,7 +2333,7 @@ namespace lfg
SetState(gguid, LFG_STATE_FINISHED_DUNGEON); SetState(gguid, LFG_STATE_FINISHED_DUNGEON);
_SaveToDB(gguid); // pussywizard _SaveToDB(gguid); // pussywizard
const LfgGuidSet& players = GetPlayers(gguid); LfgGuidSet const& players = GetPlayers(gguid);
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{ {
ObjectGuid guid = (*it); ObjectGuid guid = (*it);
@@ -2344,7 +2344,7 @@ namespace lfg
} }
uint32 rDungeonId = 0; uint32 rDungeonId = 0;
const LfgDungeonSet& dungeons = GetSelectedDungeons(guid); LfgDungeonSet const& dungeons = GetSelectedDungeons(guid);
if (!dungeons.empty()) if (!dungeons.empty())
rDungeonId = (*dungeons.begin()); rDungeonId = (*dungeons.begin());
@@ -2522,7 +2522,7 @@ namespace lfg
return roles; return roles;
} }
const std::string& LFGMgr::GetComment(ObjectGuid guid) std::string const& LFGMgr::GetComment(ObjectGuid guid)
{ {
LOG_DEBUG("lfg", "LFGMgr::GetComment: [{}] = {}", guid.ToString(), PlayersStore[guid].GetComment()); LOG_DEBUG("lfg", "LFGMgr::GetComment: [{}] = {}", guid.ToString(), PlayersStore[guid].GetComment());
return PlayersStore[guid].GetComment(); return PlayersStore[guid].GetComment();
@@ -2692,7 +2692,7 @@ namespace lfg
void LFGMgr::AddPlayerQueuedForRandomDungeonToGroup(ObjectGuid gguid, ObjectGuid guid) void LFGMgr::AddPlayerQueuedForRandomDungeonToGroup(ObjectGuid gguid, ObjectGuid guid)
{ {
const LfgDungeonSet& dungeons = GetSelectedDungeons(guid); LfgDungeonSet const& dungeons = GetSelectedDungeons(guid);
if (dungeons.empty()) if (dungeons.empty())
return; return;
+3 -3
View File
@@ -446,7 +446,7 @@ namespace lfg
// World.cpp // World.cpp
/// Finish the dungeon for the given group. All check are performed using internal lfg data /// Finish the dungeon for the given group. All check are performed using internal lfg data
void FinishDungeon(ObjectGuid gguid, uint32 dungeonId, const Map* currMap); void FinishDungeon(ObjectGuid gguid, uint32 dungeonId, Map const* currMap);
/// Loads rewards for random dungeons /// Loads rewards for random dungeons
void LoadRewards(); void LoadRewards();
/// Loads dungeons from dbc and adds teleport coords /// Loads dungeons from dbc and adds teleport coords
@@ -561,8 +561,8 @@ namespace lfg
void UpdateRaidBrowser(uint32 diff); void UpdateRaidBrowser(uint32 diff);
void LfrSetComment(Player* p, std::string comment); void LfrSetComment(Player* p, std::string comment);
void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment); void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment);
void RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer); void RBPacketAppendGroup(RBInternalInfo const& info, ByteBuffer& buffer);
void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer); void RBPacketAppendPlayer(RBInternalInfo const& info, ByteBuffer& buffer);
void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer const& bufferDeleted, uint32 groupCounter, ByteBuffer const& bufferGroups, uint32 playerCounter, ByteBuffer const& bufferPlayers); void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer const& bufferDeleted, uint32 groupCounter, ByteBuffer const& bufferGroups, uint32 playerCounter, ByteBuffer const& bufferPlayers);
void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap const& infoMap); void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap const& infoMap);
@@ -112,7 +112,7 @@ namespace lfg
return m_OldState; return m_OldState;
} }
const LfgLockMap& LfgPlayerData::GetLockedDungeons() const LfgLockMap const& LfgPlayerData::GetLockedDungeons() const
{ {
return m_LockedDungeons; return m_LockedDungeons;
} }
@@ -45,7 +45,7 @@ namespace lfg
// Queue // Queue
void SetRoles(uint8 roles); void SetRoles(uint8 roles);
void SetComment(std::string const& comment); void SetComment(std::string const& comment);
void SetSelectedDungeons(const LfgDungeonSet& dungeons); void SetSelectedDungeons(LfgDungeonSet const& dungeons);
// General // General
[[nodiscard]] LfgState GetState() const; [[nodiscard]] LfgState GetState() const;
+4 -4
View File
@@ -194,7 +194,7 @@ namespace lfg
return newGroupsProcessed; return newGroupsProcessed;
} }
LfgCompatibility LFGQueue::FindNewGroups(const ObjectGuid& newGuid) LfgCompatibility LFGQueue::FindNewGroups(ObjectGuid const& newGuid)
{ {
// each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15 // each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15
// first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc // first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc
@@ -243,7 +243,7 @@ namespace lfg
return selfCompatibility; return selfCompatibility;
} }
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const ObjectGuid& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles) LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, ObjectGuid const& newGuid, uint64& foundMask, uint32& foundCount, std::set<Lfg5Guids> const& currentCompatibles)
{ {
LOG_DEBUG("lfg", "CHECK CheckCompatibility: {}, new guid: {}", checkWith.toString(), newGuid.ToString()); LOG_DEBUG("lfg", "CHECK CheckCompatibility: {}, new guid: {}", checkWith.toString(), newGuid.ToString());
Lfg5Guids check(checkWith, false); // here newGuid is at front Lfg5Guids check(checkWith, false); // here newGuid is at front
@@ -315,7 +315,7 @@ namespace lfg
{ {
for (uint8 i = 0; i < 5 && check.guids[i]; ++i) for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
{ {
const LfgRolesMap& roles = QueueDataStore[check.guids[i]].roles; LfgRolesMap const& roles = QueueDataStore[check.guids[i]].roles;
for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles) for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
{ {
LfgRolesMap::const_iterator itPlayer; LfgRolesMap::const_iterator itPlayer;
@@ -383,7 +383,7 @@ namespace lfg
else else
{ {
ObjectGuid gguid = check.front(); ObjectGuid gguid = check.front();
const LfgQueueData& queue = QueueDataStore[gguid]; LfgQueueData const& queue = QueueDataStore[gguid];
proposalDungeons = queue.dungeons; proposalDungeons = queue.dungeons;
proposalRoles = queue.roles; proposalRoles = queue.roles;
LFGMgr::CheckGroupRoles(proposalRoles); // assing new roles LFGMgr::CheckGroupRoles(proposalRoles); // assing new roles
+2 -2
View File
@@ -103,8 +103,8 @@ namespace lfg
uint32 FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue); uint32 FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key); void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key);
LfgCompatibility FindNewGroups(const ObjectGuid& newGuid); LfgCompatibility FindNewGroups(ObjectGuid const& newGuid);
LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const ObjectGuid& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles); LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, ObjectGuid const& newGuid, uint64& foundMask, uint32& foundCount, std::set<Lfg5Guids> const& currentCompatibles);
// Queue // Queue
uint32 m_QueueStatusTimer; // used to check interval of sending queue status uint32 m_QueueStatusTimer; // used to check interval of sending queue status
@@ -474,7 +474,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility)
/** /**
* change the entry of creature until respawn * change the entry of creature until respawn
*/ */
bool Creature::InitEntry(uint32 Entry, const CreatureData* data) bool Creature::InitEntry(uint32 Entry, CreatureData const* data)
{ {
CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry); CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!normalInfo) if (!normalInfo)
@@ -578,7 +578,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
return true; return true;
} }
bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changelevel, bool updateAI) bool Creature::UpdateEntry(uint32 Entry, CreatureData const* data, bool changelevel, bool updateAI)
{ {
if (!InitEntry(Entry, data)) if (!InitEntry(Entry, data))
return false; return false;
@@ -1148,7 +1148,7 @@ void Creature::Motion_Initialize()
GetMotionMaster()->Initialize(); GetMotionMaster()->Initialize();
} }
bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data) bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, CreatureData const* data)
{ {
ASSERT(map); ASSERT(map);
SetMap(map); SetMap(map);
@@ -1612,7 +1612,7 @@ float Creature::GetSpellDamageMod(int32 Rank)
} }
} }
bool Creature::CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData* data) bool Creature::CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, CreatureData const* data)
{ {
SetZoneScript(); SetZoneScript();
if (GetZoneScript() && data) if (GetZoneScript() && data)
+7 -7
View File
@@ -61,7 +61,7 @@ public:
[[nodiscard]] bool isVendorWithIconSpeak() const; [[nodiscard]] bool isVendorWithIconSpeak() const;
bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data = nullptr); bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, CreatureData const* data = nullptr);
bool LoadCreaturesAddon(bool reload = false); bool LoadCreaturesAddon(bool reload = false);
void SelectLevel(bool changelevel = true); void SelectLevel(bool changelevel = true);
void LoadEquipment(int8 id = 1, bool force = false); void LoadEquipment(int8 id = 1, bool force = false);
@@ -175,7 +175,7 @@ public:
void UpdateMovementFlags(); void UpdateMovementFlags();
uint32 GetRandomId(uint32 id1, uint32 id2, uint32 id3); uint32 GetRandomId(uint32 id1, uint32 id2, uint32 id3);
bool UpdateEntry(uint32 entry, const CreatureData* data = nullptr, bool changelevel = true, bool updateAI = false); bool UpdateEntry(uint32 entry, CreatureData const* data = nullptr, bool changelevel = true, bool updateAI = false);
bool UpdateEntry(uint32 entry, bool updateAI) { return UpdateEntry(entry, nullptr, true, updateAI); } bool UpdateEntry(uint32 entry, bool updateAI) { return UpdateEntry(entry, nullptr, true, updateAI); }
bool UpdateStats(Stats stat) override; bool UpdateStats(Stats stat) override;
bool UpdateAllStats() override; bool UpdateAllStats() override;
@@ -342,15 +342,15 @@ public:
[[nodiscard]] bool IsNotReachableAndNeedRegen() const; [[nodiscard]] bool IsNotReachableAndNeedRegen() const;
void SetPosition(float x, float y, float z, float o); void SetPosition(float x, float y, float z, float o);
void SetPosition(const Position& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } void SetPosition(Position const& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); } void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
void SetHomePosition(const Position& pos) { m_homePosition.Relocate(pos); } void SetHomePosition(Position const& pos) { m_homePosition.Relocate(pos); }
void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); } void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); }
[[nodiscard]] Position const& GetHomePosition() const { return m_homePosition; } [[nodiscard]] Position const& GetHomePosition() const { return m_homePosition; }
void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); } void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
void SetTransportHomePosition(const Position& pos) { m_transportHomePosition.Relocate(pos); } void SetTransportHomePosition(Position const& pos) { m_transportHomePosition.Relocate(pos); }
void GetTransportHomePosition(float& x, float& y, float& z, float& ori) const { m_transportHomePosition.GetPosition(x, y, z, ori); } void GetTransportHomePosition(float& x, float& y, float& z, float& ori) const { m_transportHomePosition.GetPosition(x, y, z, ori); }
[[nodiscard]] Position const& GetTransportHomePosition() const { return m_transportHomePosition; } [[nodiscard]] Position const& GetTransportHomePosition() const { return m_transportHomePosition; }
@@ -460,8 +460,8 @@ public:
bool IsUpdateNeeded() override; bool IsUpdateNeeded() override;
protected: protected:
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData* data = nullptr); bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, CreatureData const* data = nullptr);
bool InitEntry(uint32 entry, const CreatureData* data = nullptr); bool InitEntry(uint32 entry, CreatureData const* data = nullptr);
// vendor items // vendor items
VendorItemCounts m_vendorItemCounts; VendorItemCounts m_vendorItemCounts;
@@ -102,7 +102,7 @@ public:
bool IsEmpty() const { return m_members.empty(); } bool IsEmpty() const { return m_members.empty(); }
bool IsFormed() const { return m_Formed; } bool IsFormed() const { return m_Formed; }
const CreatureGroupMemberType& GetMembers() const { return m_members; } CreatureGroupMemberType const& GetMembers() const { return m_members; }
void AddMember(Creature* member); void AddMember(Creature* member);
void RemoveMember(Creature* member); void RemoveMember(Creature* member);
@@ -71,7 +71,7 @@ public:
void SetVisibleBySummonerOnly(bool visibleBySummonerOnly) { _visibleBySummonerOnly = visibleBySummonerOnly; } void SetVisibleBySummonerOnly(bool visibleBySummonerOnly) { _visibleBySummonerOnly = visibleBySummonerOnly; }
[[nodiscard]] bool IsVisibleBySummonerOnly() const { return _visibleBySummonerOnly; } [[nodiscard]] bool IsVisibleBySummonerOnly() const { return _visibleBySummonerOnly; }
const SummonPropertiesEntry* const m_Properties; SummonPropertiesEntry const* const m_Properties;
std::string GetDebugInfo() const override; std::string GetDebugInfo() const override;
@@ -1031,7 +1031,7 @@ void GameObject::SaveToDB(bool saveAddon /*= false*/)
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask, bool saveAddon /*= false*/) void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask, bool saveAddon /*= false*/)
{ {
const GameObjectTemplate* goI = GetGOInfo(); GameObjectTemplate const* goI = GetGOInfo();
if (!goI) if (!goI)
return; return;
@@ -1431,7 +1431,7 @@ void GameObject::SetGoArtKit(uint8 kit)
void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid) void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid)
{ {
const GameObjectData* data = nullptr; GameObjectData const* data = nullptr;
if (go) if (go)
{ {
go->SetGoArtKit(artkit); go->SetGoArtKit(artkit);
@@ -2815,7 +2815,7 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
dynFlags |= GO_DYNFLAG_LO_SPARKLE; dynFlags |= GO_DYNFLAG_LO_SPARKLE;
break; break;
case GAMEOBJECT_TYPE_TRANSPORT: case GAMEOBJECT_TYPE_TRANSPORT:
if (const StaticTransport* t = ToStaticTransport()) if (StaticTransport const* t = ToStaticTransport())
if (t->GetPauseTime()) if (t->GetPauseTime())
{ {
if (GetGoState() == GO_STATE_READY) if (GetGoState() == GO_STATE_READY)
@@ -2832,7 +2832,7 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
// else it's ignored // else it's ignored
break; break;
case GAMEOBJECT_TYPE_MO_TRANSPORT: case GAMEOBJECT_TYPE_MO_TRANSPORT:
if (const MotionTransport* t = ToMotionTransport()) if (MotionTransport const* t = ToMotionTransport())
pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPeriod()) * 65535.0f); pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPeriod()) * 65535.0f);
break; break;
default: default:
@@ -314,7 +314,7 @@ public:
void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr) const; void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr) const;
void SetPosition(float x, float y, float z, float o); void SetPosition(float x, float y, float z, float o);
void SetPosition(const Position& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } void SetPosition(Position const& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
[[nodiscard]] bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; } [[nodiscard]] bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; }
[[nodiscard]] bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; } [[nodiscard]] bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; }
+1 -1
View File
@@ -248,7 +248,7 @@ public:
void DeleteRefundDataFromDB(CharacterDatabaseTransaction* trans); void DeleteRefundDataFromDB(CharacterDatabaseTransaction* trans);
Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return nullptr; } Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return nullptr; }
[[nodiscard]] const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return nullptr; } [[nodiscard]] Bag const* ToBag() const { if (IsBag()) return reinterpret_cast<Bag const*>(this); else return nullptr; }
[[nodiscard]] bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); } [[nodiscard]] bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); }
[[nodiscard]] bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; } [[nodiscard]] bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
+6 -6
View File
@@ -1298,7 +1298,7 @@ float WorldObject::GetDistance(WorldObject const* obj) const
return d > 0.0f ? d : 0.0f; return d > 0.0f ? d : 0.0f;
} }
[[nodiscard]] float WorldObject::GetDistance(const Position& pos) const [[nodiscard]] float WorldObject::GetDistance(Position const& pos) const
{ {
float d = GetExactDist(&pos) - GetObjectSize(); float d = GetExactDist(&pos) - GetObjectSize();
return d > 0.0f ? d : 0.0f; return d > 0.0f ? d : 0.0f;
@@ -1347,7 +1347,7 @@ bool WorldObject::IsInMap(WorldObject const* obj) const
return IsInDist(x, y, z, dist + GetObjectSize()); return IsInDist(x, y, z, dist + GetObjectSize());
} }
bool WorldObject::IsWithinDist3d(const Position* pos, float dist) const bool WorldObject::IsWithinDist3d(Position const* pos, float dist) const
{ {
return IsInDist(pos, dist + GetObjectSize()); return IsInDist(pos, dist + GetObjectSize());
} }
@@ -1357,7 +1357,7 @@ bool WorldObject::IsWithinDist3d(const Position* pos, float dist) const
return IsInDist2d(x, y, dist + GetObjectSize()); return IsInDist2d(x, y, dist + GetObjectSize());
} }
bool WorldObject::IsWithinDist2d(const Position* pos, float dist) const bool WorldObject::IsWithinDist2d(Position const* pos, float dist) const
{ {
return IsInDist2d(pos, dist + GetObjectSize()); return IsInDist2d(pos, dist + GetObjectSize());
} }
@@ -1555,7 +1555,7 @@ bool WorldObject::isInBack(WorldObject const* target, float arc) const
return !HasInArc(2 * M_PI - arc, target); return !HasInArc(2 * M_PI - arc, target);
} }
void WorldObject::GetRandomPoint(const Position& pos, float distance, float& rand_x, float& rand_y, float& rand_z) const void WorldObject::GetRandomPoint(Position const& pos, float distance, float& rand_x, float& rand_y, float& rand_z) const
{ {
if (!distance) if (!distance)
{ {
@@ -1576,7 +1576,7 @@ void WorldObject::GetRandomPoint(const Position& pos, float distance, float& ran
UpdateGroundPositionZ(rand_x, rand_y, rand_z); // update to LOS height if available UpdateGroundPositionZ(rand_x, rand_y, rand_z); // update to LOS height if available
} }
Position WorldObject::GetRandomPoint(const Position& srcPos, float distance) const Position WorldObject::GetRandomPoint(Position const& srcPos, float distance) const
{ {
float x, y, z; float x, y, z;
GetRandomPoint(srcPos, distance, x, y, z); GetRandomPoint(srcPos, distance, x, y, z);
@@ -2441,7 +2441,7 @@ void WorldObject::ClearZoneScript()
m_zoneScript = nullptr; m_zoneScript = nullptr;
} }
TempSummon* WorldObject::SummonCreature(uint32 entry, const Position& pos, TempSummonType spwtype, uint32 duration, uint32 /*vehId*/, SummonPropertiesEntry const* properties, bool visibleBySummonerOnly /*= false*/) const TempSummon* WorldObject::SummonCreature(uint32 entry, Position const& pos, TempSummonType spwtype, uint32 duration, uint32 /*vehId*/, SummonPropertiesEntry const* properties, bool visibleBySummonerOnly /*= false*/) const
{ {
if (Map* map = FindMap()) if (Map* map = FindMap())
{ {

Some files were not shown because too many files have changed in this diff Show More