mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-04 19:04:08 +00:00
Little improvement for prev commit
This commit is contained in:
parent
9245bee717
commit
f3f93ef89e
1 changed files with 3 additions and 3 deletions
|
@ -211,10 +211,10 @@ Direction AquariaGuiElement::GetDirection()
|
||||||
|
|
||||||
AquariaGuiElement *AquariaGuiElement::FindClosestTo(AquariaGuiElement *cur, Vector pos, Direction dir)
|
AquariaGuiElement *AquariaGuiElement::FindClosestTo(AquariaGuiElement *cur, Vector pos, Direction dir)
|
||||||
{
|
{
|
||||||
int smallDist = -1, dist = 0;
|
float dist = 0, smallDist = -1;
|
||||||
|
|
||||||
AquariaGuiElement *gui = 0, *closest = 0;
|
AquariaGuiElement *gui = 0, *closest = 0;
|
||||||
int ch = 64;
|
const float ch = 64;
|
||||||
for (GuiElements::iterator i = guiElements.begin(); i != guiElements.end(); i++)
|
for (GuiElements::iterator i = guiElements.begin(); i != guiElements.end(); i++)
|
||||||
{
|
{
|
||||||
gui = (*i);
|
gui = (*i);
|
||||||
|
@ -263,7 +263,7 @@ AquariaGuiElement *AquariaGuiElement::FindClosestTo(AquariaGuiElement *cur, Vect
|
||||||
|
|
||||||
if (go)
|
if (go)
|
||||||
{
|
{
|
||||||
dist = static_cast<int>((p1 - p2).getSquaredLength2D());
|
dist = (p1 - p2).getSquaredLength2D();
|
||||||
|
|
||||||
if (smallDist == -1 || dist < smallDist)
|
if (smallDist == -1 || dist < smallDist)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue