From ac95c6b0df2f25a382e8ebab08cf9b217ea00190 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Mon, 19 Sep 2016 20:21:27 -0400 Subject: [PATCH] Make plot and door friends lists backwards compatible This prevents errors when upgrading 1051 databases that had plot or door management installed. See comments at: https://github.com/EpochModTeam/DayZ-Epoch/commit/fe9b8fdcb4b5cf069e0cc287b97785a3448817c8 --- SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf | 7 ++++--- SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf | 5 +++-- SQF/dayz_server/compile/server_updateObject.sqf | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf b/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf index 0e35790f0..0bb8fa6a1 100644 --- a/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf +++ b/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf @@ -1,7 +1,8 @@ -private "_friends"; +private ["_friends","_name"]; -lbClear 7102; +lbClear 7102; _friends = TheDoor getVariable ["doorfriends",[]]; { - lbAdd [7102, toString (_x select 1)]; + _name = _x select 1; + lbAdd [7102, if (typeName _name == "ARRAY") then {toString _name} else {_name}]; } forEach _friends; diff --git a/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf b/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf index 11c11593c..10b779420 100644 --- a/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf @@ -1,9 +1,10 @@ -private ["_plots","_friendlies","_thePlot"]; +private ["_name","_plots","_friendlies","_thePlot"]; lbClear 7002; _plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15]; _thePlot = _plots select 0; _friendlies = _thePlot getVariable ["plotfriends", []]; { - lbAdd [7002, toString (_x select 1)]; + _name = _x select 1; + lbAdd [7002, if (typeName _name == "ARRAY") then {toString _name} else {_name}]; } forEach _friendlies; \ No newline at end of file diff --git a/SQF/dayz_server/compile/server_updateObject.sqf b/SQF/dayz_server/compile/server_updateObject.sqf index 0d2adf81d..ac604f289 100644 --- a/SQF/dayz_server/compile/server_updateObject.sqf +++ b/SQF/dayz_server/compile/server_updateObject.sqf @@ -71,17 +71,17 @@ _object_inventory = { } else { _isNormal = true; - if( DZE_permanentPlot && (typeOf (_object) == "Plastic_Pole_EP1_DZ") ) then { + if (DZE_permanentPlot && (typeOf (_object) == "Plastic_Pole_EP1_DZ")) then { _isNormal = false; _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item }; - if( DZE_doorManagement && (typeOf (_object) in DZE_DoorsLocked) ) then { + if (DZE_doorManagement && (typeOf (_object) in DZE_DoorsLocked)) then { _isNormal = false; _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item }; - if(_isNormal) then { + if (_isNormal) then { _inventory = [getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object]; }; };