CheckPBO should ensure client isn't running any addons the server isn't

This commit is contained in:
SilentSpike 2015-06-23 14:27:49 +01:00
parent 7aab44bde6
commit e4f89a96b7
4 changed files with 27 additions and 10 deletions

View File

@ -6,7 +6,7 @@
//Singe PFEH to handle execNextFrame and waitAndExec:
[{
private ["_entry"];
//Handle the waitAndExec array:
while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do {
_entry = GVAR(waitAndExecArray) deleteAt 0;

View File

@ -56,20 +56,23 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
} forEach getArray (configFile >> "ACE_Extensions" >> "extensions");
///////////////
// check server version
// check server version/addons
///////////////
if (isMultiplayer) then {
if (isServer) then {
// send servers version of ACE to all clients
GVAR(ServerVersion) = _version;
GVAR(ServerAddons) = _addons;
publicVariable QGVAR(ServerVersion);
publicVariable QGVAR(ServerAddons);
} else {
// clients have to wait for the variable
// clients have to wait for the variables
[{
if (isNil QGVAR(ServerVersion)) exitWith {};
if (isNil QGVAR(ServerVersion) || isNil QGVAR(ServerAddons)) exitWith {};
private "_version";
_version = _this select 0;
private ["_version","_addons"];
_version = (_this select 0) select 0;
_addons = (_this select 0) select 1;
if (_version != GVAR(ServerVersion)) then {
private "_errorMsg";
@ -82,7 +85,19 @@ if (isMultiplayer) then {
};
};
{
if !(_x in GVAR(ServerAddons)) then {
_errorMsg = format ["Client/Server Addon Mismatch. Client has extra addon: %1.",_x];
diag_log text format ["[ACE] ERROR: %1", _errorMsg];
if (hasInterface) then {diag_log str "1";
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
};
};
} forEach _addons;
[_this select 1] call CBA_fnc_removePerFrameHandler;
}, 1, _version] call CBA_fnc_addPerFrameHandler;
}, 1, [_version,_addons]] call CBA_fnc_addPerFrameHandler;
};
};

View File

@ -8,8 +8,8 @@
* 0: Warn once
* 1: Warn permanently
* 2: Kick
* 1: Check all PBOs? <BOOL> (Optional - default: "[]")
* 2: Whitelist <STRING> (Optinal - default: false)
* 1: Check all PBOs? <BOOL> (Optional - default: false)
* 2: Whitelist <STRING> (Optinal - default: "[]")
*
* Return value:
* None

View File

@ -3,7 +3,9 @@
* Initializes the check-PBOs module.
*
* Arguments:
* Whatever the module provides. (I dunno.)
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* None