From 7c41eb04e904c735aaebaa9be27962298373f339 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= <nicolas.d.badano@gmail.com>
Date: Sat, 17 Jan 2015 17:01:47 -0300
Subject: [PATCH 1/3] AGM_SafeMode pre CBA

---
 {TO_MERGE/agm/SafeMode => addons/safemode}/clientInit.sqf         | 0
 {TO_MERGE/agm/SafeMode => addons/safemode}/config.cpp             | 0
 .../agm/SafeMode => addons/safemode}/functions/fn_firstMode.sqf   | 0
 .../agm/SafeMode => addons/safemode}/functions/fn_lockSafety.sqf  | 0
 .../safemode}/functions/fn_playChangeFiremodeSound.sqf            | 0
 .../safemode}/functions/fn_setSafeModeVisual.sqf                  | 0
 .../SafeMode => addons/safemode}/functions/fn_unlockSafety.sqf    | 0
 {TO_MERGE/agm/SafeMode => addons/safemode}/stringtable.xml        | 0
 8 files changed, 0 insertions(+), 0 deletions(-)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/clientInit.sqf (100%)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/config.cpp (100%)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/functions/fn_firstMode.sqf (100%)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/functions/fn_lockSafety.sqf (100%)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/functions/fn_playChangeFiremodeSound.sqf (100%)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/functions/fn_setSafeModeVisual.sqf (100%)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/functions/fn_unlockSafety.sqf (100%)
 rename {TO_MERGE/agm/SafeMode => addons/safemode}/stringtable.xml (100%)

diff --git a/TO_MERGE/agm/SafeMode/clientInit.sqf b/addons/safemode/clientInit.sqf
similarity index 100%
rename from TO_MERGE/agm/SafeMode/clientInit.sqf
rename to addons/safemode/clientInit.sqf
diff --git a/TO_MERGE/agm/SafeMode/config.cpp b/addons/safemode/config.cpp
similarity index 100%
rename from TO_MERGE/agm/SafeMode/config.cpp
rename to addons/safemode/config.cpp
diff --git a/TO_MERGE/agm/SafeMode/functions/fn_firstMode.sqf b/addons/safemode/functions/fn_firstMode.sqf
similarity index 100%
rename from TO_MERGE/agm/SafeMode/functions/fn_firstMode.sqf
rename to addons/safemode/functions/fn_firstMode.sqf
diff --git a/TO_MERGE/agm/SafeMode/functions/fn_lockSafety.sqf b/addons/safemode/functions/fn_lockSafety.sqf
similarity index 100%
rename from TO_MERGE/agm/SafeMode/functions/fn_lockSafety.sqf
rename to addons/safemode/functions/fn_lockSafety.sqf
diff --git a/TO_MERGE/agm/SafeMode/functions/fn_playChangeFiremodeSound.sqf b/addons/safemode/functions/fn_playChangeFiremodeSound.sqf
similarity index 100%
rename from TO_MERGE/agm/SafeMode/functions/fn_playChangeFiremodeSound.sqf
rename to addons/safemode/functions/fn_playChangeFiremodeSound.sqf
diff --git a/TO_MERGE/agm/SafeMode/functions/fn_setSafeModeVisual.sqf b/addons/safemode/functions/fn_setSafeModeVisual.sqf
similarity index 100%
rename from TO_MERGE/agm/SafeMode/functions/fn_setSafeModeVisual.sqf
rename to addons/safemode/functions/fn_setSafeModeVisual.sqf
diff --git a/TO_MERGE/agm/SafeMode/functions/fn_unlockSafety.sqf b/addons/safemode/functions/fn_unlockSafety.sqf
similarity index 100%
rename from TO_MERGE/agm/SafeMode/functions/fn_unlockSafety.sqf
rename to addons/safemode/functions/fn_unlockSafety.sqf
diff --git a/TO_MERGE/agm/SafeMode/stringtable.xml b/addons/safemode/stringtable.xml
similarity index 100%
rename from TO_MERGE/agm/SafeMode/stringtable.xml
rename to addons/safemode/stringtable.xml

From 1c1216a05d0550db3db04a69ffbd2b05a999e6dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= <nicolas.d.badano@gmail.com>
Date: Sat, 17 Jan 2015 17:23:15 -0300
Subject: [PATCH 2/3] safemode: port

---
 addons/safemode/$PBOPREFIX$                   |  1 +
 addons/safemode/CfgEventHandlers.hpp          | 12 ++++
 addons/safemode/XEH_postInit.sqf              |  5 ++
 addons/safemode/XEH_preInit.sqf               |  7 ++
 addons/safemode/clientInit.sqf                |  5 --
 addons/safemode/config.cpp                    | 62 +++++++-----------
 addons/safemode/functions/fn_lockSafety.sqf   | 65 -------------------
 .../{fn_firstMode.sqf => fnc_firstMode.sqf}   |  6 +-
 addons/safemode/functions/fnc_lockSafety.sqf  | 63 ++++++++++++++++++
 ...nd.sqf => fnc_playChangeFiremodeSound.sqf} | 10 ++-
 ...deVisual.sqf => fnc_setSafeModeVisual.sqf} |  9 +--
 ..._unlockSafety.sqf => fnc_unlockSafety.sqf} | 26 ++++----
 addons/safemode/script_component.hpp          | 12 ++++
 addons/safemode/stringtable.xml               | 10 +--
 14 files changed, 151 insertions(+), 142 deletions(-)
 create mode 100644 addons/safemode/$PBOPREFIX$
 create mode 100644 addons/safemode/CfgEventHandlers.hpp
 create mode 100644 addons/safemode/XEH_postInit.sqf
 create mode 100644 addons/safemode/XEH_preInit.sqf
 delete mode 100644 addons/safemode/clientInit.sqf
 delete mode 100644 addons/safemode/functions/fn_lockSafety.sqf
 rename addons/safemode/functions/{fn_firstMode.sqf => fnc_firstMode.sqf} (62%)
 create mode 100644 addons/safemode/functions/fnc_lockSafety.sqf
 rename addons/safemode/functions/{fn_playChangeFiremodeSound.sqf => fnc_playChangeFiremodeSound.sqf} (87%)
 rename addons/safemode/functions/{fn_setSafeModeVisual.sqf => fnc_setSafeModeVisual.sqf} (77%)
 rename addons/safemode/functions/{fn_unlockSafety.sqf => fnc_unlockSafety.sqf} (59%)
 create mode 100644 addons/safemode/script_component.hpp

diff --git a/addons/safemode/$PBOPREFIX$ b/addons/safemode/$PBOPREFIX$
new file mode 100644
index 0000000000..361237305d
--- /dev/null
+++ b/addons/safemode/$PBOPREFIX$
@@ -0,0 +1 @@
+z\ace\addons\safemode
\ No newline at end of file
diff --git a/addons/safemode/CfgEventHandlers.hpp b/addons/safemode/CfgEventHandlers.hpp
new file mode 100644
index 0000000000..eefe61652b
--- /dev/null
+++ b/addons/safemode/CfgEventHandlers.hpp
@@ -0,0 +1,12 @@
+
+class Extended_PreInit_EventHandlers {
+    class ADDON {
+        init = QUOTE(call COMPILE_FILE(XEH_preInit) );
+    };
+};
+
+class Extended_PostInit_EventHandlers {
+    class ADDON {
+        clientInit = QUOTE( call COMPILE_FILE(XEH_postInit) );
+    };
+};
diff --git a/addons/safemode/XEH_postInit.sqf b/addons/safemode/XEH_postInit.sqf
new file mode 100644
index 0000000000..94e6b789bd
--- /dev/null
+++ b/addons/safemode/XEH_postInit.sqf
@@ -0,0 +1,5 @@
+
+// by commy2
+
+//["Soldier", {_player = ACE_player; if (currentWeapon _player in (_player getVariable [QGVAR(safedWeapons), []])) then {[false] call FUNC(setSafeModeVisual)}] call EFUNC(common,addInfoDisplayEventHandler);
+  //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
diff --git a/addons/safemode/XEH_preInit.sqf b/addons/safemode/XEH_preInit.sqf
new file mode 100644
index 0000000000..bc80c4269d
--- /dev/null
+++ b/addons/safemode/XEH_preInit.sqf
@@ -0,0 +1,7 @@
+#include "script_component.hpp"
+
+PREP(firstMode);
+PREP(lockSafety);
+PREP(playChangeFiremodeSound);
+PREP(setSafeModeVisual);
+PREP(unlockSafety);
diff --git a/addons/safemode/clientInit.sqf b/addons/safemode/clientInit.sqf
deleted file mode 100644
index 22440928b8..0000000000
--- a/addons/safemode/clientInit.sqf
+++ /dev/null
@@ -1,5 +0,0 @@
-
-// by commy2
-
-//["Soldier", {_player = AGM_player; if (currentWeapon _player in (_player getVariable ["AGM_SafeMode_safedWeapons", []])) then {[false] call AGM_SafeMode_setSafeModeVisual}] call AGM_Core_fnc_addInfoDisplayEventHandler;
-  //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
\ No newline at end of file
diff --git a/addons/safemode/config.cpp b/addons/safemode/config.cpp
index c8360c341d..899f271ce1 100644
--- a/addons/safemode/config.cpp
+++ b/addons/safemode/config.cpp
@@ -1,46 +1,28 @@
-// PATCH CONFIG
+#include "script_component.hpp"
+
 class CfgPatches {
-  class AGM_SafeMode {
-    units[] = {};
-    weapons[] = {};
-    requiredVersion = 0.60;
-    requiredAddons[] = {AGM_Core};
-    version = "0.95";
-    versionStr = "0.95";
-    versionAr[] = {0,95,0};
-    author[] = {"commy2"};
-    authorUrl = "https://github.com/commy2/";
-  };
-};
-
-class CfgFunctions {
-  class AGM_SafeMode {
-    class AGM_SafeMode {
-      file = "AGM_SafeMode\functions";
-      class firstMode;
-      class lockSafety;
-      class playChangeFiremodeSound;
-      class setSafeModeVisual;
-      class unlockSafety;
+    class ADDON {
+        units[] = {};
+        weapons[] = {};
+        requiredVersion = REQUIRED_VERSION;
+        requiredAddons[] = {"ace_common"};
+        author[] = {"commy2"};
+        authorUrl = "https://github.com/commy2/";
+        VERSION_CONFIG;
     };
-  };
 };
 
-class Extended_PostInit_EventHandlers {
-  class AGM_SafeMode {
-    clientInit = "call compile preprocessFileLineNumbers '\AGM_SafeMode\clientInit.sqf';";
-  };
-};
+#include "CfgEventHandlers.hpp"
 
-class AGM_Core_Default_Keys {
-  class safeWeapon {
-    displayName = "$STR_AGM_SafeMode_SafeMode";
-    condition = "[_player] call AGM_Core_fnc_canUseWeapon";
-    statement = "[_player, currentWeapon _player, currentMuzzle _player] call AGM_SafeMode_fnc_lockSafety";
-    exceptions[] = {"AGM_Interaction_isNotEscorting"};
-    key = 41;
-    shift = 0;
-    control = 1;
-    alt = 0;
-  };
+class ACE_Default_Keys {
+    class safeWeapon {
+        displayName = "$STR_ACE_SafeMode_SafeMode";
+        condition = QUOTE([_player] call EFUNC(core,canUseWeapon));
+        statement = QUOTE([ARR_3(_player, currentWeapon _player, currentMuzzle _player)] call FUNC(lockSafety));
+        exceptions[] = {"ACE_interaction_isNotEscorting"};
+        key = 41;
+        shift = 0;
+        control = 1;
+        alt = 0;
+    };
 };
diff --git a/addons/safemode/functions/fn_lockSafety.sqf b/addons/safemode/functions/fn_lockSafety.sqf
deleted file mode 100644
index cca54b51ab..0000000000
--- a/addons/safemode/functions/fn_lockSafety.sqf
+++ /dev/null
@@ -1,65 +0,0 @@
-// by commy2
-
-private ["_unit", "_weapon", "_muzzle", "_safedWeapons"];
-
-_unit = _this select 0;
-_weapon = _this select 1;
-_muzzle = _this select 2;
-
-// don't immediately switch back
-if (inputAction "nextWeapon" > 0) exitWith {};
-
-_safedWeapons = _unit getVariable ["AGM_SafeMode_safedWeapons", []];
-
-if (_weapon in _safedWeapons) exitWith {
-  _this call AGM_SafeMode_fnc_unlockSafety;
-};
-
-_safedWeapons pushBack _weapon;
-
-_unit setVariable ["AGM_SafeMode_safedWeapons", _safedWeapons];
-
-if (_unit getVariable ["AGM_SafeWeapon_actionID", -1] == -1) then {
-  private ["_condition", "_statement", "_id"];
-
-  _condition = {
-    if (
-      [_this select 1] call AGM_Core_fnc_canUseWeapon
-      && {
-        if (currentMuzzle (_this select 1) in ((_this select 1) getVariable ["AGM_SafeMode_safedWeapons", []])) then {
-          if (inputAction "nextWeapon" > 0) exitWith {
-            [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call AGM_SafeMode_fnc_unlockSafety;
-            false
-          };
-          true
-        } else {false}
-      }
-    ) then {
-      // player hud
-      [false] call AGM_SafeMode_fnc_setSafeModeVisual;
-      true
-    } else {
-      // player hud
-      [true] call AGM_SafeMode_fnc_setSafeModeVisual;
-      false
-    }
-  };
-
-  _statement = {
-    [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call AGM_SafeMode_fnc_unlockSafety;
-  };
-
-  //_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize "STR_AGM_SafeMode_TakeOffSafety"], "DefaultAction", _condition, {}, {true}, _statement, 10] call AGM_Core_fnc_addActionMenuEventHandler;
-  _id = [_unit, "DefaultAction", _condition, {}] call AGM_Core_fnc_addActionEventHandler;
-
-  _unit setVariable ["AGM_SafeWeapon_actionID", _id];
-};
-
-_unit selectWeapon _muzzle;//_weapon
-
-// play fire mode selector sound
-[_unit, _weapon, _muzzle] call AGM_SafeMode_fnc_playChangeFiremodeSound;
-
-private "_picture";
-_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
-[localize "STR_AGM_SafeMode_PutOnSafety", _picture] call AGM_Core_fnc_displayTextPicture;
diff --git a/addons/safemode/functions/fn_firstMode.sqf b/addons/safemode/functions/fnc_firstMode.sqf
similarity index 62%
rename from addons/safemode/functions/fn_firstMode.sqf
rename to addons/safemode/functions/fnc_firstMode.sqf
index 9e5644da15..821090dd32 100644
--- a/addons/safemode/functions/fn_firstMode.sqf
+++ b/addons/safemode/functions/fnc_firstMode.sqf
@@ -1,9 +1,9 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_weapon", "_mode"];
-
-_weapon = _this select 0;
+EXPLODE_1_PVT(_this,_weapon);
 
+private ["_mode"];
 _mode = getArray (configFile >> "CfgWeapons" >> _weapon >> "modes") select 0;
 
 [_mode, _weapon] select (_mode == "this")
diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf
new file mode 100644
index 0000000000..0e365fc221
--- /dev/null
+++ b/addons/safemode/functions/fnc_lockSafety.sqf
@@ -0,0 +1,63 @@
+// by commy2
+#include "script_component.hpp"
+
+EXPLODE_3_PVT(_this,_unit,_weapon,_muzzle);
+
+// don't immediately switch back
+if (inputAction "nextWeapon" > 0) exitWith {};
+
+private ["_safedWeapons"];
+_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
+
+if (_weapon in _safedWeapons) exitWith {
+  _this call FUNC(unlockSafety);
+};
+
+_safedWeapons pushBack _weapon;
+
+_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
+
+if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
+  private ["_condition", "_statement", "_id"];
+
+  _condition = {
+    if (
+      [_this select 1] call EFUNC(common,canUseWeapon)
+      && {
+        if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then {
+          if (inputAction "nextWeapon" > 0) exitWith {
+            [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
+            false
+          };
+          true
+        } else {false}
+      }
+    ) then {
+      // player hud
+      [false] call FUNC(setSafeModeVisual);
+      true
+    } else {
+      // player hud
+      [true] call FUNC(setSafeModeVisual);
+      false
+    }
+  };
+
+  _statement = {
+    [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
+  };
+
+  //_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize "STR_ACE_SafeMode_TakeOffSafety"], "DefaultAction", _condition, {}, {true}, _statement, 10] call EFUNC(common,addActionMenuEventHandler);
+  _id = [_unit, "DefaultAction", _condition, {}] call EFUNC(common,addActionEventHandler);
+
+  _unit setVariable [QGVAR(actionID), _id];
+};
+
+_unit selectWeapon _muzzle;//_weapon
+
+// play fire mode selector sound
+[_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
+
+private "_picture";
+_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
+[localize "STR_ACE_SafeMode_PutOnSafety", _picture] call EFUNC(common,displayTextPicture);
diff --git a/addons/safemode/functions/fn_playChangeFiremodeSound.sqf b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf
similarity index 87%
rename from addons/safemode/functions/fn_playChangeFiremodeSound.sqf
rename to addons/safemode/functions/fnc_playChangeFiremodeSound.sqf
index e8fecf4c13..c0b58604b9 100644
--- a/addons/safemode/functions/fn_playChangeFiremodeSound.sqf
+++ b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf
@@ -1,14 +1,13 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_unit", "_weapon", "_sound"];
-
-_unit = _this select 0;
-_weapon = _this select 1;
+EXPLODE_2_PVT(_this,_unit,_weapon);
 
+private ["_sound"];
 _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
 
 if (count _sound == 0) exitWith {
-  playSound "AGM_Sound_Click";
+  playSound "ACE_Sound_Click";
 };
 
 // add file extension
@@ -27,7 +26,6 @@ if (count _sound < 3) then {_sound pushBack 1};
 if (count _sound < 4) then {_sound pushBack 0};
 
 private "_position";
-
 _position = _unit modelToWorld (_unit selectionPosition "RightHand");
 _position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
 
diff --git a/addons/safemode/functions/fn_setSafeModeVisual.sqf b/addons/safemode/functions/fnc_setSafeModeVisual.sqf
similarity index 77%
rename from addons/safemode/functions/fn_setSafeModeVisual.sqf
rename to addons/safemode/functions/fnc_setSafeModeVisual.sqf
index 6ea156abe5..ae449e05e8 100644
--- a/addons/safemode/functions/fn_setSafeModeVisual.sqf
+++ b/addons/safemode/functions/fnc_setSafeModeVisual.sqf
@@ -1,11 +1,12 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_show", "_control"];
-
-_show = _this select 0;
+EXPLODE_1_PVT(_this,_show);
 
 disableSerialization;
-_control = (uiNamespace getVariable ["AGM_dlgSoldier", displayNull]) displayCtrl 187;
+
+private ["_control"];
+_control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl 187;
 
 if (isNull _control) exitWith {};
 
diff --git a/addons/safemode/functions/fn_unlockSafety.sqf b/addons/safemode/functions/fnc_unlockSafety.sqf
similarity index 59%
rename from addons/safemode/functions/fn_unlockSafety.sqf
rename to addons/safemode/functions/fnc_unlockSafety.sqf
index 89a8cc0206..341cad182f 100644
--- a/addons/safemode/functions/fn_unlockSafety.sqf
+++ b/addons/safemode/functions/fnc_unlockSafety.sqf
@@ -1,25 +1,23 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_unit", "_weapon", "_muzzle", "_safedWeapons"];
+EXPLODE_3_PVT(_this,_unit,_weapon,_muzzle);
 
-_unit = _this select 0;
-_weapon = _this select 1;
-_muzzle = _this select 2;
-
-_safedWeapons = _unit getVariable ["AGM_SafeMode_safedWeapons", []];
+private ["_safedWeapons"];
+_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
 
 if (_weapon in _safedWeapons) then {
   _safedWeapons = _safedWeapons - [_weapon];
 
-  _unit setVariable ["AGM_SafeMode_safedWeapons", _safedWeapons];
+  _unit setVariable [QGVAR(safedWeapons), _safedWeapons];
 
   if (count _safedWeapons == 0) then {
     private "_id";
-    _id = _unit getVariable ["AGM_SafeWeapon_actionID", -1];
+    _id = _unit getVariable [QGVAR(actionID), -1];
 
-    //[_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionMenuEventHandler;
-    [_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionEventHandler;
-    _unit setVariable ["AGM_SafeWeapon_actionID", -1];
+    //[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler);
+    [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
+    _unit setVariable [QGVAR(actionID), -1];
   };
 };
 
@@ -53,12 +51,12 @@ if (inputAction "nextWeapon" > 0) then {
   };
 } else {
   // play fire mode selector sound
-  [_unit, _weapon, _muzzle] call AGM_SafeMode_fnc_playChangeFiremodeSound;
+  [_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
 };
 
 // player hud
-[true] call AGM_SafeMode_fnc_setSafeModeVisual;
+[true] call FUNC(setSafeModeVisual);
 
 private "_picture";
 _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
-[localize "STR_AGM_SafeMode_TookOffSafety", _picture] call AGM_Core_fnc_displayTextPicture;
+[localize "STR_ACE_SafeMode_TookOffSafety", _picture] call EFUNC(common,displayTextPicture);
diff --git a/addons/safemode/script_component.hpp b/addons/safemode/script_component.hpp
new file mode 100644
index 0000000000..f76396afdf
--- /dev/null
+++ b/addons/safemode/script_component.hpp
@@ -0,0 +1,12 @@
+#define COMPONENT safemode
+#include "\z\ace\Addons\main\script_mod.hpp"
+
+#ifdef DEBUG_ENABLED_SAFEMODE
+	#define DEBUG_MODE_FULL
+#endif
+
+#ifdef DEBUG_SETTINGS_SAFEMODE
+	#define DEBUG_SETTINGS DEBUG_SETTINGS_SAFEMODE
+#endif
+
+#include "\z\ace\Addons\main\script_macros.hpp"
diff --git a/addons/safemode/stringtable.xml b/addons/safemode/stringtable.xml
index ff3415831d..9684babfdf 100644
--- a/addons/safemode/stringtable.xml
+++ b/addons/safemode/stringtable.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- Edited with tabler - 2014-12-20 -->
-<Project name="AGM">
+<Project name="ACE">
   <Package name="SafeMode">
-    <Key ID="STR_AGM_SafeMode_SafeMode">
+    <Key ID="STR_ACE_SafeMode_SafeMode">
       <English>Safe Mode</English>
       <German>Waffe sichern</German>
       <Spanish>Seguro puesto</Spanish>
@@ -11,7 +11,7 @@
       <Hungarian>Veszélytelenités</Hungarian>
       <Russian>Предохранитель</Russian>
     </Key>
-    <Key ID="STR_AGM_SafeMode_TakeOffSafety">
+    <Key ID="STR_ACE_SafeMode_TakeOffSafety">
       <English>Take off Safety</English>
       <German>Waffe entsichern</German>
       <Spanish>Quitar seguro</Spanish>
@@ -20,7 +20,7 @@
       <Hungarian>Veszélyesités</Hungarian>
       <Russian>Снять с предохранителя</Russian>
     </Key>
-    <Key ID="STR_AGM_SafeMode_PutOnSafety">
+    <Key ID="STR_ACE_SafeMode_PutOnSafety">
       <English>Put on Safety</English>
       <German>Waffe gesichert</German>
       <Spanish>Poner seguro</Spanish>
@@ -29,7 +29,7 @@
       <Hungarian>Veszélytelenitve</Hungarian>
       <Russian>Поставить на предохранитель</Russian>
     </Key>
-    <Key ID="STR_AGM_SafeMode_TookOffSafety">
+    <Key ID="STR_ACE_SafeMode_TookOffSafety">
       <English>Took off Safety</English>
       <German>Waffe entsichert</German>
       <Spanish>Seguro quitado</Spanish>

From 9247bb3411e351bba0885f430b2a2d0429f4ae13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= <nicolas.d.badano@gmail.com>
Date: Sat, 17 Jan 2015 17:32:34 -0300
Subject: [PATCH 3/3] safemode: port

---
 addons/safemode/$PBOPREFIX$                   |  1 +
 addons/safemode/CfgEventHandlers.hpp          | 12 ++++
 addons/safemode/XEH_postInit.sqf              |  5 ++
 addons/safemode/XEH_preInit.sqf               |  7 ++
 addons/safemode/clientInit.sqf                |  5 --
 addons/safemode/config.cpp                    | 62 +++++++-----------
 addons/safemode/functions/fn_lockSafety.sqf   | 65 -------------------
 .../{fn_firstMode.sqf => fnc_firstMode.sqf}   |  6 +-
 addons/safemode/functions/fnc_lockSafety.sqf  | 63 ++++++++++++++++++
 ...nd.sqf => fnc_playChangeFiremodeSound.sqf} | 10 ++-
 ...deVisual.sqf => fnc_setSafeModeVisual.sqf} |  9 +--
 ..._unlockSafety.sqf => fnc_unlockSafety.sqf} | 26 ++++----
 .../safemode/functions/script_component.hpp   |  1 +
 addons/safemode/script_component.hpp          | 12 ++++
 addons/safemode/stringtable.xml               | 10 +--
 15 files changed, 152 insertions(+), 142 deletions(-)
 create mode 100644 addons/safemode/$PBOPREFIX$
 create mode 100644 addons/safemode/CfgEventHandlers.hpp
 create mode 100644 addons/safemode/XEH_postInit.sqf
 create mode 100644 addons/safemode/XEH_preInit.sqf
 delete mode 100644 addons/safemode/clientInit.sqf
 delete mode 100644 addons/safemode/functions/fn_lockSafety.sqf
 rename addons/safemode/functions/{fn_firstMode.sqf => fnc_firstMode.sqf} (62%)
 create mode 100644 addons/safemode/functions/fnc_lockSafety.sqf
 rename addons/safemode/functions/{fn_playChangeFiremodeSound.sqf => fnc_playChangeFiremodeSound.sqf} (87%)
 rename addons/safemode/functions/{fn_setSafeModeVisual.sqf => fnc_setSafeModeVisual.sqf} (77%)
 rename addons/safemode/functions/{fn_unlockSafety.sqf => fnc_unlockSafety.sqf} (59%)
 create mode 100644 addons/safemode/functions/script_component.hpp
 create mode 100644 addons/safemode/script_component.hpp

diff --git a/addons/safemode/$PBOPREFIX$ b/addons/safemode/$PBOPREFIX$
new file mode 100644
index 0000000000..361237305d
--- /dev/null
+++ b/addons/safemode/$PBOPREFIX$
@@ -0,0 +1 @@
+z\ace\addons\safemode
\ No newline at end of file
diff --git a/addons/safemode/CfgEventHandlers.hpp b/addons/safemode/CfgEventHandlers.hpp
new file mode 100644
index 0000000000..eefe61652b
--- /dev/null
+++ b/addons/safemode/CfgEventHandlers.hpp
@@ -0,0 +1,12 @@
+
+class Extended_PreInit_EventHandlers {
+    class ADDON {
+        init = QUOTE(call COMPILE_FILE(XEH_preInit) );
+    };
+};
+
+class Extended_PostInit_EventHandlers {
+    class ADDON {
+        clientInit = QUOTE( call COMPILE_FILE(XEH_postInit) );
+    };
+};
diff --git a/addons/safemode/XEH_postInit.sqf b/addons/safemode/XEH_postInit.sqf
new file mode 100644
index 0000000000..94e6b789bd
--- /dev/null
+++ b/addons/safemode/XEH_postInit.sqf
@@ -0,0 +1,5 @@
+
+// by commy2
+
+//["Soldier", {_player = ACE_player; if (currentWeapon _player in (_player getVariable [QGVAR(safedWeapons), []])) then {[false] call FUNC(setSafeModeVisual)}] call EFUNC(common,addInfoDisplayEventHandler);
+  //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
diff --git a/addons/safemode/XEH_preInit.sqf b/addons/safemode/XEH_preInit.sqf
new file mode 100644
index 0000000000..bc80c4269d
--- /dev/null
+++ b/addons/safemode/XEH_preInit.sqf
@@ -0,0 +1,7 @@
+#include "script_component.hpp"
+
+PREP(firstMode);
+PREP(lockSafety);
+PREP(playChangeFiremodeSound);
+PREP(setSafeModeVisual);
+PREP(unlockSafety);
diff --git a/addons/safemode/clientInit.sqf b/addons/safemode/clientInit.sqf
deleted file mode 100644
index 22440928b8..0000000000
--- a/addons/safemode/clientInit.sqf
+++ /dev/null
@@ -1,5 +0,0 @@
-
-// by commy2
-
-//["Soldier", {_player = AGM_player; if (currentWeapon _player in (_player getVariable ["AGM_SafeMode_safedWeapons", []])) then {[false] call AGM_SafeMode_setSafeModeVisual}] call AGM_Core_fnc_addInfoDisplayEventHandler;
-  //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
\ No newline at end of file
diff --git a/addons/safemode/config.cpp b/addons/safemode/config.cpp
index c8360c341d..d61a386e20 100644
--- a/addons/safemode/config.cpp
+++ b/addons/safemode/config.cpp
@@ -1,46 +1,28 @@
-// PATCH CONFIG
+#include "script_component.hpp"
+
 class CfgPatches {
-  class AGM_SafeMode {
-    units[] = {};
-    weapons[] = {};
-    requiredVersion = 0.60;
-    requiredAddons[] = {AGM_Core};
-    version = "0.95";
-    versionStr = "0.95";
-    versionAr[] = {0,95,0};
-    author[] = {"commy2"};
-    authorUrl = "https://github.com/commy2/";
-  };
-};
-
-class CfgFunctions {
-  class AGM_SafeMode {
-    class AGM_SafeMode {
-      file = "AGM_SafeMode\functions";
-      class firstMode;
-      class lockSafety;
-      class playChangeFiremodeSound;
-      class setSafeModeVisual;
-      class unlockSafety;
+    class ADDON {
+        units[] = {};
+        weapons[] = {};
+        requiredVersion = REQUIRED_VERSION;
+        requiredAddons[] = {"ace_common"};
+        author[] = {"commy2"};
+        authorUrl = "https://github.com/commy2/";
+        VERSION_CONFIG;
     };
-  };
 };
 
-class Extended_PostInit_EventHandlers {
-  class AGM_SafeMode {
-    clientInit = "call compile preprocessFileLineNumbers '\AGM_SafeMode\clientInit.sqf';";
-  };
-};
+#include "CfgEventHandlers.hpp"
 
-class AGM_Core_Default_Keys {
-  class safeWeapon {
-    displayName = "$STR_AGM_SafeMode_SafeMode";
-    condition = "[_player] call AGM_Core_fnc_canUseWeapon";
-    statement = "[_player, currentWeapon _player, currentMuzzle _player] call AGM_SafeMode_fnc_lockSafety";
-    exceptions[] = {"AGM_Interaction_isNotEscorting"};
-    key = 41;
-    shift = 0;
-    control = 1;
-    alt = 0;
-  };
+class ACE_Default_Keys {
+    class safeWeapon {
+        displayName = "$STR_ACE_SafeMode_SafeMode";
+        condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
+        statement = QUOTE([ARR_3(_player, currentWeapon _player, currentMuzzle _player)] call FUNC(lockSafety));
+        exceptions[] = {"ACE_interaction_isNotEscorting"};
+        key = 41;
+        shift = 0;
+        control = 1;
+        alt = 0;
+    };
 };
diff --git a/addons/safemode/functions/fn_lockSafety.sqf b/addons/safemode/functions/fn_lockSafety.sqf
deleted file mode 100644
index cca54b51ab..0000000000
--- a/addons/safemode/functions/fn_lockSafety.sqf
+++ /dev/null
@@ -1,65 +0,0 @@
-// by commy2
-
-private ["_unit", "_weapon", "_muzzle", "_safedWeapons"];
-
-_unit = _this select 0;
-_weapon = _this select 1;
-_muzzle = _this select 2;
-
-// don't immediately switch back
-if (inputAction "nextWeapon" > 0) exitWith {};
-
-_safedWeapons = _unit getVariable ["AGM_SafeMode_safedWeapons", []];
-
-if (_weapon in _safedWeapons) exitWith {
-  _this call AGM_SafeMode_fnc_unlockSafety;
-};
-
-_safedWeapons pushBack _weapon;
-
-_unit setVariable ["AGM_SafeMode_safedWeapons", _safedWeapons];
-
-if (_unit getVariable ["AGM_SafeWeapon_actionID", -1] == -1) then {
-  private ["_condition", "_statement", "_id"];
-
-  _condition = {
-    if (
-      [_this select 1] call AGM_Core_fnc_canUseWeapon
-      && {
-        if (currentMuzzle (_this select 1) in ((_this select 1) getVariable ["AGM_SafeMode_safedWeapons", []])) then {
-          if (inputAction "nextWeapon" > 0) exitWith {
-            [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call AGM_SafeMode_fnc_unlockSafety;
-            false
-          };
-          true
-        } else {false}
-      }
-    ) then {
-      // player hud
-      [false] call AGM_SafeMode_fnc_setSafeModeVisual;
-      true
-    } else {
-      // player hud
-      [true] call AGM_SafeMode_fnc_setSafeModeVisual;
-      false
-    }
-  };
-
-  _statement = {
-    [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call AGM_SafeMode_fnc_unlockSafety;
-  };
-
-  //_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize "STR_AGM_SafeMode_TakeOffSafety"], "DefaultAction", _condition, {}, {true}, _statement, 10] call AGM_Core_fnc_addActionMenuEventHandler;
-  _id = [_unit, "DefaultAction", _condition, {}] call AGM_Core_fnc_addActionEventHandler;
-
-  _unit setVariable ["AGM_SafeWeapon_actionID", _id];
-};
-
-_unit selectWeapon _muzzle;//_weapon
-
-// play fire mode selector sound
-[_unit, _weapon, _muzzle] call AGM_SafeMode_fnc_playChangeFiremodeSound;
-
-private "_picture";
-_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
-[localize "STR_AGM_SafeMode_PutOnSafety", _picture] call AGM_Core_fnc_displayTextPicture;
diff --git a/addons/safemode/functions/fn_firstMode.sqf b/addons/safemode/functions/fnc_firstMode.sqf
similarity index 62%
rename from addons/safemode/functions/fn_firstMode.sqf
rename to addons/safemode/functions/fnc_firstMode.sqf
index 9e5644da15..821090dd32 100644
--- a/addons/safemode/functions/fn_firstMode.sqf
+++ b/addons/safemode/functions/fnc_firstMode.sqf
@@ -1,9 +1,9 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_weapon", "_mode"];
-
-_weapon = _this select 0;
+EXPLODE_1_PVT(_this,_weapon);
 
+private ["_mode"];
 _mode = getArray (configFile >> "CfgWeapons" >> _weapon >> "modes") select 0;
 
 [_mode, _weapon] select (_mode == "this")
diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf
new file mode 100644
index 0000000000..0e365fc221
--- /dev/null
+++ b/addons/safemode/functions/fnc_lockSafety.sqf
@@ -0,0 +1,63 @@
+// by commy2
+#include "script_component.hpp"
+
+EXPLODE_3_PVT(_this,_unit,_weapon,_muzzle);
+
+// don't immediately switch back
+if (inputAction "nextWeapon" > 0) exitWith {};
+
+private ["_safedWeapons"];
+_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
+
+if (_weapon in _safedWeapons) exitWith {
+  _this call FUNC(unlockSafety);
+};
+
+_safedWeapons pushBack _weapon;
+
+_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
+
+if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
+  private ["_condition", "_statement", "_id"];
+
+  _condition = {
+    if (
+      [_this select 1] call EFUNC(common,canUseWeapon)
+      && {
+        if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then {
+          if (inputAction "nextWeapon" > 0) exitWith {
+            [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
+            false
+          };
+          true
+        } else {false}
+      }
+    ) then {
+      // player hud
+      [false] call FUNC(setSafeModeVisual);
+      true
+    } else {
+      // player hud
+      [true] call FUNC(setSafeModeVisual);
+      false
+    }
+  };
+
+  _statement = {
+    [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
+  };
+
+  //_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize "STR_ACE_SafeMode_TakeOffSafety"], "DefaultAction", _condition, {}, {true}, _statement, 10] call EFUNC(common,addActionMenuEventHandler);
+  _id = [_unit, "DefaultAction", _condition, {}] call EFUNC(common,addActionEventHandler);
+
+  _unit setVariable [QGVAR(actionID), _id];
+};
+
+_unit selectWeapon _muzzle;//_weapon
+
+// play fire mode selector sound
+[_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
+
+private "_picture";
+_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
+[localize "STR_ACE_SafeMode_PutOnSafety", _picture] call EFUNC(common,displayTextPicture);
diff --git a/addons/safemode/functions/fn_playChangeFiremodeSound.sqf b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf
similarity index 87%
rename from addons/safemode/functions/fn_playChangeFiremodeSound.sqf
rename to addons/safemode/functions/fnc_playChangeFiremodeSound.sqf
index e8fecf4c13..c0b58604b9 100644
--- a/addons/safemode/functions/fn_playChangeFiremodeSound.sqf
+++ b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf
@@ -1,14 +1,13 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_unit", "_weapon", "_sound"];
-
-_unit = _this select 0;
-_weapon = _this select 1;
+EXPLODE_2_PVT(_this,_unit,_weapon);
 
+private ["_sound"];
 _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
 
 if (count _sound == 0) exitWith {
-  playSound "AGM_Sound_Click";
+  playSound "ACE_Sound_Click";
 };
 
 // add file extension
@@ -27,7 +26,6 @@ if (count _sound < 3) then {_sound pushBack 1};
 if (count _sound < 4) then {_sound pushBack 0};
 
 private "_position";
-
 _position = _unit modelToWorld (_unit selectionPosition "RightHand");
 _position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
 
diff --git a/addons/safemode/functions/fn_setSafeModeVisual.sqf b/addons/safemode/functions/fnc_setSafeModeVisual.sqf
similarity index 77%
rename from addons/safemode/functions/fn_setSafeModeVisual.sqf
rename to addons/safemode/functions/fnc_setSafeModeVisual.sqf
index 6ea156abe5..ae449e05e8 100644
--- a/addons/safemode/functions/fn_setSafeModeVisual.sqf
+++ b/addons/safemode/functions/fnc_setSafeModeVisual.sqf
@@ -1,11 +1,12 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_show", "_control"];
-
-_show = _this select 0;
+EXPLODE_1_PVT(_this,_show);
 
 disableSerialization;
-_control = (uiNamespace getVariable ["AGM_dlgSoldier", displayNull]) displayCtrl 187;
+
+private ["_control"];
+_control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl 187;
 
 if (isNull _control) exitWith {};
 
diff --git a/addons/safemode/functions/fn_unlockSafety.sqf b/addons/safemode/functions/fnc_unlockSafety.sqf
similarity index 59%
rename from addons/safemode/functions/fn_unlockSafety.sqf
rename to addons/safemode/functions/fnc_unlockSafety.sqf
index 89a8cc0206..341cad182f 100644
--- a/addons/safemode/functions/fn_unlockSafety.sqf
+++ b/addons/safemode/functions/fnc_unlockSafety.sqf
@@ -1,25 +1,23 @@
 // by commy2
+#include "script_component.hpp"
 
-private ["_unit", "_weapon", "_muzzle", "_safedWeapons"];
+EXPLODE_3_PVT(_this,_unit,_weapon,_muzzle);
 
-_unit = _this select 0;
-_weapon = _this select 1;
-_muzzle = _this select 2;
-
-_safedWeapons = _unit getVariable ["AGM_SafeMode_safedWeapons", []];
+private ["_safedWeapons"];
+_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
 
 if (_weapon in _safedWeapons) then {
   _safedWeapons = _safedWeapons - [_weapon];
 
-  _unit setVariable ["AGM_SafeMode_safedWeapons", _safedWeapons];
+  _unit setVariable [QGVAR(safedWeapons), _safedWeapons];
 
   if (count _safedWeapons == 0) then {
     private "_id";
-    _id = _unit getVariable ["AGM_SafeWeapon_actionID", -1];
+    _id = _unit getVariable [QGVAR(actionID), -1];
 
-    //[_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionMenuEventHandler;
-    [_unit, "DefaultAction", _id] call AGM_Core_fnc_removeActionEventHandler;
-    _unit setVariable ["AGM_SafeWeapon_actionID", -1];
+    //[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler);
+    [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
+    _unit setVariable [QGVAR(actionID), -1];
   };
 };
 
@@ -53,12 +51,12 @@ if (inputAction "nextWeapon" > 0) then {
   };
 } else {
   // play fire mode selector sound
-  [_unit, _weapon, _muzzle] call AGM_SafeMode_fnc_playChangeFiremodeSound;
+  [_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
 };
 
 // player hud
-[true] call AGM_SafeMode_fnc_setSafeModeVisual;
+[true] call FUNC(setSafeModeVisual);
 
 private "_picture";
 _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
-[localize "STR_AGM_SafeMode_TookOffSafety", _picture] call AGM_Core_fnc_displayTextPicture;
+[localize "STR_ACE_SafeMode_TookOffSafety", _picture] call EFUNC(common,displayTextPicture);
diff --git a/addons/safemode/functions/script_component.hpp b/addons/safemode/functions/script_component.hpp
new file mode 100644
index 0000000000..a25fbfa4c7
--- /dev/null
+++ b/addons/safemode/functions/script_component.hpp
@@ -0,0 +1 @@
+#include "\z\ace\addons\safemode\script_component.hpp"
\ No newline at end of file
diff --git a/addons/safemode/script_component.hpp b/addons/safemode/script_component.hpp
new file mode 100644
index 0000000000..f76396afdf
--- /dev/null
+++ b/addons/safemode/script_component.hpp
@@ -0,0 +1,12 @@
+#define COMPONENT safemode
+#include "\z\ace\Addons\main\script_mod.hpp"
+
+#ifdef DEBUG_ENABLED_SAFEMODE
+	#define DEBUG_MODE_FULL
+#endif
+
+#ifdef DEBUG_SETTINGS_SAFEMODE
+	#define DEBUG_SETTINGS DEBUG_SETTINGS_SAFEMODE
+#endif
+
+#include "\z\ace\Addons\main\script_macros.hpp"
diff --git a/addons/safemode/stringtable.xml b/addons/safemode/stringtable.xml
index ff3415831d..9684babfdf 100644
--- a/addons/safemode/stringtable.xml
+++ b/addons/safemode/stringtable.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- Edited with tabler - 2014-12-20 -->
-<Project name="AGM">
+<Project name="ACE">
   <Package name="SafeMode">
-    <Key ID="STR_AGM_SafeMode_SafeMode">
+    <Key ID="STR_ACE_SafeMode_SafeMode">
       <English>Safe Mode</English>
       <German>Waffe sichern</German>
       <Spanish>Seguro puesto</Spanish>
@@ -11,7 +11,7 @@
       <Hungarian>Veszélytelenités</Hungarian>
       <Russian>Предохранитель</Russian>
     </Key>
-    <Key ID="STR_AGM_SafeMode_TakeOffSafety">
+    <Key ID="STR_ACE_SafeMode_TakeOffSafety">
       <English>Take off Safety</English>
       <German>Waffe entsichern</German>
       <Spanish>Quitar seguro</Spanish>
@@ -20,7 +20,7 @@
       <Hungarian>Veszélyesités</Hungarian>
       <Russian>Снять с предохранителя</Russian>
     </Key>
-    <Key ID="STR_AGM_SafeMode_PutOnSafety">
+    <Key ID="STR_ACE_SafeMode_PutOnSafety">
       <English>Put on Safety</English>
       <German>Waffe gesichert</German>
       <Spanish>Poner seguro</Spanish>
@@ -29,7 +29,7 @@
       <Hungarian>Veszélytelenitve</Hungarian>
       <Russian>Поставить на предохранитель</Russian>
     </Key>
-    <Key ID="STR_AGM_SafeMode_TookOffSafety">
+    <Key ID="STR_ACE_SafeMode_TookOffSafety">
       <English>Took off Safety</English>
       <German>Waffe entsichert</German>
       <Spanish>Seguro quitado</Spanish>