From f2bda7c434a1f5375f7c7657dec3c946258c087c Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 24 Aug 2015 04:17:24 +0200 Subject: [PATCH 1/9] Added hitpoint groups framework --- addons/repair/CfgVehicles.hpp | 14 ++++++++++++-- .../repair/functions/fnc_addRepairActions.sqf | 7 +++++-- addons/repair/functions/fnc_doRepair.sqf | 18 ++++++++++++++++-- addons/repair/script_component.hpp | 4 ---- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 7c465f50ce..b4196dcf16 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -285,7 +285,10 @@ class CfgVehicles { transportRepair = 0; }; - class Heli_Transport_04_base_F; + class Helicopter_Base_H; + class Heli_Transport_04_base_F: Helicopter_Base_H { + GVAR(hitpointGroup[]) = {"Glass_1_hitpoint", "Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"}; + }; class O_Heli_Transport_04_repair_F: Heli_Transport_04_base_F { GVAR(canRepair) = 1; transportRepair = 0; @@ -303,12 +306,19 @@ class CfgVehicles { transportRepair = 0; }; - class Offroad_01_base_F; + class Car_F; + class Offroad_01_base_F: Car_F { + GVAR(hitpointGroup[]) = {"HitGlass1", "HitGlass2"}; + }; class Offroad_01_repair_base_F: Offroad_01_base_F { GVAR(canRepair) = 1; transportRepair = 0; }; + class MRAP_01_base_F: Car_F { + GVAR(hitpointGroup[]) = {"HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6"}; + }; + class B_Truck_01_mover_F; class B_Truck_01_Repair_F: B_Truck_01_mover_F { GVAR(canRepair) = 1; diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 3503dff3f0..5353986a4b 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -75,8 +75,11 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); } else { - // exit if the hitpoint is in the blacklist, e.g. glasses - if (_x in IGNORED_HITPOINTS) exitWith {}; + private "_hitpointGroup"; + // Exit if the hitpoint is in group and not main group hitpoint (which gets added as group repair action) + _hitpointGroup = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroup); + _hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]}; + if (count _hitpointGroup > 0 && {_x in _hitpointGroup} && {_x != _hitpointGroup select 0}) exitWith {}; // exit if the hitpoint is virtual if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _x >> "depends")) exitWith {}; diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index dfc21830c9..fb53f033a6 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -17,11 +17,11 @@ */ #include "script_component.hpp" +private ["_hitPointDamage", "_text", "_hitpointGroup"]; params ["_unit", "_vehicle", "_hitPoint"]; TRACE_3("params",_unit,_vehicle,_hitPoint); // get current hitpoint damage -private "_hitPointDamage"; _hitPointDamage = _vehicle getHitPointDamage _hitPoint; _hitPointDamage = _hitPointDamage - 0.5; @@ -31,9 +31,23 @@ _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); // raise event to set the new hitpoint damage ["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); +// Repair the rest in the group (don't need to worry about specific damage as it's not checked) +_hitpointGroup = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroup); +_hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]}; +if (count _hitpointGroup > 0) then { + ([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitpoints"]; + _hitpointGroup deleteAt 0; // Remove main group hitpoint + { + if (_x in _hitpoints) then { + _vehicle setHitPointDamage [_x, 0]; + } else { + diag_log text format ["[ACE] ERROR: Invalid hitpoint %1 in hitpointGroup of %2", _x, _vehicle]; + }; + } forEach _hitpointGroup; +}; + // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { - private "_text"; _text = format ["STR_ACE_Repair_%1", _hitPoint]; if (isLocalized _text) then { diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index 23c52bdec8..0714b1a568 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -10,7 +10,3 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - - -#define IGNORED_HITPOINTS ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitGlass7","HitGlass8","HitGlass9","HitGlass10","HitGlass11","HitGlass12","HitGlass13","HitGlass14","HitGlass15","HitRGlass","HitLGlass"] -// #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"]; From 144af2ed17917ba70dd47d0c11dd3cc76d1f66cb Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 24 Aug 2015 05:14:04 +0200 Subject: [PATCH 2/9] Added support for when one of the grouped hitpoints is damaged but not main --- addons/repair/ACE_Repair.hpp | 2 +- addons/repair/XEH_preInit.sqf | 1 + addons/repair/functions/fnc_canMiscRepair.sqf | 40 +++++++++++++++++++ addons/repair/functions/fnc_doRepair.sqf | 2 +- 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 addons/repair/functions/fnc_canMiscRepair.sqf diff --git a/addons/repair/ACE_Repair.hpp b/addons/repair/ACE_Repair.hpp index c12566d5b1..a5f9cdfcee 100644 --- a/addons/repair/ACE_Repair.hpp +++ b/addons/repair/ACE_Repair.hpp @@ -31,7 +31,7 @@ class ACE_Repair { class MiscRepair: ReplaceWheel { displayName = CSTRING(Repairing); // let's make empty string an auto generated string displayNameProgress = CSTRING(RepairingHitPoint); - condition = QUOTE((_target getHitPointDamage _hitPoint) > ([_caller] call FUNC(getPostRepairDamage))); + condition = QUOTE(call FUNC(canMiscRepair)); requiredEngineer = 0; repairingTime = 15; callbackSuccess = QUOTE(call FUNC(doRepair)); diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf index ebf4c87537..24244ddba0 100644 --- a/addons/repair/XEH_preInit.sqf +++ b/addons/repair/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(addRepairActions); +PREP(canMiscRepair); PREP(canRemove); PREP(canRepair); PREP(canRepairTrack); diff --git a/addons/repair/functions/fnc_canMiscRepair.sqf b/addons/repair/functions/fnc_canMiscRepair.sqf new file mode 100644 index 0000000000..7c4eb3e1fb --- /dev/null +++ b/addons/repair/functions/fnc_canMiscRepair.sqf @@ -0,0 +1,40 @@ +/* + * Author: Jonpas + * Check if misc repair action can be done, called from callbackSuccess. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * Can Misc Repair + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_canMiscRepair + * + * Public: No + */ +#include "script_component.hpp" + +private ["_hitpointGroup", "_postRepairDamage", "_return"]; +params ["_caller", "_target", "_hitPoint"]; + +// Check hitpoint group +_hitpointGroup = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroup); +_hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]}; + +if !(_hitPoint in _hitpointGroup) then { + _hitpointGroup pushBack _hitPoint; +}; + +_postRepairDamage = [_caller] call FUNC(getPostRepairDamage); + +_return = false; +{ + if ((_target getHitPointDamage _x) > _postRepairDamage) exitWith { + _return = true; + }; +} forEach _hitpointGroup; + +_return diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index fb53f033a6..0a5d0a0eae 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -31,7 +31,7 @@ _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); // raise event to set the new hitpoint damage ["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); -// Repair the rest in the group (don't need to worry about specific damage as it's not checked) +// Repair the rest in the group (no specific damage, main hitpoint is enough) _hitpointGroup = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroup); _hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]}; if (count _hitpointGroup > 0) then { From 78e7565121b5a4c4d7576e5c41ae9124205808ba Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 24 Aug 2015 20:03:11 +0200 Subject: [PATCH 3/9] Added support for multiple groups, Fixed check group damage returning true even if hitpoint not in a group --- addons/repair/CfgVehicles.hpp | 6 ++-- .../repair/functions/fnc_addRepairActions.sqf | 26 ++++++++++++---- addons/repair/functions/fnc_canMiscRepair.sqf | 24 ++++++++++----- addons/repair/functions/fnc_doRepair.sqf | 30 ++++++++++++------- 4 files changed, 60 insertions(+), 26 deletions(-) diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index b4196dcf16..4b4fd382ad 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -287,7 +287,7 @@ class CfgVehicles { class Helicopter_Base_H; class Heli_Transport_04_base_F: Helicopter_Base_H { - GVAR(hitpointGroup[]) = {"Glass_1_hitpoint", "Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"}; + GVAR(hitpointGroups[]) = { {"HitEngine", {"HitEngine1", "HitEngine2"}}, {"Glass_1_hitpoint", {"Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"}} }; }; class O_Heli_Transport_04_repair_F: Heli_Transport_04_base_F { GVAR(canRepair) = 1; @@ -308,7 +308,7 @@ class CfgVehicles { class Car_F; class Offroad_01_base_F: Car_F { - GVAR(hitpointGroup[]) = {"HitGlass1", "HitGlass2"}; + GVAR(hitpointGroups[]) = { {"HitGlass1", {"HitGlass2"}} }; }; class Offroad_01_repair_base_F: Offroad_01_base_F { GVAR(canRepair) = 1; @@ -316,7 +316,7 @@ class CfgVehicles { }; class MRAP_01_base_F: Car_F { - GVAR(hitpointGroup[]) = {"HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6"}; + GVAR(hitpointGroups[]) = { {"HitGlass1", {"HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6"}} }; }; class B_Truck_01_mover_F; diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 5353986a4b..c47a9276f9 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -75,11 +75,27 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); } else { - private "_hitpointGroup"; - // Exit if the hitpoint is in group and not main group hitpoint (which gets added as group repair action) - _hitpointGroup = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroup); - _hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]}; - if (count _hitpointGroup > 0 && {_x in _hitpointGroup} && {_x != _hitpointGroup select 0}) exitWith {}; + private ["_hitpointGroupConfig", "_inHitpointSubGroup", "_currentHitpoint"]; + + // Get hitpoint groups if available + _hitpointGroupConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroups); + _inHitpointSubGroup = false; + if (isArray _hitpointGroupConfig) then { + // Loop through hitpoint groups + _currentHitpoint = _x; + { + // Loop through sub-group + { + // Current hitpoint is in a sub-group, set it so + if (_x == _currentHitpoint) exitWith { + _inHitpointSubGroup = true; + }; + } forEach (_x select 1); + } forEach (getArray _hitpointGroupConfig); + }; + + // Exit if current hitpoint is not a group leader (only they get actions) + if (_inHitpointSubGroup) exitWith {}; // exit if the hitpoint is virtual if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _x >> "depends")) exitWith {}; diff --git a/addons/repair/functions/fnc_canMiscRepair.sqf b/addons/repair/functions/fnc_canMiscRepair.sqf index 7c4eb3e1fb..f52e8b3bfd 100644 --- a/addons/repair/functions/fnc_canMiscRepair.sqf +++ b/addons/repair/functions/fnc_canMiscRepair.sqf @@ -17,19 +17,29 @@ */ #include "script_component.hpp" -private ["_hitpointGroup", "_postRepairDamage", "_return"]; +private ["_hitpointGroupConfig", "_hitpointGroup", "_postRepairDamage", "_return"]; params ["_caller", "_target", "_hitPoint"]; -// Check hitpoint group -_hitpointGroup = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroup); -_hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]}; - -if !(_hitPoint in _hitpointGroup) then { - _hitpointGroup pushBack _hitPoint; +// Get hitpoint groups if available +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroup); +_hitpointGroup = []; +if (isArray _hitpointGroupConfig) then { + // Loop through hitpoint groups + { + // Exit using found hitpoint group if this hitpoint is leader of any + if (_x select 0 == _hitPoint) exitWith { + _hitpointGroup = _x select 1; + }; + } forEach (getArray _hitpointGroupConfig); }; +// Add current hitpoint to the group +_hitpointGroup pushBack _hitPoint; + +// Get post repair damage _postRepairDamage = [_caller] call FUNC(getPostRepairDamage); +// Return true if damage can be repaired on any hitpoint in the group, else false _return = false; { if ((_target getHitPointDamage _x) > _postRepairDamage) exitWith { diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index 0a5d0a0eae..c310ddd2ca 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -31,19 +31,27 @@ _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); // raise event to set the new hitpoint damage ["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); -// Repair the rest in the group (no specific damage, main hitpoint is enough) -_hitpointGroup = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroup); -_hitpointGroup = if (isArray _hitpointGroup) then {getArray _hitpointGroup} else {[]}; -if (count _hitpointGroup > 0) then { - ([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitpoints"]; - _hitpointGroup deleteAt 0; // Remove main group hitpoint +// Get hitpoint groups if available +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroup); +_hitpointGroup = []; +if (isArray _hitpointGroupConfig) then { + // Loop through hitpoint groups { - if (_x in _hitpoints) then { - _vehicle setHitPointDamage [_x, 0]; - } else { - diag_log text format ["[ACE] ERROR: Invalid hitpoint %1 in hitpointGroup of %2", _x, _vehicle]; + // Exit using found hitpoint group if this hitpoint is leader of any + if (_x select 0 == _hitPoint) exitWith { + ([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitpoints"]; + // Loop through the found group + { + // If hitpoint is valid set damage to 0, else print RPT error + if (_x in _hitpoints) then { + ["setVehicleHitPointDamage", _vehicle, [_vehicle, _x, 0]] call EFUNC(common,targetEvent); + } else { + diag_log text format ["[ACE] ERROR: Invalid hitpoint %1 in hitpointGroups of %2", _x, _vehicle]; + }; + + } forEach (_x select 1); }; - } forEach _hitpointGroup; + } forEach (getArray _hitpointGroupConfig); }; // display text message if enabled From 3f0909ddd5113a0f65710a7fdd5bef38f70014dd Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 24 Aug 2015 20:12:45 +0200 Subject: [PATCH 4/9] Fixed typo --- addons/repair/functions/fnc_canMiscRepair.sqf | 6 +++++- addons/repair/functions/fnc_doRepair.sqf | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/repair/functions/fnc_canMiscRepair.sqf b/addons/repair/functions/fnc_canMiscRepair.sqf index f52e8b3bfd..105235fa1e 100644 --- a/addons/repair/functions/fnc_canMiscRepair.sqf +++ b/addons/repair/functions/fnc_canMiscRepair.sqf @@ -21,7 +21,7 @@ private ["_hitpointGroupConfig", "_hitpointGroup", "_postRepairDamage", "_return params ["_caller", "_target", "_hitPoint"]; // Get hitpoint groups if available -_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroup); +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroups); _hitpointGroup = []; if (isArray _hitpointGroupConfig) then { // Loop through hitpoint groups @@ -47,4 +47,8 @@ _return = false; }; } forEach _hitpointGroup; +if (typeOf _target == "B_MRAP_01_F") then { + diag_log format ["%1 - %2", _hitPoint, _hitpointGroup]; +}; + _return diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index c310ddd2ca..14b828a67b 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -32,7 +32,7 @@ _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); ["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); // Get hitpoint groups if available -_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroup); +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); _hitpointGroup = []; if (isArray _hitpointGroupConfig) then { // Loop through hitpoint groups From ca71dd43e193961200ba8f8a39720cc42b63f138 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 26 Aug 2015 05:31:33 +0200 Subject: [PATCH 5/9] Code Cleanup MicroDagr Module --- .../functions/fnc_appMarkKeypadEntry.sqf | 13 +++---- .../fnc_appMenuButtonConnectRangefinder.sqf | 8 ++-- .../functions/fnc_appSettingsLBClick.sqf | 4 +- .../fnc_appWaypointsButtonDeleteWP.sqf | 14 +++---- .../functions/fnc_appWaypointsButtonSetWP.sqf | 6 +-- addons/microdagr/functions/fnc_canShow.sqf | 23 ++++++----- .../functions/fnc_deviceAddWaypoint.sqf | 11 +++--- .../functions/fnc_deviceDeleteWaypoint.sqf | 9 ++--- .../functions/fnc_deviceGetWaypoints.sqf | 4 +- .../functions/fnc_dialogClosedEH.sqf | 6 +-- .../functions/fnc_mapButtonDownEH.sqf | 4 +- .../functions/fnc_mapDoubleTapEH.sqf | 6 +-- .../microdagr/functions/fnc_mapOnDrawEH.sqf | 16 ++++---- .../functions/fnc_modeMapButtons.sqf | 4 +- .../microdagr/functions/fnc_moduleMapFill.sqf | 9 ++--- .../microdagr/functions/fnc_openDisplay.sqf | 16 ++++---- .../functions/fnc_recieveRangefinderData.sqf | 6 +-- .../fnc_saveCurrentAndSetNewMode.sqf | 21 +++++----- .../functions/fnc_showApplicationPage.sqf | 12 ++---- .../microdagr/functions/fnc_updateDisplay.sqf | 38 +++++++++---------- 20 files changed, 104 insertions(+), 126 deletions(-) diff --git a/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf index 0822bdf310..86ace87b3e 100644 --- a/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf +++ b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf @@ -6,7 +6,7 @@ * 0: String version of Keypad entry ["ok","del","1",...] * * Return Value: - * Nothing + * None * * Example: * ["ok"] call ace_microdagr_fnc_appMarkKeypadEntry @@ -16,15 +16,12 @@ #include "script_component.hpp" private ["_display", "_editText", "_actualPos"]; -PARAMS_1(_keypadButton); + +params ["_keypadButton"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; if (GVAR(currentApplicationPage) != APP_MODE_MARK) exitWith {}; diff --git a/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf index 1cf81963f5..589ec096fb 100644 --- a/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf +++ b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf @@ -3,18 +3,18 @@ * Handles the "Connect To" button from the menu application * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appMenuButtonConnectRangefinder + * call ace_microdagr_fnc_appMenuButtonConnectRangefinder * * Public: No */ #include "script_component.hpp" -GVAR(currentWaypoint) = if (GVAR(currentWaypoint) == -2) then {-1} else {-2}; +GVAR(currentWaypoint) = [-2, -1] select (GVAR(currentWaypoint) == -2); GVAR(rangeFinderPositionASL) = []; [APP_MODE_INFODISPLAY] call FUNC(saveCurrentAndSetNewMode); diff --git a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf index bc6779c10a..04f045171b 100644 --- a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf +++ b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf @@ -7,7 +7,7 @@ * 1: Index * * Return Value: - * Nothing + * None * * Example: * [settingList, 1] call ace_microdagr_fnc_appSettingsLBClick @@ -17,7 +17,7 @@ #include "script_component.hpp" disableSerialization; -PARAMS_2(_control,_itemClicked); +params ["_control", "_itemClicked"]; switch (_itemClicked) do { case (0): { GVAR(settingUseMils) = ! GVAR(settingUseMils)}; diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf index 1acd936370..956e24c5ba 100644 --- a/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf +++ b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf @@ -3,13 +3,13 @@ * Handles clicking the delete button from the waypoint application * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appWaypointsButtonDeleteWP + * call ace_microdagr_fnc_appWaypointsButtonDeleteWP * * Public: No */ @@ -18,12 +18,8 @@ private ["_display", "_wpIndex"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select GVAR(currentShowMode) == DISPLAY_MODE_DIALOG, displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; _wpIndex = lbCurSel (_display displayCtrl IDC_MODEWAYPOINTS_LISTOFWAYPOINTS); diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf index 881c0b3b5d..d2b3b0e20c 100644 --- a/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf +++ b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf @@ -6,10 +6,10 @@ * The "SetWP" button * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appWaypointsButtonSetWP + * [1234] call ace_microdagr_fnc_appWaypointsButtonSetWP * * Public: No */ @@ -18,7 +18,7 @@ private ["_wpListBox", "_newWpIndex", "_waypoints"]; disableSerialization; -PARAMS_1(_wpButton); +params ["_wpButton"]; _wpListBox = (ctrlParent _wpButton) displayCtrl 144501; _newWpIndex = lbCurSel _wpListBox; diff --git a/addons/microdagr/functions/fnc_canShow.sqf b/addons/microdagr/functions/fnc_canShow.sqf index 9e54f927e0..70e8989031 100644 --- a/addons/microdagr/functions/fnc_canShow.sqf +++ b/addons/microdagr/functions/fnc_canShow.sqf @@ -6,32 +6,31 @@ * The display mode to test showing * * Return Value: - * Nothing + * None * * Example: - * [mode] call ace_microdagr_fnc_canShow + * [1] call ace_microdagr_fnc_canShow * * Public: No */ #include "script_component.hpp" - -PARAMS_1(_showType); +params ["_showType"]; private ["_returnValue"]; _returnValue = false; -switch (_showType) do { -case (DISPLAY_MODE_CLOSED): {_returnValue = true}; //Can always close -case (DISPLAY_MODE_HIDDEN): {_returnValue = true}; //Can always hide - -case (DISPLAY_MODE_DIALOG): { - _returnValue = ("ACE_microDAGR" in (items ACE_player)) && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)}; +_returnValue = switch (_showType) do { + case (DISPLAY_MODE_CLOSED): { true }; //Can always close + case (DISPLAY_MODE_HIDDEN): { true }; //Can always hide + case (DISPLAY_MODE_DIALOG): { + ("ACE_microDAGR" in (items ACE_player)) && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; -case (DISPLAY_MODE_DISPLAY): { + case (DISPLAY_MODE_DISPLAY): { //Can't have minimap up while zoomed in - _returnValue = (cameraview != "GUNNER") && {"ACE_microDAGR" in (items ACE_player)} && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)}; + (cameraview != "GUNNER") && {"ACE_microDAGR" in (items ACE_player)} && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; + default { false }; }; _returnValue diff --git a/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf index c383d0a95e..f99ec78354 100644 --- a/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf +++ b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf @@ -8,7 +8,7 @@ * 1: Waypoint Position ASL * * Return Value: - * Nothing + * None * * Example: * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceAddWaypoint @@ -17,10 +17,11 @@ */ #include "script_component.hpp" -PARAMS_2(_waypointName,_waypointPosASL); - private "_waypoints"; +params ["_waypointName","_waypointPosASL"]; -_waypoints = ace_player getVariable [QGVAR(waypoints), []]; + + +_waypoints = ACE_player getVariable [QGVAR(waypoints), []]; _waypoints pushBack [_waypointName, _waypointPosASL]; -ace_player setVariable [QGVAR(waypoints), _waypoints]; +ACE_player setVariable [QGVAR(waypoints), _waypoints]; diff --git a/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf index 62ca5a222a..d3681466b4 100644 --- a/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf +++ b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf @@ -7,7 +7,7 @@ * 0: Waypoint Index * * Return Value: - * Nothing + * None * * Example: * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceDeleteWaypoint @@ -16,13 +16,12 @@ */ #include "script_component.hpp" -PARAMS_1(_wpIndex); - private "_waypoints"; +params ["_wpIndex"]; -_waypoints = ace_player getVariable [QGVAR(waypoints), []]; +_waypoints = ACE_player getVariable [QGVAR(waypoints), []]; if ((_wpIndex < 0) || (_wpIndex > ((count _waypoints) - 1))) exitWith {ERROR("out of bounds wp");}; _waypoints deleteAt _wpIndex; -ace_player setVariable [QGVAR(waypoints), _waypoints]; +ACE_player setVariable [QGVAR(waypoints), _waypoints]; diff --git a/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf index f90ecb06be..da3484ceb0 100644 --- a/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf +++ b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf @@ -4,7 +4,7 @@ * Device saving not implemented yet, just save to player object * * Arguments: - * Nothing + * None * * Return Value: * Waypoints @@ -16,4 +16,4 @@ */ #include "script_component.hpp" -(ace_player getVariable [QGVAR(waypoints), []]) +(ACE_player getVariable [QGVAR(waypoints), []]) diff --git a/addons/microdagr/functions/fnc_dialogClosedEH.sqf b/addons/microdagr/functions/fnc_dialogClosedEH.sqf index 0a7e5e5115..5180734644 100644 --- a/addons/microdagr/functions/fnc_dialogClosedEH.sqf +++ b/addons/microdagr/functions/fnc_dialogClosedEH.sqf @@ -3,13 +3,13 @@ * Handles the dialog closeing, switches back to display mode * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_dialogClosedEH + * call ace_microdagr_fnc_dialogClosedEH * * Public: No */ diff --git a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf index e7d2618160..8c564a7cfc 100644 --- a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf +++ b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf @@ -10,7 +10,7 @@ * 3: MousePosY * * Return Value: - * Nothing + * None * * Example: * [minimap,0,0.5,0.5] call ace_microdagr_fnc_mapButtonDownEH @@ -19,7 +19,7 @@ */ #include "script_component.hpp" -PARAMS_4(_theMap,_mouseButton,_xPos,_yPos); +params ["_theMap", "_mouseButton", "_xPos", "_yPos"]; //Only handle RMB if (_mouseButton != 1) exitWith {}; diff --git a/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf index 21a164ff2e..2226011215 100644 --- a/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf +++ b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf @@ -9,7 +9,7 @@ * 3: MousePosY * * Return Value: - * Nothing + * None * * Example: * [minimap,0,0.5,0.5] call ace_microdagr_fnc_mapDoubleTapEH @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -PARAMS_4(_theMap,_mouseButton,_xPos,_yPos); +params ["_theMap", "_mouseButton", "_xPos", "_yPos"]; private ["_worldPos"]; @@ -26,7 +26,7 @@ private ["_worldPos"]; if (_mouseButton != 0) exitWith {}; _worldPos = _theMap ctrlMapScreenToWorld [_xPos, _yPos]; -_worldPos set [2, (getTerrainHeightASL _worldPos)]; +_worldPos pushBack (getTerrainHeightASL _worldPos); GVAR(newWaypointPosition) = _worldPos; [APP_MODE_MARK] call FUNC(saveCurrentAndSetNewMode); diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf index 644064d069..a74255601c 100644 --- a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf +++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf @@ -6,7 +6,7 @@ * 0: The Map * * Return Value: - * Nothing + * None * * Example: * [compassMap] call ace_microdagr_fnc_mapOnDrawEH @@ -15,10 +15,10 @@ */ #include "script_component.hpp" -PARAMS_1(_theMap); - private ["_mapSize", "_waypoints", "_size", "_targetPos", "_relBearing", "_wpName", "_wpPos", "_alpha"]; +params ["_theMap"]; + _mapSize = (ctrlPosition _theMap) select 3; _waypoints = [] call FUNC(deviceGetWaypoints); @@ -27,7 +27,7 @@ if (GVAR(currentApplicationPage) == 1) then { _theMap ctrlMapAnimAdd [0, DUMMY_ZOOM, DUMMY_POS]; ctrlMapAnimCommit _theMap; _size = 412 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ace_player)), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ACE_player)), '', 0 ]; _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [0.533,0.769,0.76,1], DUMMY_POS, _size, _size, 0, '', 0 ]; if (GVAR(currentWaypoint) != -1) then { @@ -42,23 +42,23 @@ if (GVAR(currentApplicationPage) == 1) then { }; }; if ((count _targetPos) == 3) then { - _relBearing = [ace_player, _targetPos] call BIS_fnc_relativeDirTo; + _relBearing = [ACE_player, _targetPos] call BIS_fnc_relativeDirTo; _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [1,0.564,0.564,1], DUMMY_POS, _size, _size, _relBearing, '', 0 ]; }; }; } else { //Map Mode: if (GVAR(mapAutoTrackPosition)) then { - _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ace_player)]; + _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ACE_player)]; ctrlMapAnimCommit _theMap; }; _size = 48 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ace_player), _size, _size, (getDir ace_player), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ACE_player), _size, _size, (getDir ACE_player), '', 0 ]; if (GVAR(settingShowAllWaypointsOnMap)) then { _size = 32 * _mapSize; { - EXPLODE_2_PVT(_x,_wpName,_wpPos); + _x params ["_wpName", "_wpPos"]; _alpha = if (_forEachIndex == GVAR(currentWaypoint)) then {1} else {0.5}; _theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ]; } forEach _waypoints; diff --git a/addons/microdagr/functions/fnc_modeMapButtons.sqf b/addons/microdagr/functions/fnc_modeMapButtons.sqf index 5de4bf9ca7..a0d74bec49 100644 --- a/addons/microdagr/functions/fnc_modeMapButtons.sqf +++ b/addons/microdagr/functions/fnc_modeMapButtons.sqf @@ -6,7 +6,7 @@ * 0: String of the map button pressed * * Return Value: - * Nothing + * None * * Example: * ["autotrack"] call ace_microdagr_fnc_modeMapButtons @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_mode); +params ["_mode"]; [-1] call FUNC(saveCurrentAndSetNewMode); //backup current draw pos/zoom diff --git a/addons/microdagr/functions/fnc_moduleMapFill.sqf b/addons/microdagr/functions/fnc_moduleMapFill.sqf index d07b0bc518..d88bc56e87 100644 --- a/addons/microdagr/functions/fnc_moduleMapFill.sqf +++ b/addons/microdagr/functions/fnc_moduleMapFill.sqf @@ -8,7 +8,7 @@ * 2: Module Activated * * Return Value: - * Nothing + * None * * Example: * [module, [], true] call ace_microdagr_fnc_moduleMapFill @@ -17,10 +17,7 @@ */ #include "script_component.hpp" -PARAMS_3(_logic,_syncedUnits,_activated); +if !(isServer) exitWith {}; +params ["_logic", "_syncedUnits", "_activated"]; if (!_activated) exitWith {WARNING("Module Placed but not active");}; - -if (isServer) then { - [_logic, QGVAR(MapDataAvailable), "MapDataAvailable"] call EFUNC(common,readSettingFromModule); -}; diff --git a/addons/microdagr/functions/fnc_openDisplay.sqf b/addons/microdagr/functions/fnc_openDisplay.sqf index b4cec0fe46..c619890bf3 100644 --- a/addons/microdagr/functions/fnc_openDisplay.sqf +++ b/addons/microdagr/functions/fnc_openDisplay.sqf @@ -6,7 +6,7 @@ * 0: Display Mode to show the microDAGR in * * Return Value: - * Nothing + * None * * Example: * [1] call ace_microdagr_fnc_openDisplay @@ -17,7 +17,7 @@ private ["_oldShowMode", "_args", "_pfID", "_player"]; -DEFAULT_PARAM(0,_newDisplayShowMode,-1); +params [["_newDisplayShowMode", -1, [-1]]]; _oldShowMode = GVAR(currentShowMode); if (_newDisplayShowMode == -1) then { @@ -34,7 +34,7 @@ if ((_newDisplayShowMode == DISPLAY_MODE_DIALOG) && {!([DISPLAY_MODE_DIALOG] cal //On first-startup if (GVAR(currentApplicationPage) == APP_MODE_NULL) then { GVAR(currentApplicationPage) = APP_MODE_INFODISPLAY; - GVAR(mapPosition) = getPos ace_player; + GVAR(mapPosition) = getPos ACE_player; }; if (_newDisplayShowMode in [DISPLAY_MODE_CLOSED, DISPLAY_MODE_HIDDEN]) then { @@ -74,14 +74,14 @@ if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_M //Start a pfeh to update display and handle hiding display [{ - PARAMS_2(_args,_pfID); - EXPLODE_1_PVT(_args,_player); - if ((isNull ace_player) || {!alive ace_player} || {ace_player != _player} || {!("ACE_microDAGR" in (items ace_player))} || {GVAR(currentShowMode) == DISPLAY_MODE_CLOSED}) then { + params ["_args", "_idPFH"]; + _args params ["_player"]; + if ((isNull ACE_player) || {!alive ACE_player} || {ACE_player != _player} || {!("ACE_microDAGR" in (items ACE_player))} || {GVAR(currentShowMode) == DISPLAY_MODE_CLOSED}) then { //Close Display if still open: if (GVAR(currentShowMode) != DISPLAY_MODE_CLOSED) then { [DISPLAY_MODE_CLOSED] call FUNC(openDisplay); }; - [_pfID] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; } else { if (GVAR(currentShowMode) == DISPLAY_MODE_HIDDEN) then { //If display is hidden, and we can show, then swithc modes: @@ -96,5 +96,5 @@ if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_M }; }; }; - }, 0.1, [ace_player]] call CBA_fnc_addPerFrameHandler; + }, 0.1, [ACE_player]] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/microdagr/functions/fnc_recieveRangefinderData.sqf b/addons/microdagr/functions/fnc_recieveRangefinderData.sqf index 154dfff94a..8b2c6672a8 100644 --- a/addons/microdagr/functions/fnc_recieveRangefinderData.sqf +++ b/addons/microdagr/functions/fnc_recieveRangefinderData.sqf @@ -8,7 +8,7 @@ * 2: Inclination (Degrees) * * Return Value: - * Nothing + * None * * Example: * [1000, 45, 1] call ace_microdagr_fnc_recieveRangefinderData @@ -19,7 +19,7 @@ private ["_horizontalDistance", "_verticleDistance", "_targetOffset", "_targetPosASL"]; -PARAMS_3(_slopeDistance,_azimuth,_inclination); +params ["_slopeDistance", "_azimuth", "_inclination"]; if (GVAR(currentWaypoint) != -2) exitWith {}; //Only take waypoint when "connected" if (_slopeDistance < 0) exitWith {}; //Bad Data @@ -29,6 +29,6 @@ _verticleDistance = (sin _inclination) * _slopeDistance; _targetOffset = [((sin _azimuth) * _horizontalDistance), ((cos _azimuth) * _horizontalDistance), _verticleDistance]; //This assumes the "rangefinder view" pos is very close to player, at worst the turret should only be a few meters different -_targetPosASL = (getPosASL ace_player) vectorAdd _targetOffset; +_targetPosASL = (getPosASL ACE_player) vectorAdd _targetOffset; GVAR(rangeFinderPositionASL) = _targetPosASL; diff --git a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf index 64a5cab991..7cbec9f242 100644 --- a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf +++ b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf @@ -7,7 +7,7 @@ * 0: New Mode * * Return Value: - * Nothing + * None * * Example: * [2] call ace_microdagr_fnc_saveCurrentAndSetNewMode @@ -16,24 +16,21 @@ */ #include "script_component.hpp" -private ["_display", "_theMap", "_mapSize", "_centerPos", "_mapCtrlPos"]; +private ["_display", "_theMap", "_centerPos", "_mapCtrlPos"]; -PARAMS_1(_newMode); +params ["_newMode"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; if (GVAR(currentApplicationPage) == 2) then { - _theMap = if (!GVAR(mapShowTexture)) then {_display displayCtrl IDC_MAPPLAIN} else {_display displayCtrl IDC_MAPDETAILS}; + _theMap = [_display displayCtrl IDC_MAPDETAILS, _display displayCtrl IDC_MAPPLAIN] select (!GVAR(mapShowTexture)); _mapCtrlPos = ctrlPosition _theMap; - _mapSize = _mapCtrlPos select 3; - _centerPos = [((_mapCtrlPos select 0) + (_mapCtrlPos select 2) / 2), ((_mapCtrlPos select 1) + (_mapCtrlPos select 3) / 2)]; + + _mapCtrlPos params ["_mapCtrlPosX", "_mapCtrlPosY", "_mapCtrlPosZ", "_mapSize"]; + _centerPos = [(_mapCtrlPosX + _mapCtrlPosZ / 2), (_mapCtrlPosY + _mapSize / 2)]; GVAR(mapPosition) = _theMap ctrlMapScreenToWorld _centerPos; GVAR(mapZoom) = (ctrlMapScale _theMap) * _mapSize; diff --git a/addons/microdagr/functions/fnc_showApplicationPage.sqf b/addons/microdagr/functions/fnc_showApplicationPage.sqf index 3c042fdff3..dba6b54f18 100644 --- a/addons/microdagr/functions/fnc_showApplicationPage.sqf +++ b/addons/microdagr/functions/fnc_showApplicationPage.sqf @@ -3,10 +3,10 @@ * Changes the "application page" shown on the microDAGR * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * [] call ace_microdagr_fnc_showApplicationPage @@ -19,12 +19,8 @@ private ["_display", "_theMap", "_mapSize"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; //TopBar diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index 910f422c75..8ab35bd2e5 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -3,10 +3,10 @@ * Updates the display (several times a second) called from the pfeh * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * [] call ace_microdagr_fnc_updateDisplay @@ -18,12 +18,8 @@ private ["_display", "_waypoints", "_posString", "_eastingText", "_northingText", "_numASL", "_aboveSeaLevelText", "_compassAngleText", "_targetPos", "_targetPosName", "_targetPosLocationASL", "_bearingText", "_rangeText", "_targetName", "_bearing", "_2dDistanceKm", "_SpeedText", "_playerPos2d", "_wpListBox", "_currentIndex", "_wpName", "_wpPos", "_settingListBox", "_yearString", "_monthSring", "_dayString"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; //Fade "shell" at night @@ -44,21 +40,21 @@ case (APP_MODE_INFODISPLAY): { (_display displayCtrl IDC_MODEDISPLAY_NORTHING) ctrlSetText _northingText; //Elevation: - _numASL = ((getPosASL ace_player) select 2) + EGVAR(common,mapAltitude); + _numASL = ((getPosASL ACE_player) select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; _aboveSeaLevelText = if (_numASL > 0) then {"+" + _aboveSeaLevelText + " MSL"} else {_aboveSeaLevelText + " MSL"}; (_display displayCtrl IDC_MODEDISPLAY_ELEVATIONNUM) ctrlSetText _aboveSeaLevelText; //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ace_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ace_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODEDISPLAY_HEADINGNUM) ctrlSetText _compassAngleText; //Speed: - (_display displayCtrl IDC_MODEDISPLAY_SPEEDNUM) ctrlSetText format ["%1kph", (round (speed (vehicle ace_player)))];; + (_display displayCtrl IDC_MODEDISPLAY_SPEEDNUM) ctrlSetText format ["%1kph", (round (speed (vehicle ACE_player)))];; if (GVAR(currentWaypoint) == -1) then { @@ -89,13 +85,13 @@ case (APP_MODE_INFODISPLAY): { }; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ACE_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = (((getPosASL ACE_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; _numASL = (_targetPosLocationASL select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; @@ -111,14 +107,14 @@ case (APP_MODE_INFODISPLAY): { case (APP_MODE_COMPASS): { //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ace_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ace_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODECOMPASS_HEADING) ctrlSetText _compassAngleText; //Speed: - _SpeedText = format ["%1kph", (round (speed (vehicle ace_player)))];; + _SpeedText = format ["%1kph", (round (speed (vehicle ACE_player)))];; (_display displayCtrl IDC_MODECOMPASS_SPEED) ctrlSetText _SpeedText; if (GVAR(currentWaypoint) == -1) then { @@ -126,7 +122,7 @@ case (APP_MODE_COMPASS): { (_display displayCtrl IDC_MODECOMPASS_RANGE) ctrlSetText ""; (_display displayCtrl IDC_MODECOMPASS_TARGET) ctrlSetText ""; } else { - _playerPos2d = (getPosASL ace_player) select [0,2]; + _playerPos2d = (getPosASL ACE_player) select [0,2]; _targetPosName = ""; _targetPosLocationASL = []; @@ -147,13 +143,13 @@ case (APP_MODE_COMPASS): { _rangeText = "---"; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ACE_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = (((getPosASL ACE_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; }; @@ -171,7 +167,7 @@ case (APP_MODE_WAYPOINTS): { { EXPLODE_2_PVT(_x,_wpName,_wpPos); _wpListBox lbAdd _wpName; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_wpPos select [0,2])) / 1000; + _2dDistanceKm = (((getPosASL ACE_player) select [0,2]) distance (_wpPos select [0,2])) / 1000; _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)])]; } forEach _waypoints; From 4cf81b493a1a2ba2ffbd248d790bc09b3dc120d3 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 26 Aug 2015 11:00:59 -0500 Subject: [PATCH 6/9] Fix stringtable and more cleanup --- addons/microdagr/CfgVehicles.hpp | 8 ++++---- .../microdagr/functions/fnc_appSettingsLBClick.sqf | 2 +- addons/microdagr/functions/fnc_mapButtonDownEH.sqf | 2 +- addons/microdagr/functions/fnc_moduleMapFill.sqf | 8 +++----- addons/microdagr/functions/fnc_openDisplay.sqf | 3 +-- addons/microdagr/functions/fnc_updateDisplay.sqf | 12 +++++------- addons/microdagr/stringtable.xml | 6 +++--- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/addons/microdagr/CfgVehicles.hpp b/addons/microdagr/CfgVehicles.hpp index 49f7a0e65c..ee16870fe0 100644 --- a/addons/microdagr/CfgVehicles.hpp +++ b/addons/microdagr/CfgVehicles.hpp @@ -37,7 +37,7 @@ class CfgVehicles { displayName = CSTRING(Module_DisplayName); function = QFUNC(moduleMapFill); scope = 2; - isGlobal = 1; + isGlobal = 0; icon = QUOTE(PATHTOF(UI\Icon_Module_microDAGR_ca.paa)); functionPriority = 0; class Arguments { @@ -46,9 +46,9 @@ class CfgVehicles { description = CSTRING(MapDataAvailable_Description); typeName = "NUMBER"; class values { - class None {name = CSTRING(None); value = MAP_DETAIL_SAT; default = 1;}; - class Side {name = CSTRING(Side); value = MAP_DETAIL_TOPOROADS;}; - class Unique {name = CSTRING(Unique); value = MAP_DETAIL_NONE;}; + class Full {name = CSTRING(MapFill_Full); value = MAP_DETAIL_SAT; default = 1;}; + class Roads {name = CSTRING(MapFill_OnlyRoads); value = MAP_DETAIL_TOPOROADS;}; + class Disabled {name = CSTRING(MapFill_None); value = MAP_DETAIL_NONE;}; }; }; }; diff --git a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf index 04f045171b..9e808559b2 100644 --- a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf +++ b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" disableSerialization; -params ["_control", "_itemClicked"]; +params ["", "_itemClicked"]; switch (_itemClicked) do { case (0): { GVAR(settingUseMils) = ! GVAR(settingUseMils)}; diff --git a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf index 8c564a7cfc..566f08dc66 100644 --- a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf +++ b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf @@ -19,7 +19,7 @@ */ #include "script_component.hpp" -params ["_theMap", "_mouseButton", "_xPos", "_yPos"]; +params ["", "_mouseButton"]; //Only handle RMB if (_mouseButton != 1) exitWith {}; diff --git a/addons/microdagr/functions/fnc_moduleMapFill.sqf b/addons/microdagr/functions/fnc_moduleMapFill.sqf index d88bc56e87..03089a4ff4 100644 --- a/addons/microdagr/functions/fnc_moduleMapFill.sqf +++ b/addons/microdagr/functions/fnc_moduleMapFill.sqf @@ -4,20 +4,18 @@ * * Arguments: * 0: logic - * 1: synced units-not used - * 2: Module Activated * * Return Value: * None * * Example: - * [module, [], true] call ace_microdagr_fnc_moduleMapFill + * [module] call ace_microdagr_fnc_moduleMapFill * * Public: No */ #include "script_component.hpp" if !(isServer) exitWith {}; -params ["_logic", "_syncedUnits", "_activated"]; +params ["_logic"]; -if (!_activated) exitWith {WARNING("Module Placed but not active");}; +[_logic, QGVAR(MapDataAvailable), "MapDataAvailable"] call EFUNC(common,readSettingFromModule); diff --git a/addons/microdagr/functions/fnc_openDisplay.sqf b/addons/microdagr/functions/fnc_openDisplay.sqf index c619890bf3..aa2db94827 100644 --- a/addons/microdagr/functions/fnc_openDisplay.sqf +++ b/addons/microdagr/functions/fnc_openDisplay.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_oldShowMode", "_args", "_pfID", "_player"]; +private ["_oldShowMode", "_args", "_player"]; params [["_newDisplayShowMode", -1, [-1]]]; _oldShowMode = GVAR(currentShowMode); @@ -30,7 +30,6 @@ if ((_newDisplayShowMode == DISPLAY_MODE_DISPLAY) && {!([DISPLAY_MODE_DISPLAY] c if ((_newDisplayShowMode == DISPLAY_MODE_DIALOG) && {!([DISPLAY_MODE_DIALOG] call FUNC(canShow))}) then {_newDisplayShowMode = DISPLAY_MODE_HIDDEN}; - //On first-startup if (GVAR(currentApplicationPage) == APP_MODE_NULL) then { GVAR(currentApplicationPage) = APP_MODE_INFODISPLAY; diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index 8ab35bd2e5..826ea55e6c 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_display", "_waypoints", "_posString", "_eastingText", "_northingText", "_numASL", "_aboveSeaLevelText", "_compassAngleText", "_targetPos", "_targetPosName", "_targetPosLocationASL", "_bearingText", "_rangeText", "_targetName", "_bearing", "_2dDistanceKm", "_SpeedText", "_playerPos2d", "_wpListBox", "_currentIndex", "_wpName", "_wpPos", "_settingListBox", "_yearString", "_monthSring", "_dayString"]; +private ["_display", "_waypoints", "_posString", "_eastingText", "_northingText", "_numASL", "_aboveSeaLevelText", "_compassAngleText", "_targetPos", "_targetPosName", "_targetPosLocationASL", "_bearingText", "_rangeText", "_targetName", "_bearing", "_2dDistanceKm", "_SpeedText", "_wpListBox", "_currentIndex", "_wpName", "_wpPos", "_settingListBox", "_yearString", "_monthSring", "_dayString", "_daylight"]; disableSerialization; _display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; @@ -91,7 +91,7 @@ case (APP_MODE_INFODISPLAY): { } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ACE_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; _numASL = (_targetPosLocationASL select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; @@ -122,8 +122,6 @@ case (APP_MODE_COMPASS): { (_display displayCtrl IDC_MODECOMPASS_RANGE) ctrlSetText ""; (_display displayCtrl IDC_MODECOMPASS_TARGET) ctrlSetText ""; } else { - _playerPos2d = (getPosASL ACE_player) select [0,2]; - _targetPosName = ""; _targetPosLocationASL = []; @@ -149,7 +147,7 @@ case (APP_MODE_COMPASS): { } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ACE_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; }; @@ -165,9 +163,9 @@ case (APP_MODE_WAYPOINTS): { lbClear _wpListBox; { - EXPLODE_2_PVT(_x,_wpName,_wpPos); + _x params ["_wpName", "_wpPos"]; _wpListBox lbAdd _wpName; - _2dDistanceKm = (((getPosASL ACE_player) select [0,2]) distance (_wpPos select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _wpPos) / 1000; _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)])]; } forEach _waypoints; diff --git a/addons/microdagr/stringtable.xml b/addons/microdagr/stringtable.xml index f28e3397c3..d3a955580a 100644 --- a/addons/microdagr/stringtable.xml +++ b/addons/microdagr/stringtable.xml @@ -325,7 +325,7 @@ Kolik informací je načteno do MicroDAGR? Quanta informação é preenchida no mapa do MicroDAGR - + Full Satellite + Buildings Pełna satelitarna + budynki Satelite completo + Edificios @@ -333,7 +333,7 @@ Satelit + Budovy Satélite completo + Edifícios - + Topographical + Roads Topograficzna + drogi Topografico + Carreteras @@ -341,7 +341,7 @@ Topografické + Cesty Topográfico + Estradas - + None (Cannot use map view) Żadna (wyłącza ekran mapy) Nada (No se puede el mapa) From cc70580a93a19f4ebc6642b70ef4a37adcc3ee7d Mon Sep 17 00:00:00 2001 From: jonpas Date: Wed, 26 Aug 2015 22:51:41 +0200 Subject: [PATCH 7/9] Improved comments --- addons/repair/functions/fnc_addRepairActions.sqf | 6 ++---- addons/repair/functions/fnc_canMiscRepair.sqf | 2 +- addons/repair/functions/fnc_doRepair.sqf | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index c47a9276f9..15cc0de881 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -81,12 +81,10 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; _hitpointGroupConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroups); _inHitpointSubGroup = false; if (isArray _hitpointGroupConfig) then { - // Loop through hitpoint groups + // Set variable if current hitpoint is in a sub-group (to be excluded from adding action) _currentHitpoint = _x; { - // Loop through sub-group { - // Current hitpoint is in a sub-group, set it so if (_x == _currentHitpoint) exitWith { _inHitpointSubGroup = true; }; @@ -94,7 +92,7 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; } forEach (getArray _hitpointGroupConfig); }; - // Exit if current hitpoint is not a group leader (only they get actions) + // Exit if current hitpoint is in sub-group (only main hitpoints get actions) if (_inHitpointSubGroup) exitWith {}; // exit if the hitpoint is virtual diff --git a/addons/repair/functions/fnc_canMiscRepair.sqf b/addons/repair/functions/fnc_canMiscRepair.sqf index 105235fa1e..c60e59c840 100644 --- a/addons/repair/functions/fnc_canMiscRepair.sqf +++ b/addons/repair/functions/fnc_canMiscRepair.sqf @@ -24,7 +24,7 @@ params ["_caller", "_target", "_hitPoint"]; _hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroups); _hitpointGroup = []; if (isArray _hitpointGroupConfig) then { - // Loop through hitpoint groups + // Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group { // Exit using found hitpoint group if this hitpoint is leader of any if (_x select 0 == _hitPoint) exitWith { diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index 14b828a67b..3b2b991de2 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -35,14 +35,12 @@ _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); _hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); _hitpointGroup = []; if (isArray _hitpointGroupConfig) then { - // Loop through hitpoint groups + // Retrieve group if current hitpoint is leader of any { - // Exit using found hitpoint group if this hitpoint is leader of any if (_x select 0 == _hitPoint) exitWith { ([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitpoints"]; - // Loop through the found group + // Set all sub-group hitpoints' damage to 0, if a hitpoint is invalid print RPT error { - // If hitpoint is valid set damage to 0, else print RPT error if (_x in _hitpoints) then { ["setVehicleHitPointDamage", _vehicle, [_vehicle, _x, 0]] call EFUNC(common,targetEvent); } else { From b6d5db9157ada1834f47e8d240ab5a76bfd20401 Mon Sep 17 00:00:00 2001 From: jonpas Date: Wed, 26 Aug 2015 23:09:04 +0200 Subject: [PATCH 8/9] Reverted IGNORED_HITPOINTS, Added Taru glasses to it --- addons/repair/functions/fnc_addRepairActions.sqf | 4 +++- addons/repair/script_component.hpp | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 15cc0de881..94ad9b204d 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -14,7 +14,6 @@ * Public: No */ #include "script_component.hpp" -#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] params ["_vehicle"]; TRACE_1("params", _vehicle); @@ -75,6 +74,9 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); } else { + // exit if the hitpoint is in the blacklist, e.g. glasses + if (_x in IGNORED_HITPOINTS) exitWith {}; + private ["_hitpointGroupConfig", "_inHitpointSubGroup", "_currentHitpoint"]; // Get hitpoint groups if available diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index 0714b1a568..89983dd0e8 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -10,3 +10,7 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + + +#define IGNORED_HITPOINTS ["HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6", "HitGlass7", "HitGlass8", "HitGlass9", "HitGlass10", "HitGlass11", "HitGlass12", "HitGlass13", "HitGlass14", "HitGlass15", "HitRGlass", "HitLGlass", "Glass_1_hitpoint", "Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"] +#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] From ce8da8d7203259dc99fac4820391a2c517adf588 Mon Sep 17 00:00:00 2001 From: jonpas Date: Wed, 26 Aug 2015 23:09:46 +0200 Subject: [PATCH 9/9] Fixed Full Repair available even when vehicle is already fully repaired --- addons/repair/ACE_Repair.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/repair/ACE_Repair.hpp b/addons/repair/ACE_Repair.hpp index c12566d5b1..4cfbb93e1f 100644 --- a/addons/repair/ACE_Repair.hpp +++ b/addons/repair/ACE_Repair.hpp @@ -63,7 +63,7 @@ class ACE_Repair { requiredEngineer = QGVAR(engineerSetting_fullRepair); repairLocations[] = {QGVAR(fullRepairLocation)}; repairingTime = 30; - condition = "damage (_this select 1) > 0"; + condition = "damage _target > 0"; callbackSuccess = QUOTE(call FUNC(doFullRepair)); }; };