2015-04-18 18:06:01 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Parse all settings and load the localized displayName and description for all text
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _fnc_parseConfigForDisplayNames = {
|
2015-09-18 19:12:40 +00:00
|
|
|
params ["_optionEntry"];
|
2015-04-18 18:06:01 +00:00
|
|
|
|
2015-11-30 16:14:05 +00:00
|
|
|
if !(isClass _optionEntry) exitWith {false};
|
2015-09-18 19:12:40 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _values = getArray (_optionEntry >> "values");
|
2015-09-18 19:12:40 +00:00
|
|
|
|
2015-04-18 18:06:01 +00:00
|
|
|
_x set [3, getText (_optionEntry >> "displayName")];
|
|
|
|
_x set [4, getText (_optionEntry >> "description")];
|
2015-08-15 08:48:25 +00:00
|
|
|
_x set [5, _values];
|
2015-08-13 18:20:37 +00:00
|
|
|
_x set [8, getText (_optionEntry >> "category")];
|
2015-04-18 18:06:01 +00:00
|
|
|
|
|
|
|
{
|
2015-12-12 15:48:54 +00:00
|
|
|
private _text = _x;
|
2015-09-18 19:12:40 +00:00
|
|
|
|
2015-11-20 17:40:31 +00:00
|
|
|
if (_text isEqualType "" && {count _text > 1} && {_text select [0, 1] == "$"}) then {
|
2015-09-18 19:12:40 +00:00
|
|
|
_text = localize (_text select [1]); //chop off the leading $
|
2015-04-18 18:06:01 +00:00
|
|
|
_values set [_forEachIndex, _text];
|
|
|
|
};
|
|
|
|
} forEach _values;
|
2015-10-18 23:49:03 +00:00
|
|
|
|
|
|
|
if (!(_values isEqualTo [])) then {
|
|
|
|
if (_typeOf != "SCALAR") then {
|
2016-08-22 19:06:52 +00:00
|
|
|
WARNING_2("Setting [%1] has values[] but is not SCALAR (%2)", _name, _typeOf);
|
2015-10-18 23:49:03 +00:00
|
|
|
} else {
|
2015-11-17 20:02:20 +00:00
|
|
|
private _value = missionNamespace getVariable [_name, -1];
|
2015-10-18 23:49:03 +00:00
|
|
|
if ((_value < 0) || {_value >= (count _values)}) then {
|
2016-08-22 19:06:52 +00:00
|
|
|
WARNING_3("Setting [%1] out of bounds %2 (values[] count is %3)", _name, _value, count _values);
|
2015-10-18 23:49:03 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-09-18 19:12:40 +00:00
|
|
|
true
|
2015-04-18 18:06:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Iterate through settings
|
|
|
|
{
|
2015-10-18 23:49:03 +00:00
|
|
|
_x params ["_name", "_typeOf"];
|
2015-04-18 18:06:01 +00:00
|
|
|
|
2015-09-18 19:12:40 +00:00
|
|
|
if !([configFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then {
|
|
|
|
if !([configFile >> "ACE_ServerSettings" >> _name] call _fnc_parseConfigForDisplayNames) then {
|
|
|
|
if !([missionConfigFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then {
|
2016-08-22 19:06:52 +00:00
|
|
|
WARNING_1("Setting found, but couldn't localize [%1] (server has but we don't?)",_name);
|
2015-08-15 08:48:25 +00:00
|
|
|
};
|
2015-04-18 18:06:01 +00:00
|
|
|
};
|
|
|
|
};
|
2015-09-18 19:12:40 +00:00
|
|
|
false
|
|
|
|
} count GVAR(settings);
|