1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-25 01:36:38 +00:00

fix world map tile selection to actually select the closest tile

This commit is contained in:
fgenesis 2023-02-16 18:33:25 +01:00
parent 7d51a97145
commit 99eec85310

View file

@ -876,7 +876,7 @@ void WorldMapRender::onUpdate(float dt)
else
{
WorldMapTile *selectedTile = 0;
int sd=-1,d=0;
float sd=-1,d=0;
for (size_t i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++)
{
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
@ -889,11 +889,10 @@ void WorldMapRender::onUpdate(float dt)
{
d = (q->getWorldPosition() - core->mouse.position).getSquaredLength2D();
if (q->isCoordinateInsideWorld(core->mouse.position) && (sd == -1 || d < sd))
if (q->isCoordinateInsideWorld(core->mouse.position) && (sd < 0 || d < sd))
{
sd = d;
selectedTile = tile;
break;
}
}
}