
This commit includes the following changes: - Updates the build environment in the GitHub Actions workflow to use `ubuntu-latest` instead of `ubuntu-22.04`. - Adds `playerGroup2Server` to the XEH_PREP.hpp file. - Updates the picture path in CfgMods.hpp to include the file extension.
98 lines
2.8 KiB
Plaintext
98 lines
2.8 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Function: forge_server_db_fnc_initDB
|
|
* Author: J. Schmidt
|
|
*
|
|
* Description:
|
|
* Initializes the database system, creating the interface for other modules
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* Database interface object
|
|
*/
|
|
|
|
private _storeInterface = createHashMapObject [[
|
|
["#type", "IStore"],
|
|
["#create", {
|
|
private _storeRegistry = GETVAR(profileNamespace,FORGE_STORE_REG,createHashMap);
|
|
_self set ["stores", _storeRegistry];
|
|
}],
|
|
["createStore", {
|
|
params [["_name", "", [""]]];
|
|
|
|
if (_name == "") exitWith { ERROR_MSG("Store name cannot be empty"); nil };
|
|
|
|
private _stores = _self get "stores";
|
|
private _store = _stores getOrDefault [_name, nil];
|
|
|
|
if !(isNil "_store") exitWith { _store };
|
|
|
|
private _store = createHashMap;
|
|
|
|
_stores set [_name, _store];
|
|
_store
|
|
}],
|
|
["getStore", {
|
|
params [["_name", "", [""]]];
|
|
|
|
if (_name == "") exitWith { ERROR_MSG("Store name cannot be empty"); nil };
|
|
|
|
private _stores = _self get "stores";
|
|
_stores getOrDefault [_name, nil]
|
|
}],
|
|
["deleteStore", {
|
|
params [["_name", "", [""]]];
|
|
|
|
if (_name == "") exitWith { ERROR_MSG("Store name cannot be empty"); false };
|
|
|
|
private _stores = _self get "stores";
|
|
private _store = _stores getOrDefault [_name, nil];
|
|
|
|
if (isNil "_store") exitWith { ERROR_MSG_1("Store %1 not found", _name); false };
|
|
|
|
_stores deleteAt _name;
|
|
true
|
|
}],
|
|
["set", {
|
|
params [["_name", "", [""]], ["_key", "", [""]], ["_value", nil]];
|
|
|
|
if (_name == "" || _key == "") exitWith { ERROR_MSG("Store name and, or key cannot be empty"); false };
|
|
|
|
private _stores = _self get "stores";
|
|
private _store = _stores getOrDefault [_name, nil];
|
|
|
|
if (isNil "_store") exitWith { ERROR_MSG_1("Store %1 not found", _name); false };
|
|
|
|
_store set [_key, _value];
|
|
true
|
|
}],
|
|
["get", {
|
|
params [["_name", "", [""]], ["_key", "", [""]], ["_default", nil]];
|
|
|
|
if (_name == "" || _key == "") exitWith { ERROR_MSG("Store name and, or key cannot be empty"); _default };
|
|
|
|
private _store = _self call ["getStore", [_name]];
|
|
|
|
if (isNil "_store") exitWith { ERROR_MSG_1("Store %1 not found", _name); _default };
|
|
|
|
_store getOrDefault [_key, _default]
|
|
}],
|
|
["delete", {
|
|
params [["_name", "", [""]], ["_key", "", [""]]];
|
|
|
|
if (_name == "" || _key == "") exitWith { ERROR_MSG("Store name and, or key cannot be empty"); false };
|
|
|
|
private _store = _self call ["getStore", [_name]];
|
|
|
|
if (isNil "_store") exitWith { ERROR_MSG_1("Store %1 not found", _name); false };
|
|
|
|
_store deleteAt _key;
|
|
true
|
|
}]
|
|
]];
|
|
|
|
SETPVAR(missionNamespace,FORGE_STORE_REG,_storeInterface);
|
|
GETMVAR(FORGE_STORE_REG,nil) |