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

View File

@@ -36,7 +36,7 @@ namespace VMAP
{
public:
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);
if (result)
@@ -56,7 +56,7 @@ namespace VMAP
{
public:
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)
LOG_DEBUG("maps", "LocationInfoCallback: trying to intersect '{}'", prims[entry].name);
@@ -84,14 +84,14 @@ namespace VMAP
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);
iTree.intersectPoint(pos, intersectionCallBack);
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)
{
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;
*/
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;
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();
// 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
*/
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;
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();
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;
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);
bool success = false;