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-09-18 19:15:06 +00:00
|
|
|
private "_fnc_parseConfigForDisplayNames";
|
2015-09-18 19:12:40 +00:00
|
|
|
_fnc_parseConfigForDisplayNames = {
|
|
|
|
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
|
|
|
|
|
|
|
private "_values";
|
2015-08-15 08:48:25 +00:00
|
|
|
_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-09-18 19:12:40 +00:00
|
|
|
private "_text";
|
2015-04-18 18:06:01 +00:00
|
|
|
_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 {
|
|
|
|
ACE_LOGWARNING_2("Setting [%1] has values[] but is not SCALAR (%2)", _name, _typeOf);
|
|
|
|
} 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 {
|
|
|
|
ACE_LOGWARNING_3("Setting [%1] out of bounds %2 (values[] count is %3)(", _name, _value, count _values);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
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 {
|
2015-08-26 15:39:44 +00:00
|
|
|
ACE_LOGWARNING_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);
|