2015-05-09 11:25:19 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Compares version numbers of PBOs and DLLs.
|
|
|
|
*
|
|
|
|
* Argument:
|
2015-05-09 17:34:35 +00:00
|
|
|
* None.
|
2015-05-09 11:25:19 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* None.
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// check addons
|
|
|
|
///////////////
|
|
|
|
private "_version";
|
|
|
|
_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr");
|
|
|
|
|
2015-05-09 15:03:51 +00:00
|
|
|
diag_log text format ["[ACE]: ACE is version %1.", _version];
|
2015-05-09 11:25:19 +00:00
|
|
|
|
2015-05-09 17:34:35 +00:00
|
|
|
private "_addons";
|
2015-05-09 11:25:19 +00:00
|
|
|
_addons = activatedAddons;
|
|
|
|
_addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
|
|
|
|
|
|
|
|
{
|
|
|
|
if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then {
|
|
|
|
private "_errorMsg";
|
|
|
|
_errorMsg = format ["File %1.pbo is outdated.", _x];
|
|
|
|
|
|
|
|
diag_log text format ["[ACE] ERROR: %1", _errorMsg];
|
|
|
|
|
|
|
|
if (hasInterface) then {
|
|
|
|
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach _addons;
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// check dlls
|
|
|
|
///////////////
|
|
|
|
{
|
|
|
|
if (_x callExtension "version" == "") then {
|
|
|
|
private "_errorMsg";
|
|
|
|
_errorMsg = format ["Extension %1.dll not installed.", _x];
|
|
|
|
|
|
|
|
diag_log text format ["[ACE] ERROR: %1", _errorMsg];
|
|
|
|
|
|
|
|
if (hasInterface) then {
|
|
|
|
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
|
|
|
};
|
2015-05-13 16:57:24 +00:00
|
|
|
} else {
|
|
|
|
// Print the current extension version
|
|
|
|
diag_log text format ["[ACE] Extension version: %1: %2", _x, (_x callExtension "version")];
|
2015-05-09 11:25:19 +00:00
|
|
|
};
|
|
|
|
} forEach getArray (configFile >> "ACE_Extensions" >> "extensions");
|
2015-05-09 15:03:51 +00:00
|
|
|
|
|
|
|
///////////////
|
|
|
|
// check server version
|
|
|
|
///////////////
|
|
|
|
if (isMultiplayer) then {
|
|
|
|
if (isServer) then {
|
|
|
|
// send servers version of ACE to all clients
|
|
|
|
GVAR(ServerVersion) = _version;
|
|
|
|
publicVariable QGVAR(ServerVersion);
|
|
|
|
} else {
|
|
|
|
// clients have to wait for the variable
|
|
|
|
[{
|
|
|
|
if (isNil QGVAR(ServerVersion)) exitWith {};
|
|
|
|
|
|
|
|
private "_version";
|
|
|
|
_version = _this select 0;
|
|
|
|
|
|
|
|
if (_version != GVAR(ServerVersion)) then {
|
|
|
|
private "_errorMsg";
|
|
|
|
_errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version];
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|