[Scummvm-git-logs] scummvm branch-2-3 -> d260720b80cfea47e03d0fc165466a5a5eba9506
neuromancer
neuromancer at users.noreply.github.com
Fri Sep 17 08:04:40 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d260720b80 PRIVATE: removed and refactored assertions with side effects
Commit: d260720b80cfea47e03d0fc165466a5a5eba9506
https://github.com/scummvm/scummvm/commit/d260720b80cfea47e03d0fc165466a5a5eba9506
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-09-17T10:02:16+02:00
Commit Message:
PRIVATE: removed and refactored assertions with side effects
Changed paths:
engines/private/funcs.cpp
engines/private/private.cpp
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index db1844b5f5..54b0464627 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -748,7 +748,8 @@ static void fTimer(ArgArray args) {
// This pointer is necessary since installTimer needs one
Common::String *s = new Common::String(args[1].u.sym->name->c_str());
if (delay > 0) {
- assert(g_private->installTimer(delay, s));
+ if (!g_private->installTimer(delay, s))
+ error("Timer installation failed!");
} else if (delay == 0) {
g_private->_nextSetting = *s;
// No need to keep the pointer alive
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 08b29635a0..a9d82b816b 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -144,7 +144,8 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
file = test;
} else {
delete test;
- assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
+ if (!_installerArchive.open("SUPPORT/ASSETS.Z"))
+ error("Failed to open SUPPORT/ASSETS.Z");
// if the full game is used
if (!isDemo()) {
if (_installerArchive.hasFile("GAME.DAT"))
@@ -168,7 +169,8 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
}
}
}
- assert(file != NULL);
+ if (file == NULL)
+ error("Unknown version");
return file;
}
@@ -197,7 +199,8 @@ Common::Error PrivateEngine::run() {
initFuncs();
parse(scripts.c_str());
delete file;
- assert(maps.constants.size() > 0);
+ if (maps.constants.size() == 0)
+ error("Failed to parse game script");
// Initialize graphics
initGraphics(_screenW, _screenH, nullptr);
@@ -746,7 +749,7 @@ void PrivateEngine::loadDossier() {
} else if (_dossierPage == 1) {
loadImage(m.page2, x, y);
} else {
- assert(0);
+ error("Invalid page");
}
}
More information about the Scummvm-git-logs
mailing list