Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Curator and 3DEN cargo attributes #1140

Merged
merged 4 commits into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions addons/ui/fnc_preload3DEN.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ private _magazinesLists = [];
_muzzleConfig = _weaponConfig >> _x;
};

private _compatibleMagazines = getArray (_muzzleConfig >> "magazines");
{
{
_compatibleMagazines append getArray _x;
} forEach configProperties [configFile >> "CfgMagazineWells" >> _x, "isArray _x"];
} foreach getArray (_muzzleConfig >> "magazineWell");

{
private _item = toLower _x;

Expand All @@ -131,7 +138,7 @@ private _magazinesLists = [];
_magazines pushBack _item;
};
};
} forEach getArray (_muzzleConfig >> "magazines");
} forEach _compatibleMagazines;
} forEach getArray (_weaponConfig >> "muzzles");
};
};
Expand Down Expand Up @@ -179,10 +186,6 @@ private _listHeadgear = _list select 10;
};
} forEach ("true" configClasses (configFile >> "CfgGlasses"));

{
_x sort true;
} forEach _list;

_itemTypes call CBA_fnc_deleteNamespace;

true
15 changes: 11 additions & 4 deletions addons/ui/fnc_preloadCurator.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ private _magazinesLists = [];
};

_listItem pushBack [
_item,
_displayName,
_displayNameShort,
_item,
getText (_weaponConfig >> "picture"),
parseNumber (getNumber (_weaponConfig >> "type") in [4096, 131072]),
false
Expand All @@ -130,6 +130,13 @@ private _magazinesLists = [];
_muzzleConfig = _weaponConfig >> _x;
};

private _compatibleMagazines = getArray (_muzzleConfig >> "magazines");
{
{
_compatibleMagazines append getArray _x;
} forEach configProperties [configFile >> "CfgMagazineWells" >> _x, "isArray _x"];
} foreach getArray (_muzzleConfig >> "magazineWell");

{
private _item = toLower _x;

Expand All @@ -140,9 +147,9 @@ private _magazinesLists = [];
private _displayName = getText (_magazineConfig >> "displayName");

_listItem pushBack [
_item,
_displayName,
_displayName,
_item,
getText (_magazineConfig >> "picture"),
2,
_item in _magazines
Expand All @@ -151,7 +158,7 @@ private _magazinesLists = [];
_magazines pushBack _item;
};
};
} forEach getArray (_muzzleConfig >> "magazines");
} forEach _compatibleMagazines;
} forEach getArray (_weaponConfig >> "muzzles");
};
};
Expand All @@ -177,9 +184,9 @@ private _magazinesLists = [];
private _displayName = getText (_weaponConfig >> "displayName");

(_addonList select _index) pushBack [
_item,
_displayName,
_displayName,
_item,
getText (_weaponConfig >> "picture"),
3,
false
Expand Down
21 changes: 19 additions & 2 deletions addons/ui/test_preload.sqf
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
#include "script_component.hpp"
// execVM "\x\cba\addons\ui\test_preload.sqf";

if (!canSuspend) exitWith {
execVM __FILE__;
};

isNil {
with uiNamespace do {
// 3DEN
TEST_DEFINED(QFUNC(preload3DEN),"");

AmmoBox_list = nil;
["onLoad", [controlNull]] call compile preprocessFile "\a3\3den\UI\Attributes\AmmoBox.sqf";
};
};

waitUntil {!isNil {uiNamespace getVariable "AmmoBox_list"}};

isNil {
with uiNamespace do {
private _vanilla = AmmoBox_list;

AmmoBox_list = nil;
call FUNC(preload3DEN);
private _cba = AmmoBox_list;

TEST_TRUE(_vanilla isEqualTo _cba,QFUNC(preload3DEN));
TEST_TRUE([_vanilla] isEqualTo [_cba],QFUNC(preload3DEN));
if !([_vanilla] isEqualTo [_cba]) then {
copyToClipboard ("3DEN" + endl + str _vanilla + endl + str _cba);
};

// Curator
TEST_DEFINED(QFUNC(preloadCurator),"");
Expand All @@ -40,6 +54,9 @@ isNil {
["onLoad", [displayNull], objNull] call compile preprocessFile "\a3\ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf";
_cba = RscAttributeInventory_list;

TEST_TRUE(_vanilla isEqualTo _cba,QFUNC(preloadCurator));
TEST_TRUE([_vanilla] isEqualTo [_cba],QFUNC(preloadCurator));
if !([_vanilla] isEqualTo [_cba]) then {
copyToClipboard ("Curator" + endl + str _vanilla + endl + str _cba);
};
};
};