Merge pull request #1732 from acemod/checkPBOfix

CheckPBO should ensure client isn't running any addons the server isn't
This commit is contained in:
SilentSpike 2015-07-03 22:33:17 +01:00
commit 909fbb5dc4
3 changed files with 25 additions and 9 deletions

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,18 @@ if (isMultiplayer) then {
};
};
_addons = _addons - GVAR(ServerAddons);
if !(_addons isEqualTo []) then {
_errorMsg = format ["Client/Server Addon Mismatch. Client has extra addons: %1.",_addons];
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);
};
};
[_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