Skip to content

Commit

Permalink
More waypoint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SupSuper committed Dec 31, 2019
1 parent 45efef7 commit 00242b6
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions src/Battlescape/BattlescapeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,17 +926,7 @@ void BattlescapeState::btnInventoryClick(Action *)
if (playableUnitSelected()
&& (_save->getSelectedUnit()->hasInventory() || _save->getDebugMode()))
{
// clean up the waypoints
if (_battleGame->getCurrentAction()->type == BA_LAUNCH)
{
_battleGame->getCurrentAction()->waypoints.clear();
_battleGame->getMap()->getWaypoints()->clear();
showLaunchButton(false);
}

_battleGame->getPathfinding()->removePreview();
_battleGame->cancelCurrentAction(true);

_battleGame->cancelAllActions();
_game->pushState(new InventoryState(!_save->getDebugMode(), this));
}
}
Expand Down Expand Up @@ -1082,7 +1072,7 @@ void BattlescapeState::btnStatsClick(Action *action)
{
if (playableUnitSelected())
{
bool b = true;
bool scroll = false;
if (SCROLL_TRIGGER == Options::battleEdgeScroll &&
SDL_MOUSEBUTTONUP == action->getDetails()->type && SDL_BUTTON_LEFT == action->getDetails()->button.button)
{
Expand All @@ -1094,19 +1084,13 @@ void BattlescapeState::btnStatsClick(Action *action)
|| (posY > (_map->getHeight() - Camera::SCROLL_BORDER) * action->getYScale()))
// To avoid handling this event as a click
// on the stats button when the mouse is on the scroll-border
b = false;
scroll = true;
}
// clean up the waypoints
if (_battleGame->getCurrentAction()->type == BA_LAUNCH)
if (!scroll)
{
_battleGame->getCurrentAction()->waypoints.clear();
_battleGame->getMap()->getWaypoints()->clear();
showLaunchButton(false);
_battleGame->cancelAllActions();
popup(new UnitInfoState(_save->getSelectedUnit(), this, false, false));
}

_battleGame->cancelCurrentAction(true);

if (b) popup(new UnitInfoState(_save->getSelectedUnit(), this, false, false));
}
}

Expand Down

0 comments on commit 00242b6

Please sign in to comment.