mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Move GVAR(sharedLoadoutsVars) to sharedLoadoutsNamespace
This commit is contained in:
parent
8097483da6
commit
1447cda75c
@ -41,15 +41,14 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||
|
||||
private _profileName = profileName; // GVAR(center) could be a remote unit
|
||||
private _loadoutVar = _profileName + _loadoutName;
|
||||
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
|
||||
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||
GVAR(sharedLoadoutsVars) = GVAR(sharedLoadoutsVars) - [_loadoutVar];
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsNamespace), _sharedLoadoutsVars - [_loadoutVar], true];
|
||||
|
||||
_contentPanelCtrl lnbDeleteRow _contentPanelCursSel;
|
||||
_contentPanelCtrl lnbSetCurSelRow (_contentPanelCursSel);
|
||||
|
||||
publicVariable QGVAR(sharedLoadoutsVars);
|
||||
|
||||
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
||||
|
||||
[(findDisplay IDD_ace_arsenal), [localize LSTRING(loadoutUnshared), _loadoutName] joinString " "] call FUNC(message);
|
||||
|
@ -34,11 +34,14 @@ private _curSelLoadout = (_contentPanelCtrl getVariable (_loadoutName + str GVAR
|
||||
private _loadout = getUnitLoadout GVAR(center);
|
||||
|
||||
private _sameNameLoadoutsList = _data select {_x select 0 == _editBoxContent};
|
||||
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
|
||||
|
||||
private _similarSharedLoadout = (profileName + _editBoxContent) in GVAR(sharedLoadoutsVars);
|
||||
// Make sure the loadout isn't yours (public tab) or being shared (my loadouts tab)
|
||||
private _similarSharedLoadout = (profileName + _editBoxContent) in _sharedLoadoutsVars;
|
||||
if ((_contentPanelCtrl lnbText [_cursSelRow, 0]) == profileName) exitWith {
|
||||
[(findDisplay IDD_ace_arsenal), localize LSTRING(saveAuthorError)] call FUNC(message);
|
||||
};
|
||||
|
||||
if (_similarSharedLoadout) exitWith {
|
||||
[(findDisplay IDD_ace_arsenal), localize LSTRING(saveSharedError)] call FUNC(message);
|
||||
};
|
||||
@ -187,14 +190,7 @@ switch (GVAR(currentLoadoutsTab)) do {
|
||||
|
||||
private _newRow = _contentPanelCtrl lnbAddRow ["",_editBoxContent];
|
||||
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadout select 1) select 0) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadout select 2) select 0) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 5], getText (configFile >> "cfgWeapons" >> ((_loadout select 3) select 0) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadout select 4) select 0) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadout select 5) select 0) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
|
||||
ADD_LOADOUTS_LIST_PICTURES
|
||||
|
||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), [_loadout] call FUNC(verifyLoadout)];
|
||||
|
||||
|
@ -23,30 +23,33 @@ private _contentPanelCursSel = lnbCurSelRow _contentPanelCtrl;
|
||||
private _loadoutName = _contentPanelCtrl lnbText [_contentPanelCursSel, 1];
|
||||
private _profileName = profileName; // GVAR(center) could be a remote unit
|
||||
private _loadoutVar = _profileName + _loadoutName;
|
||||
private _sharedLoadoutsVars = +(GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars));
|
||||
|
||||
private _loadoutIndex = GVAR(sharedLoadoutsVars) find _loadoutVar;
|
||||
private _loadoutIndex = _sharedLoadoutsVars find _loadoutVar;
|
||||
private _loadoutData = (_contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab))) select 0;
|
||||
|
||||
// Loadout set to private
|
||||
if (_loadoutIndex > -1) then {
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||
GVAR(sharedLoadoutsVars) = GVAR(sharedLoadoutsVars) - [_loadoutVar];
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars - [_loadoutVar], true];
|
||||
|
||||
_contentPanelCtrl lnbSetPicture [[_contentPanelCursSel, 0], QPATHTOF(data\iconPublicBlank.paa)];
|
||||
_contentPanelCtrl lnbSetValue [[_contentPanelCursSel, 0], 0];
|
||||
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
||||
|
||||
// Loadout set to public
|
||||
} else {
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, [_profileName ,_loadoutName , _loadoutData], true];
|
||||
GVAR(sharedLoadoutsVars) pushBackUnique _loadoutVar;
|
||||
_sharedLoadoutsVars pushBackUnique _loadoutVar;
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), _sharedLoadoutsVars, true];
|
||||
|
||||
_contentPanelCtrl lnbSetPicture [[_contentPanelCursSel, 0], QPATHTOF(data\iconPublic.paa)];
|
||||
_contentPanelCtrl lnbSetValue [[_contentPanelCursSel, 0], 1];
|
||||
[QGVAR(loadoutShared), [_contentPanelCtrl, [_profileName ,_loadoutName , _loadoutData]]] call CBA_fnc_remoteEvent;
|
||||
};
|
||||
|
||||
// Update share button text
|
||||
_control ctrlSetText ( [
|
||||
localize LSTRING(buttonSharePrivateText),
|
||||
localize LSTRING(buttonSharePublicText)
|
||||
] select ((_contentPanelCtrl lnbValue [_contentPanelCursSel, 0]) == 1));
|
||||
|
||||
publicVariable QGVAR(sharedLoadoutsVars);
|
||||
|
@ -20,6 +20,7 @@ private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||
private _textEditBoxCtrl= _display displayCtrl IDC_textEditBox;
|
||||
_textEditBoxCtrl ctrlSetText "";
|
||||
private _sharingEnabled = (GVAR(allowSharedLoadouts) && {isMultiplayer});
|
||||
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
|
||||
|
||||
_contentPanelCtrl lnbSetCurSelRow -1;
|
||||
lnbClear _contentPanelCtrl;
|
||||
@ -71,7 +72,7 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||
|
||||
_contentPanelCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), [_loadout, _nullItemsAmount, _unavailableItemsAmount, _nullItemsList, _unavailableItemsList]];
|
||||
|
||||
if ((profileName + _loadoutName) in GVAR(sharedLoadoutsVars) && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts}) then {
|
||||
if ((profileName + _loadoutName) in _sharedLoadoutsVars && {GVAR(currentLoadoutsTab) == IDC_buttonMyLoadouts}) then {
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 0], QPATHTOF(data\iconPublic.paa)];
|
||||
_contentPanelCtrl lnbSetValue [[_newRow, 0], 1];
|
||||
};
|
||||
@ -84,10 +85,12 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||
if ((allPlayers apply {name _x}) find _playerName == -1) then {
|
||||
|
||||
private _loadoutVar = _playerName + _loadoutName;
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||
GVAR(sharedLoadoutsVars) = GVAR(sharedLoadoutsVars) - [_loadoutVar];
|
||||
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
||||
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||
_sharedLoadoutsVars = _sharedLoadoutsVars - [_loadoutVar];
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsNamespace), _sharedLoadoutsVars, true];
|
||||
|
||||
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
|
||||
} else {
|
||||
|
||||
([_loadoutData] call FUNC(verifyLoadout)) params ["_loadout", "_nullItemsAmount", "_unavailableItemsAmount"];
|
||||
@ -109,9 +112,7 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||
};
|
||||
};
|
||||
};
|
||||
} foreach (GVAR(sharedLoadoutsVars) apply {GVAR(sharedLoadoutsNamespace) getVariable _x});
|
||||
|
||||
publicVariable QGVAR(sharedLoadoutsVars);
|
||||
} foreach (_sharedLoadoutsVars apply {GVAR(sharedLoadoutsNamespace) getVariable _x});
|
||||
};
|
||||
|
||||
_contentPanelCtrl lnbSort [1, false];
|
||||
|
@ -30,8 +30,8 @@ if (isNil QGVAR(sharedLoadoutsNamespace)) then {
|
||||
publicVariable QGVAR(sharedLoadoutsNamespace);
|
||||
};
|
||||
|
||||
if (isNil QGVAR(sharedLoadoutsVars)) then {
|
||||
GVAR(sharedLoadoutsVars) = [];
|
||||
if (isNil {GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars)}) then {
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [QGVAR(sharedLoadoutsVars), [], true];
|
||||
};
|
||||
|
||||
if (isNil QGVAR(defaultLoadoutsList)) then {
|
||||
|
Loading…
Reference in New Issue
Block a user