Optimize save after trade

See my comment on b806043

Veh_setFixServer only runs on the server, so the client does not need to
compile it.

The PVDZ_veh_Save PVEH is only added on the server, so it should never
be sent with regular publicVariable anymore.
This commit is contained in:
ebaydayz
2016-10-02 15:44:43 -04:00
parent 353d3732d1
commit de219116a8
6 changed files with 15 additions and 15 deletions

View File

@@ -11,7 +11,6 @@ class AdvancedTrading
{ {
idd = 711197; idd = 711197;
onLoad = "uiNamespace setVariable ['AdvancedTrading', _this select 0]"; onLoad = "uiNamespace setVariable ['AdvancedTrading', _this select 0]";
onUnload = "call player_forceSave; if (!isNull Z_vehicle) then {PVDZ_veh_Save = [Z_vehicle,'all']; publicVariable 'PVDZ_veh_Save';};";
class Controls { class Controls {
class RscText_ATBackground1: ZSC_RscText class RscText_ATBackground1: ZSC_RscText
{ {

View File

@@ -259,6 +259,11 @@ if (_enoughMoney) then {
}; };
}; };
_itemsToLog call Z_logTrade; _itemsToLog call Z_logTrade;
call player_forceSave;
if (Z_SellingFrom == 1) then {
PVDZ_veh_Save = [Z_vehicle,"gear"];
publicVariableServer "PVDZ_veh_Save";
};
} else { } else {
if (Z_SingleCurrency) then { if (Z_SingleCurrency) then {
systemChat format[localize "STR_EPOCH_TRADE_NEED_COINS",[_priceToBuy] call BIS_fnc_numberText,CurrencyName]; systemChat format[localize "STR_EPOCH_TRADE_NEED_COINS",[_priceToBuy] call BIS_fnc_numberText,CurrencyName];

View File

@@ -260,6 +260,8 @@ if (_return_change > 0) then {
} else { } else {
_successful = true; _successful = true;
}; };
if (_combine) then {call player_forceSave;};
}; };
if (Z_ChangeInBackpack) then { systemChat localize "STR_EPOCH_TRADE_CHANGE_IN_BACKPACK"; }; if (Z_ChangeInBackpack) then { systemChat localize "STR_EPOCH_TRADE_CHANGE_IN_BACKPACK"; };

View File

@@ -161,7 +161,6 @@ if (Z_SellingFrom == 2) then {
}; };
}; };
}; };
} forEach Z_SellArray; } forEach Z_SellArray;
_outcome set [0,_mA]; _outcome set [0,_mA];
@@ -231,6 +230,11 @@ if (typeName _money == "SCALAR") then {
if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_SELL_SUCCESS",_tCost]; }; if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_SELL_SUCCESS",_tCost]; };
}; };
_itemsToLog call Z_logTrade; _itemsToLog call Z_logTrade;
call player_forceSave;
if (Z_SellingFrom == 1) then {
PVDZ_veh_Save = [Z_vehicle,"gear"];
publicVariableServer "PVDZ_veh_Save";
};
} else { } else {
systemChat localize "STR_EPOCH_TRADE_DEBUG"; systemChat localize "STR_EPOCH_TRADE_DEBUG";
diag_log "Money is not a number. Something went wrong."; diag_log "Money is not a number. Something went wrong.";

View File

@@ -9,18 +9,8 @@ if (_selection != "" and local _unit) then {
//player sidechat str _damage; //player sidechat str _damage;
_unit setVariable [_strH,_damage,true]; _unit setVariable [_strH,_damage,true];
if (_damage == 0) then { if (_damage == 0) then {
if (isServer) then { [_unit,"repair"] call server_updateObject;
[_unit,"repair"] call server_updateObject
} else {
PVDZ_veh_Save = [_unit,"repair"];
publicVariable "PVDZ_veh_Save";
};
} else { } else {
if (isServer) then { [_unit,"damage"] call server_updateObject;
[_unit,"damage"] call server_updateObject
} else {
PVDZ_veh_Save = [_unit,"damage"];
publicVariable "PVDZ_veh_Save";
};
}; };
}; };

View File

@@ -1,5 +1,6 @@
if (isServer) then { if (isServer) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf"; call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
fnc_veh_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
pvs_processSetAccessCode = compile preprocessFile "\z\addons\dayz_code\eventHandlers\processSetAccessCode.sqf"; pvs_processSetAccessCode = compile preprocessFile "\z\addons\dayz_code\eventHandlers\processSetAccessCode.sqf";
pvs_processAccessCode = compile preprocessFile "\z\addons\dayz_code\eventHandlers\processAccessCode.sqf"; pvs_processAccessCode = compile preprocessFile "\z\addons\dayz_code\eventHandlers\processAccessCode.sqf";
server_spawnTraders = compile preprocessFile "\z\addons\dayz_server\compile\server_spawnTraders.sqf"; server_spawnTraders = compile preprocessFile "\z\addons\dayz_server\compile\server_spawnTraders.sqf";
@@ -638,7 +639,6 @@ fnc_veh_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compi
fnc_veh_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleKilled.sqf"; fnc_veh_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleKilled.sqf";
fnc_veh_handleRepair = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleRepair.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles) fnc_veh_handleRepair = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleRepair.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
fnc_veh_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf"; fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding; fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit