Page MenuHomeFeedback Tracker

Erroneous code line in BIS_fnc_Arsenal "Preload"
New, NormalPublic

Description

There is a line of code in BIS_fnc_Arsenal since 1.64 that is not needed and has made it so that you cannot Preload the arsenal data at mission load using

[ "Preload" ] spawn BIS_fnc_arsenal;

From fn_arsenal.sqf header

"Preload" - Preload item configs for Arsenal (without preloading, configs are parsed the first time Arsenal is opened)

			No params

At line 949 you will find this..

//--- Magazines
private _ctrlList = _display displayctrl (IDC_RSCDISPLAYARSENAL_LIST + IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL);

If calling "Preload" as mentioned above _display is undefined.
This line has no use here and is erroneous as all the display elements are handled later in the process by "ListAdd" where the ctrl element is redefined as it iterates through the arsenal data at line 1080..

{
	_ctrlList = _display displayctrl (IDC_RSCDISPLAYARSENAL_LIST + _foreachindex);	<<<redefine of _ctrlList
	_list = +_x;		<<<Arsenal data index
	....
	switch _foreachindex do {
	.....
		case IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL;	<<<fill cargo mag list
		case IDC_RSCDISPLAYARSENAL_TAB_CARGOTHROW;
		case IDC_RSCDISPLAYARSENAL_TAB_CARGOPUT: {
			_virtualCargo = _virtualMagazineCargo;
			_virtualAll = _fullVersion || {"%ALL" in _virtualCargo};
			_columns = count lnbGetColumnsPosition _ctrlList;
			{
				if (_virtualAll || {_x in _virtualCargo}) then {
					_xCfg = configfile >> "cfgmagazines" >> _x;
					_lbAdd = _ctrlList lnbaddrow ["",gettext (_xCfg >> "displayName"),str 0];
					_ctrlList lnbsetdata [[_lbAdd,0],_x];
					_ctrlList lnbsetpicture [[_lbAdd,0],gettext (_xCfg >> "picture")];
					_ctrlList lnbsetvalue [[_lbAdd,0],getnumber (_xCfg >> "mass")];
					_ctrlList lbsettooltip [_lbAdd * _columns,gettext (_xCfg >> "displayName")];
				};
			} foreach _list;	<<<iterate magazine data
		};

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Operating System Version
NA
Category
Virtual Arsenal
Steps To Reproduce

In some event script init.sqf or initPlayerLocal.sqf make a call to preload the arsenal data..

[ "Preload" ] spawn BIS_fnc_arsenal;

With showScriptErrors enabled you will get an on screen error from fn_arsenal line 920 (offset by defines and white space) that _display is undefined.

Event Timeline

Larrow created this task.Dec 30 2016, 1:15 AM
Larrow edited Steps To Reproduce. (Show Details)Dec 30 2016, 1:22 AM
noigel added a subscriber: noigel.Jun 19 2017, 5:51 AM