diff --git a/addons/microdagr/XEH_clientInit.sqf b/addons/microdagr/XEH_clientInit.sqf index c17914ad4b6..2b8bcd88b38 100644 --- a/addons/microdagr/XEH_clientInit.sqf +++ b/addons/microdagr/XEH_clientInit.sqf @@ -53,5 +53,6 @@ GVAR(settingShowAllWaypointsOnMap) = true; GVAR(newWaypointPosition) = []; GVAR(currentWaypoint) = -1; GVAR(rangeFinderPositionASL) = []; +GVAR(prevWaypointsCount) = 0; GVAR(mgrsGridZoneDesignator) = format ["%1 %2",EGVAR(common,MGRS_data) select 0, EGVAR(common,MGRS_data) select 1]; diff --git a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf index c756b63141b..72822cff409 100644 --- a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf +++ b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf @@ -22,7 +22,7 @@ private _display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(Dialo if (isNull _display) exitWith {LOG("No Display");}; -if (GVAR(currentApplicationPage) == 2) then { +if (GVAR(currentApplicationPage) == APP_MODE_MAP) then { private _theMap = [_display displayCtrl IDC_MAPDETAILS, _display displayCtrl IDC_MAPPLAIN] select (!GVAR(mapShowTexture)); private _mapCtrlPos = ctrlPosition _theMap; @@ -32,7 +32,7 @@ if (GVAR(currentApplicationPage) == 2) then { GVAR(mapZoom) = (ctrlMapScale _theMap) * _mapSize; //Hit button again, toggle map modes: - if (_newMode == 2) then { + if (_newMode == APP_MODE_MAP) then { if (GVAR(mapShowTexture)) then { GVAR(mapShowTexture) = false; } else { diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index a79a387388e..5407635d0de 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -166,13 +166,20 @@ case (APP_MODE_WAYPOINTS): { _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", _2dDistanceKm toFixed GVAR(waypointPrecision)])]; } forEach _waypoints; - _currentIndex = (_currentIndex max 0) min ((count _waypoints) - 1); + // Select last created waypoint + private _currWaypointsCount = count _waypoints; + if (_currWaypointsCount > (GVAR(prevWaypointsCount))) then { + _currentIndex = _currWaypointsCount - 1; + } else { + _currentIndex = (_currentIndex max 0) min (_currWaypointsCount - 1); + }; if ((lbCurSel _wpListBox) != _currentIndex) then { _wpListBox lbSetCurSel _currentIndex; }; //Reset focus to a dummy ctrl (top button), otherwise HOME/POS1 key goes to top of listBox and has keybind blocked ctrlSetFocus (_display displayCtrl IDC_TOPMENUBUTTON); + GVAR(prevWaypointsCount) = _currWaypointsCount; }; case (APP_MODE_SETUP): {