From 64de91ed06fe5c4608fc3887a290a58a8caf3d41 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 18 Oct 2015 23:34:11 -0500 Subject: [PATCH] Add warning for duplicate setting modules. --- addons/captives/CfgVehicles.hpp | 1 + addons/cargo/CfgVehicles.hpp | 1 + addons/common/CfgVehicles.hpp | 1 + addons/common/functions/fnc_setSetting.sqf | 4 +++- addons/explosives/CfgModule.hpp | 1 + addons/finger/CfgVehicles.hpp | 1 + addons/hearing/CfgVehicles.hpp | 1 + addons/interaction/CfgVehicles.hpp | 1 + addons/map/CfgVehicles.hpp | 2 ++ addons/map_gestures/CfgVehicles.hpp | 1 + addons/medical/CfgVehicles.hpp | 3 +++ addons/medical_menu/CfgVehicles.hpp | 1 + addons/microdagr/CfgVehicles.hpp | 1 + addons/mk6mortar/CfgVehicles.hpp | 1 + addons/modules/XEH_postInit.sqf | 25 +++++++++++++--------- addons/nametags/CfgVehicles.hpp | 1 + addons/optionsmenu/CfgVehicles.hpp | 1 + addons/repair/CfgVehicles.hpp | 1 + addons/sitting/CfgVehicles.hpp | 1 + addons/vehiclelock/CfgVehicles.hpp | 1 + addons/viewdistance/CfgVehicles.hpp | 1 + addons/weather/CfgVehicles.hpp | 1 + addons/winddeflection/CfgVehicles.hpp | 1 + addons/zeus/CfgVehicles.hpp | 1 + 24 files changed, 43 insertions(+), 11 deletions(-) diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index afda86cfda..de6a757bf3 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -176,6 +176,7 @@ class CfgVehicles { scope = 2; icon = QUOTE(PATHTOF(UI\Icon_Module_settings_ca.paa)); isGlobal = 1; + isSingular = 1; class Arguments { class allowHandcuffOwnSide { displayName = CSTRING(ModuleSettings_handcuffSide_name); diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp index 111c4d9956..90fc439b60 100644 --- a/addons/cargo/CfgVehicles.hpp +++ b/addons/cargo/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QFUNC(moduleSettings); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); diff --git a/addons/common/CfgVehicles.hpp b/addons/common/CfgVehicles.hpp index 7c5c9295f9..de1f7f7cf4 100644 --- a/addons/common/CfgVehicles.hpp +++ b/addons/common/CfgVehicles.hpp @@ -35,6 +35,7 @@ class CfgVehicles { function = QFUNC(moduleCheckPBOs); scope = 2; isGlobal = 1; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_CheckPBO_ca.paa)); class Arguments { class Action { diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index 4162e7443f..e37f4b6ff7 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -25,7 +25,9 @@ params ["_name", "_value", ["_force", false], ["_broadcastChanges", false]]; local _settingData = [_name] call FUNC(getSettingData); // Exit if the setting does not exist -if (_settingData isEqualTo []) exitWith {}; +if (_settingData isEqualTo []) exitWith { + ACE_LOGERROR_1("SetSetting [%1] setting does not exist", _name); +}; _settingData params ["", "_typeName", "_isClientSetable", "", "", "", "_isForced"]; diff --git a/addons/explosives/CfgModule.hpp b/addons/explosives/CfgModule.hpp index a27efae704..b651903f59 100644 --- a/addons/explosives/CfgModule.hpp +++ b/addons/explosives/CfgModule.hpp @@ -6,6 +6,7 @@ class ACE_ModuleExplosive: ACE_Module { function = QUOTE(FUNC(module)); scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Explosives_ca.paa); class Arguments { class RequireSpecialist { diff --git a/addons/finger/CfgVehicles.hpp b/addons/finger/CfgVehicles.hpp index 99d9713f00..e78ef50123 100644 --- a/addons/finger/CfgVehicles.hpp +++ b/addons/finger/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { icon = QUOTE(PATHTOF(UI\Icon_Module_finger_ca.paa)); function = QFUNC(moduleSettings); isGlobal = 0; + isSingular = 1; author = ECSTRING(common,ACETeam); class Arguments { class enabled { diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 2273653c3a..72377ca970 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -101,6 +101,7 @@ class CfgVehicles { function = QFUNC(moduleHearing); scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa); class Arguments { class EnableCombatDeafness { diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 56fb06a85b..dfe4f2025e 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = "ACE_Interaction_fnc_moduleInteraction"; scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa); class Arguments { diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 7906de8bb7..720d4e8a7b 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -23,6 +23,7 @@ class CfgVehicles { function = QFUNC(moduleMap); scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Map_ca.paa); class Arguments { class MapIllumination { @@ -82,6 +83,7 @@ class CfgVehicles { function = QFUNC(blueForceTrackingModule); scope = 2; isGlobal = 0; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_BFTracking_ca.paa); class Arguments { class Enabled { diff --git a/addons/map_gestures/CfgVehicles.hpp b/addons/map_gestures/CfgVehicles.hpp index f5c2ae8f38..c03fb34992 100644 --- a/addons/map_gestures/CfgVehicles.hpp +++ b/addons/map_gestures/CfgVehicles.hpp @@ -6,6 +6,7 @@ class CfgVehicles { displayName = CSTRING(moduleSettings_displayName); function = QFUNC(moduleSettings); isGlobal = 0; + isSingular = 1; author = ECSTRING(common,ACETeam); icon = PATHTOF(ui\icon_module_map_gestures_ca.paa); class Arguments { diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 3a675e9258..351d285c7e 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -17,6 +17,7 @@ class CfgVehicles { function = QUOTE(DFUNC(moduleMedicalSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); @@ -153,6 +154,7 @@ class CfgVehicles { function = QUOTE(FUNC(moduleAdvancedMedicalSettings)); functionPriority = 10; isGlobal = 2; + isSingular = 1; isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); @@ -274,6 +276,7 @@ class CfgVehicles { function = QUOTE(DFUNC(moduleReviveSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); diff --git a/addons/medical_menu/CfgVehicles.hpp b/addons/medical_menu/CfgVehicles.hpp index 7bbe7db2ad..d2bbf55fd1 100644 --- a/addons/medical_menu/CfgVehicles.hpp +++ b/addons/medical_menu/CfgVehicles.hpp @@ -10,6 +10,7 @@ class CfgVehicles { function = QUOTE(DFUNC(module)); functionPriority = 1; isGlobal = 0; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/microdagr/CfgVehicles.hpp b/addons/microdagr/CfgVehicles.hpp index ee16870fe0..3fcf92beaa 100644 --- a/addons/microdagr/CfgVehicles.hpp +++ b/addons/microdagr/CfgVehicles.hpp @@ -38,6 +38,7 @@ class CfgVehicles { function = QFUNC(moduleMapFill); scope = 2; isGlobal = 0; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_microDAGR_ca.paa)); functionPriority = 0; class Arguments { diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp index b351e440b4..481687f89f 100644 --- a/addons/mk6mortar/CfgVehicles.hpp +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -52,6 +52,7 @@ class CfgVehicles { function = QFUNC(moduleInit); scope = 2; isGlobal = 0; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_mk6_ca.paa)); functionPriority = 0; class Arguments { diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index 62d16f42ce..d4857af57f 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -4,27 +4,32 @@ ["InitSettingsFromModules", { // TODO This is a basic and limited implementation that mimics some of the functionality from the A3 module framework, but not all of it. // We have to execute this in the postInit XEH because on object init, the parameters of the modules are not yet available. They are if we execute it at the start of postInit execution. + + local _uniqueModulesHandled = []; { [_x] call { - private ["_logic", "_logicType", "_config", "_isGlobal", "_isDisposable", "_isPersistent","_function"]; - _logic = _this select 0; - _logicType = typeof _logic; + params ["_logic"]; + local _logicType = typeof _logic; _logic hideobject true; if (_logic getvariable [QGVAR(initalized), false]) exitwith {}; - _config = (configFile >> "CfgVehicles" >> _logicType); + local _config = (configFile >> "CfgVehicles" >> _logicType); if !(isClass _config) exitwith {}; - // isGlobal = 1; - _isGlobal = getNumber (_config >> "isGlobal") > 0; - _isDisposable = getNumber (_config >> "isDisposable") > 0; - _isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1; - _function = getText (_config >> "function"); + local _isGlobal = getNumber (_config >> "isGlobal") > 0; + local _isDisposable = getNumber (_config >> "isDisposable") > 0; + local _isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1; + local _isSingular = getNumber (_config >> "isSingular") > 0; + local _function = getText (_config >> "function"); if (isnil _function) then { _function = compile _function; } else { _function = missionNamespace getvariable _function; }; + if (_isSingular && {_logicType in _uniqueModulesHandled}) then { //ToDo: should this be an exit? + ACE_LOGWARNING_1("Module [%1] - More than 1 singular module placed", _logicType); + }; + if (_isSingular) then {_uniqueModulesHandled pushBack _logicType;}; if (_isGlobal || isServer) then { [_logic, (synchronizedObjects _logic), true] call _function; @@ -38,7 +43,7 @@ deleteVehicle _logic; }; }; - }foreach GVAR(moduleInitCollection); + } forEach GVAR(moduleInitCollection); if (isServer) then { GVAR(serverModulesRead) = true; diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index f6e28095b4..7ca13b5aeb 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { function = QFUNC(moduleNameTags); scope = 2; isGlobal = 1; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_NameTags_ca.paa)); class Arguments { class showPlayerNames { diff --git a/addons/optionsmenu/CfgVehicles.hpp b/addons/optionsmenu/CfgVehicles.hpp index 1357417add..cbe03a4cfb 100644 --- a/addons/optionsmenu/CfgVehicles.hpp +++ b/addons/optionsmenu/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QUOTE(DFUNC(moduleAllowConfigExport)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index ee31e2c873..85abce4028 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -25,6 +25,7 @@ class CfgVehicles { function = QFUNC(moduleRepairSettings); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(Common,ACETeam); class Arguments { diff --git a/addons/sitting/CfgVehicles.hpp b/addons/sitting/CfgVehicles.hpp index 4ac0d0edb7..cb2422bd6d 100644 --- a/addons/sitting/CfgVehicles.hpp +++ b/addons/sitting/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { function = QFUNC(moduleInit); scope = 2; isGlobal = 1; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_Sitting_ca.paa)); class Arguments { class enable { diff --git a/addons/vehiclelock/CfgVehicles.hpp b/addons/vehiclelock/CfgVehicles.hpp index 9e6f155616..873c875f09 100644 --- a/addons/vehiclelock/CfgVehicles.hpp +++ b/addons/vehiclelock/CfgVehicles.hpp @@ -74,6 +74,7 @@ class CfgVehicles { function = QFUNC(moduleInit); scope = 2; isGlobal = 0; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_VehicleLock_ca.paa)); functionPriority = 0; class Arguments { diff --git a/addons/viewdistance/CfgVehicles.hpp b/addons/viewdistance/CfgVehicles.hpp index 8e4e30d266..86d906bfce 100644 --- a/addons/viewdistance/CfgVehicles.hpp +++ b/addons/viewdistance/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { displayName = CSTRING(Module_DisplayName); scope = 2; isGlobal = 1; + isSingular = 1; //icon = ""; // needs an icon class Arguments { class moduleViewDistanceEnabled { diff --git a/addons/weather/CfgVehicles.hpp b/addons/weather/CfgVehicles.hpp index ebdd65c30d..f37a62449a 100644 --- a/addons/weather/CfgVehicles.hpp +++ b/addons/weather/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QUOTE(DFUNC(initModuleSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/winddeflection/CfgVehicles.hpp b/addons/winddeflection/CfgVehicles.hpp index 2694bb1b34..c52949e1fc 100644 --- a/addons/winddeflection/CfgVehicles.hpp +++ b/addons/winddeflection/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QUOTE(DFUNC(initModuleSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 35c43b0e84..f5144e60e6 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -23,6 +23,7 @@ class CfgVehicles { function = QFUNC(moduleZeusSettings); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = "SilentSpike"; class Arguments {