Improved handling of accessing dynamic variable names

This commit is contained in:
Michael Braun 2015-08-15 12:12:41 +02:00
parent a315596c5a
commit c3c39150a3
3 changed files with 4 additions and 4 deletions

View File

@ -25,8 +25,8 @@ _proximityPlayers = [ACE_player, GVAR(maxRange)] call FUNC(getProximityPlayers);
_nameSane = [name _x] call FUNC(sanitizeName);
_drawPosVariableName = format [QGVAR(%1_DrawPos), _nameSane];
if (!isNil _drawPosVariableName) then {
if (isNil {call compile _drawPosVariableName}) then {call compile format [QUOTE(GVAR(%1_DrawPos) = [ARR_3(1,1,1)];), _nameSane];};
_pos = call compile _drawPosVariableName;
if (isNil {missionNamespace getVariable _drawPosVariableName}) then {missionNamespace setVariable [_drawPosVariableName, [1, 1, 1]];};
_pos = missionNamespace getVariable _drawPosVariableName;
if (alive _x &&
{_x getVariable QGVAR(Transmit)}) then {
_group = group _x;

View File

@ -18,7 +18,7 @@
{
if (isPlayer _x) then {
_nameSane = [name _x] call FUNC(sanitizeName);
call compile format [QUOTE(GVAR(%1_DrawPos) = [ARR_3(1,1,1)];), _nameSane];
missionNamespace setVariable [format [QGVAR(%1_DrawPos), _nameSane], [1, 1, 1]];
};
nil
} count allUnits;

View File

@ -36,7 +36,7 @@ GVAR(MouseMoveHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseMoving", {
};
_nameSane = [name ACE_player] call FUNC(sanitizeName);
call compile format [QUOTE(GVAR(%1_DrawPos) = %2), _nameSane, _control ctrlMapScreenToWorld [_posX, _posY]];
missionNamespace setVariable [format [QGVAR(%1_DrawPos), _nameSane], _control ctrlMapScreenToWorld [_posX, _posY]];
};
}];