diff options
author | yinsimei | 2017-05-29 08:02:59 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-13 18:27:45 +0200 |
commit | ca2ee02496f232a53ed6c96bd296e0941da636f6 (patch) | |
tree | d975887a6cead9e711afddb2053020db68a7914b /engines/sludge/newfatal.cpp | |
parent | 2dddb900c9b6d4356a19886cd31587a049be23d8 (diff) | |
download | scummvm-rg350-ca2ee02496f232a53ed6c96bd296e0941da636f6.tar.gz scummvm-rg350-ca2ee02496f232a53ed6c96bd296e0941da636f6.tar.bz2 scummvm-rg350-ca2ee02496f232a53ed6c96bd296e0941da636f6.zip |
SLUDGE: code formatting
Diffstat (limited to 'engines/sludge/newfatal.cpp')
-rw-r--r-- | engines/sludge/newfatal.cpp | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/engines/sludge/newfatal.cpp b/engines/sludge/newfatal.cpp index 5c8a36db36..477a7f9673 100644 --- a/engines/sludge/newfatal.cpp +++ b/engines/sludge/newfatal.cpp @@ -41,7 +41,9 @@ namespace Sludge { const char emergencyMemoryMessage[] = "Out of memory displaying error message!"; static char *fatalMessage = NULL; -static char *fatalInfo = joinStrings("Initialisation error! Something went wrong before we even got started!", ""); +static char *fatalInfo = + joinStrings("Initialisation error! Something went wrong before we even got started!", + ""); extern int numResourceNames /* = 0*/; extern char * *allResourceNames /*= NULL*/; @@ -49,14 +51,18 @@ extern char * *allResourceNames /*= NULL*/; int resourceForFatal = -1; const char *resourceNameFromNum(int i) { - if (i == -1) return NULL; - if (numResourceNames == 0) return "RESOURCE"; - if (i < numResourceNames) return allResourceNames[i]; + if (i == -1) + return NULL; + if (numResourceNames == 0) + return "RESOURCE"; + if (i < numResourceNames) + return allResourceNames[i]; return "Unknown resource"; } bool hasFatal() { - if (fatalMessage) return true; + if (fatalMessage) + return true; return false; } @@ -77,7 +83,10 @@ void warning(const char *l) { void registerWindowForFatal() { delete fatalInfo; - fatalInfo = joinStrings("There's an error with this SLUDGE game! If you're designing this game, please turn on verbose error messages in the project manager and recompile. If not, please contact the author saying where and how this problem occured.", ""); + fatalInfo = + joinStrings( + "There's an error with this SLUDGE game! If you're designing this game, please turn on verbose error messages in the project manager and recompile. If not, please contact the author saying where and how this problem occured.", + ""); } #if 0 @@ -93,8 +102,8 @@ int inFatal(const char *str) { } #endif fatalMessage = copyString(str); - if (fatalMessage == NULL) fatalMessage = copyString("Out of memory"); - + if (fatalMessage == NULL) + fatalMessage = copyString("Out of memory"); killSoundStuff(); @@ -120,8 +129,10 @@ int checkNew(const void *mem) { void setFatalInfo(const char *userFunc, const char *BIF) { delete fatalInfo; - fatalInfo = new char [strlen(userFunc) + strlen(BIF) + 38]; - if (fatalInfo) sprintf(fatalInfo, "Currently in this sub: %s\nCalling: %s", userFunc, BIF); + fatalInfo = new char[strlen(userFunc) + strlen(BIF) + 38]; + if (fatalInfo) + sprintf(fatalInfo, "Currently in this sub: %s\nCalling: %s", userFunc, + BIF); debug("%s", fatalInfo); } @@ -132,17 +143,20 @@ void setResourceForFatal(int n) { int fatal(const char *str1) { if (numResourceNames && resourceForFatal != -1) { const char *r = resourceNameFromNum(resourceForFatal); - char *newStr = new char[strlen(str1) + strlen(r) + strlen(fatalInfo) + 14]; + char *newStr = new char[strlen(str1) + strlen(r) + strlen(fatalInfo) + + 14]; if (checkNew(newStr)) { sprintf(newStr, "%s\nResource: %s\n\n%s", fatalInfo, r, str1); inFatal(newStr); - } else fatal(emergencyMemoryMessage); + } else + fatal(emergencyMemoryMessage); } else { char *newStr = new char[strlen(str1) + strlen(fatalInfo) + 3]; if (checkNew(newStr)) { sprintf(newStr, "%s\n\n%s", fatalInfo, str1); inFatal(newStr); - } else fatal(emergencyMemoryMessage); + } else + fatal(emergencyMemoryMessage); } return 0; } @@ -152,7 +166,8 @@ int fatal(const char *str1, const char *str2) { if (checkNew(newStr)) { sprintf(newStr, "%s %s", str1, str2); fatal(newStr); - } else fatal(emergencyMemoryMessage); + } else + fatal(emergencyMemoryMessage); return 0; } |