From ab52ff8ddbe1e4f06636be84e4f204a4339a5a0b Mon Sep 17 00:00:00 2001 From: Mezilsa Date: Sat, 22 Sep 2018 05:32:09 +0200 Subject: [PATCH] add microdagrwaypoint precision as an option (#6437) * Make the precision of the mircoDagr less perfekt * Add strings of precision Option to stringtabel * Update stringtable.xml * Create initSettings.sqf * Update ACE_Settings.hpp * Finally * Cleaning * Update initSettings.sqf * Move other settings to sqf, simplify waypointPrecision --- addons/microdagr/ACE_Settings.hpp | 7 +----- addons/microdagr/XEH_preInit.sqf | 2 ++ .../microdagr/functions/fnc_updateDisplay.sqf | 6 ++--- addons/microdagr/initSettings.sqf | 21 +++++++++++++++++ addons/microdagr/stringtable.xml | 23 ++++++++++++++++++- 5 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 addons/microdagr/initSettings.sqf diff --git a/addons/microdagr/ACE_Settings.hpp b/addons/microdagr/ACE_Settings.hpp index f1e7595b74..fa51a6535d 100644 --- a/addons/microdagr/ACE_Settings.hpp +++ b/addons/microdagr/ACE_Settings.hpp @@ -1,10 +1,5 @@ class ACE_Settings { class GVAR(mapDataAvailable) { - displayName = CSTRING(MapDataAvailable_DisplayName); - description = CSTRING(MapDataAvailable_Description); - value = 2; - typeName = "SCALAR"; - isClientSettable = 0; - values[] = {CSTRING(MapFill_None), CSTRING(MapFill_OnlyRoads), CSTRING(MapFill_Full)}; + movedToSQF = 1; }; }; diff --git a/addons/microdagr/XEH_preInit.sqf b/addons/microdagr/XEH_preInit.sqf index c6cdd0bbef..b46948b0bb 100644 --- a/addons/microdagr/XEH_preInit.sqf +++ b/addons/microdagr/XEH_preInit.sqf @@ -9,4 +9,6 @@ PREP_RECOMPILE_END; //Functions that are called for each draw of the map: GVAR(miniMapDrawHandlers) = []; +#include "initSettings.sqf" + ADDON = true; diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index d6acba711e..a78f369d56 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -89,7 +89,7 @@ case (APP_MODE_INFODISPLAY): { ([_bearing, 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; private _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; - _rangeText = format ["%1km", _2dDistanceKm toFixed 3]; + _rangeText = format ["%1km", _2dDistanceKm toFixed GVAR(waypointPrecision)]; private _numASL = (_targetPosLocationASL select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; _aboveSeaLevelText = if (_numASL > 0) then {"+" + _aboveSeaLevelText + " MSL"} else {_aboveSeaLevelText + " MSL"}; @@ -145,7 +145,7 @@ case (APP_MODE_COMPASS): { ([_bearing, 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; private _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; - _rangeText = format ["%1km", _2dDistanceKm toFixed 3]; + _rangeText = format ["%1km", _2dDistanceKm toFixed GVAR(waypointPrecision)]; }; (_display displayCtrl IDC_MODECOMPASS_BEARING) ctrlSetText _bearingText; @@ -163,7 +163,7 @@ case (APP_MODE_WAYPOINTS): { _x params ["_wpName", "_wpPos"]; _wpListBox lbAdd _wpName; private _2dDistanceKm = ((getPosASL ACE_player) distance2D _wpPos) / 1000; - _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", _2dDistanceKm toFixed 3])]; + _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", _2dDistanceKm toFixed GVAR(waypointPrecision)])]; } forEach _waypoints; _currentIndex = (_currentIndex max 0) min (count _waypoints); diff --git a/addons/microdagr/initSettings.sqf b/addons/microdagr/initSettings.sqf new file mode 100644 index 0000000000..5138637645 --- /dev/null +++ b/addons/microdagr/initSettings.sqf @@ -0,0 +1,21 @@ +// CBA Settings [ADDON: ace_microdagr]: + +[ + QGVAR(mapDataAvailable), "LIST", + [LSTRING(MapDataAvailable_DisplayName), LSTRING(MapDataAvailable_Description)], + ["ACE Uncategorized", "MicroDAGR"], + [[0,1,2],[LSTRING(MapFill_None), LSTRING(MapFill_OnlyRoads), LSTRING(MapFill_Full)],2], // [values, titles, defaultIndex] + true, // isGlobal + {[QGVAR(mapDataAvailable), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // require mission restart +] call CBA_settings_fnc_init; + +[ + QGVAR(waypointPrecision), "LIST", + [LSTRING(WaypointPrecision_DisplayName), LSTRING(WaypointPrecision_Description)], + ["ACE Uncategorized", "MicroDAGR"], + [[1, 2, 3], [LSTRING(WaypointPrecision_medium), LSTRING(WaypointPrecision_close), LSTRING(WaypointPrecision_exact)], 2], // [values, titles, defaultIndex] + true, // isGlobal + {[QGVAR(waypointPrecision), _this] call EFUNC(common,cbaSettings_settingChanged)}, + false // require mission restart +] call cba_settings_fnc_init; diff --git a/addons/microdagr/stringtable.xml b/addons/microdagr/stringtable.xml index 1d393606f3..dbe7cff87f 100644 --- a/addons/microdagr/stringtable.xml +++ b/addons/microdagr/stringtable.xml @@ -497,6 +497,27 @@ 无 (无法检视地图) 無 (無法檢視地圖) + + MicroDAGR - Waypoint Precision + MicroDAGR - Wegpunkt Genauigkeit + + + Controls how precise the waypointdistance can be displayed + Legt die Genauigkeit der Entfernung von Wegpunkten fest + + + 100m + 100m + + + 10m + 10m + + + 1m + 1m + + Controls how much data is filled on the microDAGR items. Less data restricts the map view to show less on the minimap. Moduł ten pozwala kontrolować jak duża ilość informacji jest załadowana do przedmiotów MicroDAGR. Mniejsza ilość danych ogranicza widok mapy pokazując mniej rzeczy na minimapie. @@ -511,7 +532,7 @@ アイテム上で表示されるデータ量を決定します。設定を減らすと地図上での情報が少なくなります。 MicroDAGR에 얼마나 많은 데이터가 들어있는지 정합니다. 적을 수록 지도상에도 비춰지는게 적어집니다. 设定有多少数据会显示在微型军用GPS接收器上。这些资料的多寡会反映在迷你地图的显示上。 - 設定有多少數據會顯示在微型軍用GPS接收器上。這些資料的多寡會反映在迷你地圖的顯示上 + 設定有多少數據會顯示在微型軍用GPS接收器上。這些資料的多寡會反映在迷你地圖的顯示上。