Send marker configNames instead of index

Upstream fix from AGM
If CfgMarkers don't match, will throw warning:
22:46:53
[3896,74.535,0,"z\ace\addons\markers\functions\fnc_setMarkerNetwork.sqf:11","WARNING:
CfgMarker not found changed to milDot"]
This commit is contained in:
PabstMirror 2015-01-19 22:49:28 -06:00
parent a5ac89dcb1
commit cb52ac18c9
5 changed files with 47 additions and 31 deletions

View File

@ -20,4 +20,4 @@ _color = getArray (_config >> "color");
((ctrlParent _ctrl) displayCtrl 102) ctrlSetTextColor _color; ((ctrlParent _ctrl) displayCtrl 102) ctrlSetTextColor _color;
GVAR(currentMarkerColor) = _data; GVAR(currentMarkerColorConfigName) = (configName _config);

View File

@ -14,4 +14,4 @@ _icon = getText (_config >> "icon");
((ctrlParent _ctrl) displayCtrl 102) ctrlSetText _icon; ((ctrlParent _ctrl) displayCtrl 102) ctrlSetText _icon;
GVAR(currentMarkerShape) = _data; GVAR(currentMarkerConfigName) = (configName _config);

View File

@ -32,8 +32,8 @@ if (_this select 1 == 1) then {
[QGVAR(setMarkerNetwork), [ [QGVAR(setMarkerNetwork), [
allMapMarkers select (count allMapMarkers - 1), [ allMapMarkers select (count allMapMarkers - 1), [
GETGVAR(currentMarkerShape,0), GETGVAR(currentMarkerConfigName,""),
GETGVAR(currentMarkerColor,0), GETGVAR(currentMarkerColorConfigName,""),
_this, _this,
GETGVAR(currentMarkerAngle,0) GETGVAR(currentMarkerAngle,0)
] ]

View File

@ -8,20 +8,28 @@ _allMapMarkersProperties = _this select 1;
_logic = _this select 2; _logic = _this select 2;
{ {
_index = _allMapMarkers find _x; _index = _allMapMarkers find _x;
if (_index != -1) then { if (_index != -1) then {
_data = _allMapMarkersProperties select _index; _data = _allMapMarkersProperties select _index;
_config = (configfile >> "CfgMarkers") select (_data select 0); _config = (configfile >> "CfgMarkers") >> (_data select 0);
_x setMarkerTypeLocal configName _config; if (!isClass _config) then {
WARNING("CfgMarker not found, changed to milDot");
_config = (configfile >> "CfgMarkerColors") select (_data select 1); _config == (configFile >> "CfgMarkers" >> "MilDot");
_x setMarkerColorLocal configName _config;
_x setMarkerPosLocal (_data select 2);
_x setMarkerDirLocal (_data select 3);
}; };
_x setMarkerTypeLocal (configName _config);
_config = (configfile >> "CfgMarkerColors") >> (_data select 1);
if (!isClass _config) then {
WARNING("CfgMarkerColors not found, changed to Default");
_config == (configFile >> "CfgMarkerColors" >> "Default");
};
_x setMarkerColorLocal (configName _config);
_x setMarkerPosLocal (_data select 2);
_x setMarkerDirLocal (_data select 3);
};
} forEach allMapMarkers; } forEach allMapMarkers;
deleteVehicle _logic; deleteVehicle _logic;

View File

@ -6,10 +6,18 @@ private ["_marker", "_data", "_config"];
_marker = _this select 0; _marker = _this select 0;
_data = _this select 1; _data = _this select 1;
_config = (configfile >> "CfgMarkers") select (_data select 0); _config = (configfile >> "CfgMarkers") >> (_data select 0);
_marker setMarkerTypeLocal configName _config; if (!isClass _config) then {
WARNING("CfgMarker not found, changed to milDot");
_config == (configFile >> "CfgMarkers" >> "MilDot");
};
_marker setMarkerTypeLocal (configName _config);
_config = (configfile >> "CfgMarkerColors") select (_data select 1); _config = (configfile >> "CfgMarkerColors") >> (_data select 1);
if (!isClass _config) then {
WARNING("CfgMarkerColors not found, changed to Default");
_config == (configFile >> "CfgMarkerColors" >> "Default");
};
_marker setMarkerColorLocal configName _config; _marker setMarkerColorLocal configName _config;
_marker setMarkerPosLocal (_data select 2); _marker setMarkerPosLocal (_data select 2);
@ -17,21 +25,21 @@ _marker setMarkerDirLocal (_data select 3);
// save properties on server machine for JIP, marker editing ready // save properties on server machine for JIP, marker editing ready
if (isMultiplayer && {isServer}) then { if (isMultiplayer && {isServer}) then {
private ["_allMapMarkers", "_allMapMarkersProperties", "_index"]; private ["_allMapMarkers", "_allMapMarkersProperties", "_index"];
_allMapMarkers = GETMVAR(allMapMarkers,[]); _allMapMarkers = GETMVAR(allMapMarkers,[]);
_allMapMarkersProperties = GETMVAR(allMapMarkersProperties,[]); _allMapMarkersProperties = GETMVAR(allMapMarkersProperties,[]);
_index = _allMapMarkers find _marker; _index = _allMapMarkers find _marker;
if (_index == -1) then { if (_index == -1) then {
_allMapMarkers pushBack _marker; _allMapMarkers pushBack _marker;
_allMapMarkersProperties pushBack _data; _allMapMarkersProperties pushBack _data;
} else { } else {
_allMapMarkers set [_index, _marker]; _allMapMarkers set [_index, _marker];
_allMapMarkersProperties set [_index, _data]; _allMapMarkersProperties set [_index, _data];
}; };
GVAR(allMapMarkers) = _allMapMarkers; GVAR(allMapMarkers) = _allMapMarkers;
GVAR(allMapMarkersProperties) = _allMapMarkersProperties; GVAR(allMapMarkersProperties) = _allMapMarkersProperties;
}; };