ACE3/TO_MERGE/ace/sys_maptools/fnc_copymap_menuDef.sqf

50 lines
1.4 KiB
Plaintext

//#define DEBUG_MODE_FULL
#include "script_component.hpp"
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
private ["_menuDef", "_target", "_params", "_menuName", "_menuRsc", "_menus"];
_target = _this select 0;
_params = _this select 1;
_menuName = "";
_menuRsc = "popup";
if (typeName _params == typeName []) then {
if (count _params < 1) exitWith {diag_log format["Error: Invalid params: %1, %2", _this, __FILE__];};
_menuName = _params select 0;
_menuRsc = if (count _params > 1) then {_params select 1} else {_menuRsc};
} else {
_menuName = _params;
};
//-----------------------------------------------------------------------------
#define __COPY (localize "STR_ACE_MAPTOOLS_COPYUA")
GVAR(target) = _target;
_menus =
[
[
["main", _menuName, _menuRsc],
[
[__COPY,
QUOTE(GVAR(target) call ace_sys_maptools_fnc_CopyMap),
"", "", "", -1, 1,ace_sys_maptools_Enabled && {"ACE_Map_Tools" in (weapons GVAR(target))}]
]
]
];
//-----------------------------------------------------------------------------
_menuDef = [];
{
if (_x select 0 select 0 == _menuName) exitWith {_menuDef = _x};
} forEach _menus;
if (count _menuDef == 0) then {
hintC format ["Error: Menu not found: %1\n%2\n%3", str _menuName, if (_menuName == "") then {_this} else {""}, __FILE__];
diag_log format ["Error: Menu not found: %1, %2, %3", str _menuName, _params, __FILE__];
};
_menuDef // return value