Skip to content

Commit bef51fe

Browse files
committed
same thing for install messages
1 parent b559c20 commit bef51fe

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

addons/common/functions/fnc_checkFiles.sqf

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,31 @@ private _oldCompats = [];
7777
if (_oldAddons isNotEqualTo []) then {
7878
_oldAddons = _oldAddons apply {format ["%1.pbo", _x]};
7979
private _extraSources = _oldSources select {_x != _mainSource};
80+
private _conflictingInstall = _extraSources isNotEqualTo [];
8081
private _allSources = [_mainSource] + _extraSources;
8182

82-
private _errorMsg = if (count _oldAddons > 3) then {
83-
format ["The following files are outdated: %1, and %2 more.<br/>ACE Main version is %3 from %4.<br/><br/>All mods with ACE files: %5", (_oldAddons select [0, 3]) joinString ", ", (count _oldAddons) - 3, _mainVersion, _mainSource, _allSources joinString ", "];
84-
} else {
85-
format ["The following files are outdated: %1.<br/>ACE Main version is %2 from %3.<br/><br/>All mods with ACE files: %4", _oldAddons joinString ", ", _mainVersion, _mainSource, _allSources joinString ", "];
86-
};
87-
if (_extraSources isNotEqualTo []) then {
88-
_errorMsg = _errorMsg + "<br/><br/>Reason: Conflicting ACE installations (see list above).<br/><br/>Fix: Make sure to only load one version of ACE.";
83+
// Build the error message
84+
private _title = "[ACE] ERROR: OUTDATED FILES";
85+
private _reasonMsg = ["Reason: Mismatched addon versions within the same installation, it is likely corrupted.", "Reason: Conflicting ACE installations (see list below)."] select _conflictingInstall;
86+
private _fixMsg = ["Fix: Repair ACE or update your repack.", "Fix: Make sure to only load one version of ACE."] select _conflictingInstall;
87+
88+
private _infoMsgLog = format ["The following files are outdated: %1.<br/>ACE Main version is %2 from folder ""%3"".<br/><br/>All mod folders with ACE files: %4", _oldAddons joinString ", ", _mainVersion, _mainSource, _allSources joinString ", "];
89+
private _infoMsg = if (count _oldAddons > 3) then {
90+
format ["The following files are outdated: %1, and %2 more.<br/>ACE Main version is %3 from folder ""%4"".<br/><br/>All mod folders with ACE files: %5", (_oldAddons select [0, 3]) joinString ", ", (count _oldAddons) - 3, _mainVersion, _mainSource, _allSources joinString ", "];
8991
} else {
90-
_errorMsg = _errorMsg + "<br/><br/>Reason: Mismatched addon versions within the same installation, it is likely corrupted.<br/><br/>Fix: Repair ACE or update your repack.";
92+
_infoMsgLog
9193
};
9294

95+
// Log it
96+
private _logMsg = format ["%1: %2%5%3%5%5%4", _title, _reasonMsg, _fixMsg, _infoMsgLog, endl];
97+
_logMsg = _logMsg regexReplace ["<br\/>", endl];
98+
ERROR(_logMsg);
99+
100+
// Display it
93101
if (hasInterface) then {
94-
["[ACE] ERROR", _errorMsg] call FUNC(errorMessage);
102+
private _errorMsg = format ["%1<br/>%2<br/><br/>%3", _reasonMsg, _fixMsg, _infoMsg];
103+
[_title, _errorMsg] call FUNC(errorMessage);
95104
};
96-
97-
ERROR(_errorMsg);
98105
};
99106

100107
if (_oldCompats isNotEqualTo []) then {
@@ -175,10 +182,10 @@ if (isMultiplayer) then {
175182
private _title = "[ACE] ERROR: ADDON MISMATCH";
176183

177184
// We don't need to know what's happening to build info here
178-
private _infoMsgLog = format ["Client has additional addons: %1.<br/>Server mod folder is named ""%2"".", _addons joinString ", ", GVAR(serverSource)]; // Build the whole thing so we can log it to RPT
185+
private _infoMsgLog = format ["Client has additional addons: %1.<br/>Server mod folder is named ""%2"".", _additionalAddons joinString ", ", GVAR(serverSource)]; // Build the whole thing so we can log it to RPT
179186

180-
private _infoMsg = if (count _addons > 3) then { // Truncate it for display
181-
format ["Client has additional addons: %1, and %2 more.<br/>Server mod folder is named ""%3"".", (_addons select [0, 3]) joinString ", ", (count _addons) - 3, GVAR(serverSource)];
187+
private _infoMsg = if (count _additionalAddons > 3) then { // Truncate it for display
188+
format ["Client has additional addons: %1, and %2 more.<br/>Server mod folder is named ""%3"".", (_additionalAddons select [0, 3]) joinString ", ", (count _additionalAddons) - 3, GVAR(serverSource)];
182189
} else {
183190
_infoMsgLog
184191
};
@@ -204,20 +211,22 @@ if (isMultiplayer) then {
204211
} forEach (getArray (_cfgPatches >> _x >> "requiredAddons"));
205212
} forEach _additionalCompats;
206213

207-
_reasonMsg = format ["Reason: %1", "Client has extra mods requiring compats loaded (see list below)<br/><br/>"];
208-
_reasonMsg = _reasonMsg + format ["Additional compatibility is being loaded for: %1", _additionalMods joinString ", "];
214+
private _reasonMsg = format ["Reason: %1", "Client has extra mods requiring compats loaded (see list below)"];
215+
private _additionalModsString = format ["<br/><br/>Additional compatibility is being loaded for: %1", _additionalMods joinString ", "];
216+
_infoMsg = _infoMsg + _additionalModsString;
217+
_infoMsgLog = _infoMsgLog + _additionalModsString;
209218

210219
[_title, _reasonMsg, _fixMsg, _infoMsg, _infoMsgLog] // return
211220
};
212221

213222
// Server most likely just uses a different ACE repack with some components removed
214-
_reasonMsg = format ["Reason: %1", "Client and Server use ACE from different sources."];
215-
_fixMsg = format ["Fix: %1", "Make sure you're using ACE from the same workshop item or repository."];
223+
private _reasonMsg = format ["Reason: %1", "Client has ACE addons not present on the server."];
224+
private _fixMsg = format ["Fix: %1", "Make sure you're using ACE from the same Steam Workshop item or repository as the server."];
216225

217226
[_title, _reasonMsg, _fixMsg, _infoMsg, _infoMsgLog] // return
218227
};
219228

220-
private _fnc_check = {
229+
private _fnc_multiplayerCheck = {
221230
// Check if we'll actually throw an error
222231
private _versionMismatch = GVAR(clientVersion) != GVAR(serverVersion);
223232
private _additionalAddons = GVAR(clientAddons) - GVAR(serverAddons);
@@ -237,7 +246,8 @@ if (isMultiplayer) then {
237246
(call _errorBuilder) params ["_title", "_reasonMsg", "_fixMsg", "_infoMsg", "_infoMsgLog"];
238247

239248
// Log it
240-
private _logMsg = format ["%1: %2<br/>%3<br/><br/>%4", _title, _reasonMsg, _fixMsg, _infoMsgLog];
249+
private _logMsg = format ["%1: %2%5%3%5%5%4", _title, _reasonMsg, _fixMsg, _infoMsgLog, endl];
250+
_logMsg = _logMsg regexReplace ["<br\/>", endl];
241251
ERROR(_logMsg);
242252

243253
// Display it
@@ -251,9 +261,9 @@ if (isMultiplayer) then {
251261

252262
// Clients have to wait for the variables
253263
if (isNil QGVAR(serverVersion) || isNil QGVAR(serverAddons)) then {
254-
QGVAR(serverVersion) addPublicVariableEventHandler _fnc_check;
264+
QGVAR(serverVersion) addPublicVariableEventHandler _fnc_multiplayerCheck;
255265
} else {
256-
call _fnc_check;
266+
call _fnc_multiplayerCheck;
257267
};
258268
};
259269
};

0 commit comments

Comments
 (0)