Fix assigned items not being added properly to currentItems on loadout load

This commit is contained in:
Josuan Albin
2017-11-05 14:37:06 +01:00
parent 012d76813a
commit bc5eb7d02f
2 changed files with 47 additions and 2 deletions

View File

@ -1,5 +1,16 @@
/*
* Author: Alganthe
* Import loadout / default loadouts list from clipboard
*
* Arguments:
* 0: Display <DISPLAY>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#include "..\defines.hpp"
params ["_display"];
@ -76,6 +87,24 @@ if (GVAR(shiftState) && {is3DEN}) then {
};
};
{
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemMap") then {
GVAR(currentItems) set [10, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemCompass") then {
GVAR(currentItems) set [11, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemRadio") then {
GVAR(currentItems) set [12, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemWatch") then {
GVAR(currentItems) set [13, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemGPS") then {
GVAR(currentItems) set [14, _x];
};
} foreach (assignedItems GVAR(center));
// Reapply insignia
[GVAR(center), ""] call bis_fnc_setUnitInsignia;
[GVAR(center), GVAR(currentInsignia)] call bis_fnc_setUnitInsignia;
@ -85,4 +114,3 @@ if (GVAR(shiftState) && {is3DEN}) then {
[_display, "Loadout imported from clipboard"] call FUNC(message); // TBL
};
};

View File

@ -61,6 +61,23 @@ for "_index" from 0 to 15 do {
};
};
};
{
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemMap") then {
GVAR(currentItems) set [10, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemCompass") then {
GVAR(currentItems) set [11, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemRadio") then {
GVAR(currentItems) set [12, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemWatch") then {
GVAR(currentItems) set [13, _x];
};
if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemGPS") then {
GVAR(currentItems) set [14, _x];
};
} foreach (assignedItems GVAR(center));
// Reapply insignia
[GVAR(center), ""] call bis_fnc_setUnitInsignia;