2015-05-09 11:25:19 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Compares version numbers of PBOs and DLLs.
|
|
|
|
*
|
2015-09-18 11:09:40 +00:00
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
2015-05-09 11:25:19 +00:00
|
|
|
*
|
2015-09-18 11:09:40 +00:00
|
|
|
* Public: No
|
2015-05-09 11:25:19 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// check addons
|
|
|
|
///////////////
|
2015-12-12 15:48:54 +00:00
|
|
|
private _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr");
|
2015-05-09 11:25:19 +00:00
|
|
|
|
2015-08-26 15:39:44 +00:00
|
|
|
ACE_LOGINFO_1("ACE is version %1.",_version);
|
2015-05-09 11:25:19 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
//private _addons = activatedAddons; // broken with High-Command module, see #2134
|
|
|
|
private _addons = "true" configClasses (configFile >> "CfgPatches");//
|
2015-09-01 08:06:01 +00:00
|
|
|
_addons = [_addons, {toLower configName _this}] call FUNC(map);//
|
2015-05-09 11:25:19 +00:00
|
|
|
_addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
|
|
|
|
|
|
|
|
{
|
|
|
|
if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then {
|
2015-12-12 15:48:54 +00:00
|
|
|
private _errorMsg = format ["File %1.pbo is outdated.", _x];
|
2015-05-09 11:25:19 +00:00
|
|
|
|
2015-08-26 13:20:11 +00:00
|
|
|
ACE_LOGERROR(_errorMsg);
|
2015-05-09 11:25:19 +00:00
|
|
|
|
|
|
|
if (hasInterface) then {
|
|
|
|
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
|
|
|
};
|
|
|
|
};
|
2015-09-18 11:09:40 +00:00
|
|
|
false
|
|
|
|
} count _addons;
|
2015-05-09 11:25:19 +00:00
|
|
|
|
|
|
|
///////////////
|
|
|
|
// check dlls
|
|
|
|
///////////////
|
|
|
|
{
|
2015-12-12 15:48:54 +00:00
|
|
|
private _versionEx = _x callExtension "version";
|
2015-09-18 11:09:40 +00:00
|
|
|
|
|
|
|
if (_versionEx == "") then {
|
2015-12-12 15:48:54 +00:00
|
|
|
private _errorMsg = format ["Extension %1.dll not installed.", _x];
|
2015-05-09 11:25:19 +00:00
|
|
|
|
2015-08-26 13:20:11 +00:00
|
|
|
ACE_LOGERROR(_errorMsg);
|
2015-05-09 11:25:19 +00:00
|
|
|
|
|
|
|
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
|
2015-09-18 11:09:40 +00:00
|
|
|
ACE_LOGINFO_2("Extension version: %1: %2",_x,_versionEx);
|
2015-05-09 11:25:19 +00:00
|
|
|
};
|
2015-09-18 11:09:40 +00:00
|
|
|
false
|
|
|
|
} count getArray (configFile >> "ACE_Extensions" >> "extensions");
|
2015-05-09 15:03:51 +00:00
|
|
|
|
|
|
|
///////////////
|
2015-06-23 13:27:49 +00:00
|
|
|
// check server version/addons
|
2015-05-09 15:03:51 +00:00
|
|
|
///////////////
|
|
|
|
if (isMultiplayer) then {
|
2015-09-17 00:13:21 +00:00
|
|
|
// don't check optional addons
|
|
|
|
_addons = [_addons, {getNumber (configFile >> "CfgPatches" >> _this >> "ACE_isOptional") != 1}] call FUNC(filter);
|
|
|
|
|
2015-05-09 15:03:51 +00:00
|
|
|
if (isServer) then {
|
|
|
|
// send servers version of ACE to all clients
|
|
|
|
GVAR(ServerVersion) = _version;
|
2015-06-23 13:27:49 +00:00
|
|
|
GVAR(ServerAddons) = _addons;
|
2015-05-09 15:03:51 +00:00
|
|
|
publicVariable QGVAR(ServerVersion);
|
2015-06-23 13:27:49 +00:00
|
|
|
publicVariable QGVAR(ServerAddons);
|
2015-05-09 15:03:51 +00:00
|
|
|
} else {
|
2015-06-23 13:27:49 +00:00
|
|
|
// clients have to wait for the variables
|
2015-05-09 15:03:51 +00:00
|
|
|
[{
|
2015-06-23 13:27:49 +00:00
|
|
|
if (isNil QGVAR(ServerVersion) || isNil QGVAR(ServerAddons)) exitWith {};
|
2015-05-09 15:03:51 +00:00
|
|
|
|
2015-09-18 11:09:40 +00:00
|
|
|
(_this select 0) params ["_version", "_addons"];
|
2015-05-09 15:03:51 +00:00
|
|
|
|
|
|
|
if (_version != GVAR(ServerVersion)) then {
|
2015-12-12 15:48:54 +00:00
|
|
|
private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version];
|
2015-05-09 15:03:51 +00:00
|
|
|
|
2015-08-26 13:20:11 +00:00
|
|
|
ACE_LOGERROR(_errorMsg);
|
2015-05-09 15:03:51 +00:00
|
|
|
|
2015-08-26 13:20:11 +00:00
|
|
|
if (hasInterface) then {
|
2015-05-09 15:03:51 +00:00
|
|
|
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-06-29 13:15:46 +00:00
|
|
|
_addons = _addons - GVAR(ServerAddons);
|
|
|
|
if !(_addons isEqualTo []) then {
|
|
|
|
_errorMsg = format ["Client/Server Addon Mismatch. Client has extra addons: %1.",_addons];
|
2015-06-23 13:27:49 +00:00
|
|
|
|
2015-08-26 13:20:11 +00:00
|
|
|
ACE_LOGERROR(_errorMsg);
|
2015-06-23 13:27:49 +00:00
|
|
|
|
2015-08-26 13:20:11 +00:00
|
|
|
if (hasInterface) then {
|
2015-06-29 13:15:46 +00:00
|
|
|
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
2015-06-23 13:27:49 +00:00
|
|
|
};
|
2015-06-29 13:15:46 +00:00
|
|
|
};
|
2015-06-23 13:27:49 +00:00
|
|
|
|
2015-05-09 15:03:51 +00:00
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
2015-06-23 13:27:49 +00:00
|
|
|
}, 1, [_version,_addons]] call CBA_fnc_addPerFrameHandler;
|
2015-05-09 15:03:51 +00:00
|
|
|
};
|
|
|
|
};
|