client/addons/store/functions/fnc_openStore.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

48 lines
1.2 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Opens the store
*
* Arguments:
* 0: Store <OBJECT> - The store object
*
* Return Value:
* None
*
* Example:
* [storeObject] call forge_store_fnc_openStore
*
* Public: No
*/
params [["_store", objNull, [objNull]]];
if (isNull _store) exitWith {};
disableSerialization;
createDialog "RscStoreDialog";
private _display = findDisplay IDD_STOREDIALOG;
private _categoryList = _display displayCtrl IDC_CATEGORYLIST;
private _paymentList = _display displayCtrl IDC_PAYMENTLIST;
private _storeName = _display displayCtrl IDC_DIALOGNAME;
private _data = _store getVariable ["storeData", []];
_data params [["_categories", [], [[]]], ["_products", [], [[]]], ["_name", "", [""]], ["_paymentMethods", [], [[]]]];
GVAR(currentStore) = _data;
_storeName ctrlSetText _name;
{
private _index = _categoryList lbAdd _x;
_categoryList lbSetData [_index, _x];
} forEach _categories;
_categoryList lbSetCurSel 0;
{
private _payment = _x select 0;
private _index = _paymentList lbAdd _payment;
_paymentList lbSetData [_index, format ["%1", _x]];
} forEach _paymentMethods;
_paymentList lbSetCurSel 0;