Initial upload. Not currently functional as a mod. Includes some slightly refactored source code as well as the original mission this was debuted in zipped up as reference + example of usage.

This commit is contained in:
Clarky committed 2026-08-08 17:42:15 +10:00
commit 75b737230e
32 files changed
+2049

No files matched your search

+87
View File
@@ -0,0 +1,87 @@
/*
Author: Clarky
Usage:
[_category] call CLF_fnc_populateVehicleList;
Intended to be called via the VehicleFactory dialog
Purpose:
Populate's the display's listbox with relevant data from the chosen category
*/
// Pass in the category to load
params ["_category"];
// Load up the vehicle factory dialog - IDC 9999
private _display = findDisplay 9999;
private _listBox = _display displayCtrl 1500;
// Exit if no valid display or listbox found
if (isNull _display) exitWith {hint "Error loading Vehicle Factory Dialog";};
if (isNull _listBox) exitWith {hint "Error loading Vehicle Factory Listbox";};
// Unload the current listbox if it already has data
lnbClear _listBox;
_display setVariable [
"CurrentCategory",
_category
];
{
// Load up params from the currently looped vehicle in supplied category
_x params [
"_class",
"_cost",
"_buildTime",
"_specialisation",
"_specialisationData"
];
// Determine attributes to load into the list row
private _displayName = getText(configFile >> "CfgVehicles" >> _class >> "displayName");
private _icon = getText(configFile >> "CfgVehicles" >> _class >> "icon");
// private _icon = "\A3\ui_f\data\map\VehicleIcons\iconObject_1x1_ca.paa";
// If vehicle is tagged with a specialisation, update display name for row
if (_specialisation == "SUPPLY") then {
private _baseDisplayName = _displayName;
_displayName = format ["[SUPPLY] %1", _baseDisplayName];
};
if (_specialisation == "BUILD") then {
private _baseDisplayName = _displayName;
_displayName = format ["[BUILD] %1", _baseDisplayName];
};
private _row = _listBox lnbAddRow [
_displayName,
str _cost,
str _buildTime
];
_listBox lnbSetColor [[_row,0], [1,1,1,1]];
_listBox lnbSetColor [[_row,1], [0.8,0.8,0.8,1]];
_listBox lnbSetColor [[_row,3], [1,1,1,1]];
//_listBox lnbSetColor [[_row,4], [0.8,0.8,0.8,1]];
// Store the vehicle data in the listbox row so that it can be retrieved when the Confirm button is pressed on the dialog
private _vehicleData = [
_class,
_cost,
_buildTime,
_specialisation,
_specialisationData
];
_listBox lnbSetData [
[_row,0],
str _vehicleData
];
// Update new row's icon and set its index for retrieval later
_listBox lnbSetPicture [[_row,0], _icon];
_listBox lnbSetValue [[_row,0], _forEachIndex];
} foreach _category;