mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-03 18:14:01 +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
|
else
|
||||||
{
|
{
|
||||||
WorldMapTile *selectedTile = 0;
|
WorldMapTile *selectedTile = 0;
|
||||||
int sd=-1,d=0;
|
float sd=-1,d=0;
|
||||||
for (size_t i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++)
|
for (size_t i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++)
|
||||||
{
|
{
|
||||||
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
|
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
|
||||||
|
@ -889,11 +889,10 @@ void WorldMapRender::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
d = (q->getWorldPosition() - core->mouse.position).getSquaredLength2D();
|
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;
|
sd = d;
|
||||||
selectedTile = tile;
|
selectedTile = tile;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue