2015-04-17 17:21:41 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
2015-04-18 02:26:27 +00:00
|
|
|
*
|
|
|
|
* Receives either requests for synchronization from clients, or the synchronization data from the server.
|
2015-04-17 17:21:41 +00:00
|
|
|
*
|
2015-04-18 02:26:27 +00:00
|
|
|
* Arguments [Client] :
|
|
|
|
* 0: eventName (String)
|
|
|
|
* 1: eventLog (Array)
|
|
|
|
*
|
|
|
|
* Arguments [Server] :
|
|
|
|
* 0: eventName (String)
|
|
|
|
* 1: client (Object)
|
2015-04-17 17:21:41 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Boolean of success
|
|
|
|
*/
|
2015-04-18 02:26:27 +00:00
|
|
|
//#define DEBUG_MODE_FULL
|
2015-04-17 17:21:41 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
//SEH_s
|
|
|
|
if(isServer) then {
|
|
|
|
// Find the event name, and shovel out the events to the client
|
|
|
|
PARAMS_2(_eventName,_client);
|
|
|
|
private["_eventEntry", "_eventLog"];
|
|
|
|
|
|
|
|
if(!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
|
|
|
|
diag_log text format["[ACE] Error, request for synced event - key not found."];
|
|
|
|
false
|
|
|
|
};
|
|
|
|
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
|
|
|
|
_eventLog = _eventEntry select 1;
|
|
|
|
|
|
|
|
["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent);
|
|
|
|
} else {
|
|
|
|
PARAMS_2(_eventName,_eventLog);
|
|
|
|
// This is the client handling the response from the server
|
|
|
|
// Start running the events
|
|
|
|
{
|
|
|
|
_eventArgs = _x select 1;
|
|
|
|
[_eventName, _eventArgs, (_x select 2)] call FUNC(_handleSyncedEvent);
|
|
|
|
} forEach _eventLog;
|
2015-04-18 02:26:27 +00:00
|
|
|
diag_log text format["[ACE] + [%1] synchronized", _eventName];
|
2015-04-17 17:21:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
true
|