mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
Minor optimizations
This commit is contained in:
@@ -309,7 +309,7 @@ void RmgMap::setZoneID(const int3& tile, TRmgTemplateZoneId zid)
|
|||||||
zoneColouring[tile.x][tile.y][tile.z] = zid;
|
zoneColouring[tile.x][tile.y][tile.z] = zid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RmgMap::setNearestObjectDistance(int3 &tile, float value)
|
void RmgMap::setNearestObjectDistance(const int3 &tile, float value)
|
||||||
{
|
{
|
||||||
assertOnMap(tile);
|
assertOnMap(tile);
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
TerrainTile & getTile(const int3 & tile) const;
|
TerrainTile & getTile(const int3 & tile) const;
|
||||||
|
|
||||||
float getNearestObjectDistance(const int3 &tile) const;
|
float getNearestObjectDistance(const int3 &tile) const;
|
||||||
void setNearestObjectDistance(int3 &tile, float value);
|
void setNearestObjectDistance(const int3 &tile, float value);
|
||||||
|
|
||||||
TRmgTemplateZoneId getZoneID(const int3& tile) const;
|
TRmgTemplateZoneId getZoneID(const int3& tile) const;
|
||||||
void setZoneID(const int3& tile, TRmgTemplateZoneId zid);
|
void setZoneID(const int3& tile, TRmgTemplateZoneId zid);
|
||||||
|
@@ -68,11 +68,12 @@ Path Path::search(const Tileset & dst, bool straight, std::function<float(const
|
|||||||
if(!dArea)
|
if(!dArea)
|
||||||
return Path::invalid();
|
return Path::invalid();
|
||||||
|
|
||||||
|
if(dst.empty()) // Skip construction of same area
|
||||||
|
return Path(*dArea);
|
||||||
|
|
||||||
auto resultArea = *dArea + dst;
|
auto resultArea = *dArea + dst;
|
||||||
Path result(resultArea);
|
Path result(resultArea);
|
||||||
if(dst.empty())
|
|
||||||
return result;
|
|
||||||
|
|
||||||
int3 src = rmg::Area(dst).nearest(dPath);
|
int3 src = rmg::Area(dst).nearest(dPath);
|
||||||
result.connect(src);
|
result.connect(src);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user