Skip to content

Commit

Permalink
Inventory - Use maxLoad command (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
mharis001 authored Aug 29, 2022
1 parent 3473e81 commit 64fb5cd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 1 addition & 3 deletions addons/context_actions/functions/fnc_canEditInventory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@

params ["_entity"];

_entity isEqualType objNull
&& {alive _entity}
&& {getNumber (configOf _entity >> "maximumLoad") > 0}
_entity isEqualType objNull && {alive _entity} && {maxLoad _entity > 0}
2 changes: 1 addition & 1 deletion addons/inventory/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PREP_RECOMPILE_END;
[_entity] call FUNC(configure);
},
{
alive _entity && {getNumber (configOf _entity >> "maximumLoad") > 0}
alive _entity && {maxLoad _entity > 0}
}
] call EFUNC(attributes,addButton);

Expand Down
8 changes: 2 additions & 6 deletions addons/inventory/functions/fnc_configure.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@ params ["_object"];

if (!createDialog QGVAR(display)) exitWith {};

private _config = configOf _object;
private _displayName = getText (_config >> "displayName");
private _maximumLoad = getNumber (_config >> "maximumLoad");

// Get the object's current cargo and calculate its load
private _cargo = [getItemCargo _object, getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object];
private _currentLoad = [_cargo] call FUNC(calculateLoad);

private _display = uiNamespace getVariable QEGVAR(common,display);
_display setVariable [QGVAR(currentLoad), _currentLoad];
_display setVariable [QGVAR(maximumLoad), _maximumLoad];
_display setVariable [QGVAR(maximumLoad), maxLoad _object];
_display setVariable [QGVAR(object), _object];
_display setVariable [QGVAR(cargo), _cargo];

Expand All @@ -38,7 +34,7 @@ _display setVariable [QGVAR(cargo), _cargo];

// Set the display's title to the object name
private _ctrlTitle = _display displayCtrl IDC_TITLE;
_ctrlTitle ctrlSetText toUpper format [localize LSTRING(EditInventory), _displayName];
_ctrlTitle ctrlSetText toUpper format [LLSTRING(EditInventory), getText (configOf _object >> "displayName")];

// Refresh the items list when category is changed
private _ctrlCategory = _display displayCtrl IDC_CATEGORY;
Expand Down
2 changes: 1 addition & 1 deletion addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD

// MINIMAL required version for the Mod. Components can specify others..
#define REQUIRED_VERSION 2.06
#define REQUIRED_VERSION 2.08
#define REQUIRED_CBA_VERSION {3,15,5}

#ifdef COMPONENT_BEAUTIFIED
Expand Down

0 comments on commit 64fb5cd

Please sign in to comment.