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:
parent
7d51a97145
commit
99eec85310
1 changed files with 2 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue