add getVariable, setVariable macros

This commit is contained in:
commy2 2015-01-14 20:38:59 +01:00
parent de8ca47e88
commit ddbc54b992
4 changed files with 30 additions and 13 deletions

View File

@ -184,6 +184,21 @@
#define PATHTOEF(var1,var2) PATHTOF_SYS(PREFIX,var1,var2)
#define GETVAR_SYS(var1,var2) getVariable [ARR_2(QUOTE(var1),var2)]
#define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)]
#define SETGVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)]
#define GETVAR(var1,var2,var3) (var1 GETVAR_SYS(var2,var3))
#define GETMVAR(var1,var2) (missionNamespace GETVAR_SYS(var1,var2))
#define GETUVAR(var1,var2) (uiNamespace GETVAR_SYS(var1,var2))
#define SETVAR(var1,var2,var3) (var1 SETVAR_SYS(var2,var3))
#define SETGVAR(var1,var2,var3) (var1 SETGVAR_SYS(var2,var3))
#define SETMVAR(var1,var2) (missionNamespace SETVAR_SYS(var1,var2))
#define SETUVAR(var1,var2) (uiNamespace SETVAR_SYS(var1,var2))
#ifdef DISABLE_COMPILE_CACHE
#define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf))
#else

View File

@ -0,0 +1,3 @@
// by commy2
3.28084 * (_this select 0)

View File

@ -1,12 +1,12 @@
// by commy2
#include "script_component.hpp"
private "_dlgVectorOptics";
private "_dlgVector";
disableSerialization;
_dlgVectorOptics = uiNamespace getVariable ['AGM_dlgVectorOptics', displayNull];
_dlgVector = uiNamespace getVariable ["AGM_dlgVector", displayNull];
[
round parseNumber ctrlText (_dlgVectorOptics displayCtrl 156),
round parseNumber ctrlText (_dlgVectorOptics displayCtrl 182)
round parseNumber ctrlText (_dlgVector displayCtrl 156),
round parseNumber ctrlText (_dlgVector displayCtrl 182)
]

View File

@ -2,25 +2,24 @@
#include "script_component.hpp"
#define MIN_DISTANCE 10
#define MAX_DISTANCE ([6000, 9000] select (AGM_vectorSettings select 3))
#define INTERVAL 2
#define MAX_DISTANCE ([6000, 9000] select GVAR(useFeet))
private ["_dlgVectorOptics", "_distance"];
private ["_dlgVector", "_distance"];
disableSerialization;
_dlgVectorOptics = uiNamespace getVariable ['AGM_dlgVectorOptics', displayNull];
_dlgVector = GETUVAR(AGM_dlgVector,displayNull);
_distance = ctrlText (_dlgVectorOptics displayCtrl 151);
_distance = ctrlText (_dlgVector displayCtrl 151);
if (_distance == "----") exitWith {-9999};
if (_distance == "----") exitWith {-1};
_distance = round parseNumber _distance;
if (AGM_vectorSettings select 3) then {
if (GVAR(useFeet)) then {
_distance = 3.28084 * _distance;
};
if (_distance > MAX_DISTANCE) exitWith {-9999};
if (_distance < MIN_DISTANCE) exitWith {-9999};
if (_distance > MAX_DISTANCE) exitWith {-1};
if (_distance < MIN_DISTANCE) exitWith {-1};
_distance