Fix for empty _Primary array

This commit is contained in:
He-Man 2017-10-07 17:45:19 +02:00
parent 7ef339d958
commit 4660975b05

View File

@ -214,21 +214,26 @@ if (!isNull _player) then {
// Workaround for Client / Server synchronizing issue in unitloadout
_Primary = _loadout select 0;
_loadout set [0,[]];
_newPlyr setunitloadout _loadout;
_primaryweapon = _Primary deleteat 0;
{
if (_x isequaltype []) then {
_newPlyr addMagazine _x;
};
} foreach _Primary;
_newPlyr addweapon _primaryweapon;
removeAllPrimaryWeaponItems _newPlyr;
{
if (_x isequaltype "") then {
_newPlyr addPrimaryWeaponItem _x;
};
} forEach _Primary;
if !(_Primary isequalto []) then {
_loadout set [0,[]];
_newPlyr setunitloadout _loadout;
_primaryweapon = _Primary deleteat 0;
{
if (_x isequaltype []) then {
_newPlyr addMagazine _x;
};
} foreach _Primary;
_newPlyr addweapon _primaryweapon;
removeAllPrimaryWeaponItems _newPlyr;
{
if (_x isequaltype "") then {
_newPlyr addPrimaryWeaponItem _x;
};
} forEach _Primary;
}
else {
_newPlyr setunitloadout _loadout;
};
diag_log format["DEBUG: loaded player %1 with new schema Version %2", _newPlyr, _schemaVersion];