diff options
author | Filippos Karapetis | 2015-07-17 10:38:47 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-15 00:05:02 +0100 |
commit | e35307ccba5b62979e3ee58d9606cb519c54ace3 (patch) | |
tree | 6698a22001d98d5530ea04f549e649893e28694c /engines/lab | |
parent | 047df0b0e8d85593dd8200a169f0a68a66c138c2 (diff) | |
download | scummvm-rg350-e35307ccba5b62979e3ee58d9606cb519c54ace3.tar.gz scummvm-rg350-e35307ccba5b62979e3ee58d9606cb519c54ace3.tar.bz2 scummvm-rg350-e35307ccba5b62979e3ee58d9606cb519c54ace3.zip |
LAB: Simplify initLabText()
Diffstat (limited to 'engines/lab')
-rw-r--r-- | engines/lab/labtext.cpp | 143 |
1 files changed, 71 insertions, 72 deletions
diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp index 3c26ea7839..4284865847 100644 --- a/engines/lab/labtext.cpp +++ b/engines/lab/labtext.cpp @@ -65,78 +65,77 @@ static void setString(char **string) { /* Initializes everything for the Labyrinth text stuff */ /*****************************************************************************/ bool initLabText() { - if ((SizeOfMemChunk = sizeOfFile(LABTEXTFILE))) - if ((BeginOfMemChunk = (char *)calloc(SizeOfMemChunk, 1))) { - Common::File *file = openPartial(LABTEXTFILE); - - if (file) { - file->read(BeginOfMemChunk, SizeOfMemChunk); - file->close(); - - CurPlace = BeginOfMemChunk; - - setString(&LOWERFLOORS); - setString(&MIDDLEFLOORS); - setString(&UPPERFLOORS); - setString(&MEDMAZEFLOORS); - setString(&HEDGEMAZEFLOORS); - setString(&SURMAZEFLOORS); - setString(&CARNIVALFLOOR); - setString(&SURMAZEMSG); - - setString(&FACINGNORTH); - setString(&FACINGEAST); - setString(&FACINGSOUTH); - setString(&FACINGWEST); - - setString(&LAMPONMSG); - - setString(&TURNLEFT); - setString(&TURNRIGHT); - setString(&GOFORWARDDIR); - setString(&NOPATH); - setString(&TAKEITEM); - - setString(&SAVETEXT); - setString(&LOADTEXT); - setString(&BOOKMARKTEXT); - setString(&PERSONALTEXT); - setString(&DISKTEXT); - - setString(&SAVEBOOK); - setString(&RESTOREBOOK); - setString(&SAVEFLASH); - setString(&RESTOREFLASH); - setString(&SAVEDISK); - setString(&RESTOREDISK); - setString(&NODISKINDRIVE); - setString(&WRITEPROTECTED); - setString(&SELECTDISK); - - setString(&FORMATFLOPPY); - setString(&FORMATTING); - - setString(&NOTHING); - setString(&USEONWHAT); - setString(&TAKEWHAT); - setString(&MOVEWHAT); - setString(&OPENWHAT); - setString(&CLOSEWHAT); - setString(&LOOKWHAT); - - setString(&USEMAP); - setString(&USEJOURNAL); - setString(&TURNLAMPON); - setString(&TURNLAMPOFF); - setString(&USEWHISKEY); - setString(&USEPITH); - setString(&USEHELMET); - - return true; - } - } - - return false; + Common::File *file = openPartial(LABTEXTFILE); + if (!file) + return false; + + SizeOfMemChunk = file->size(); + if (!SizeOfMemChunk || !(BeginOfMemChunk = (char *)calloc(SizeOfMemChunk, 1))) + return false; + + file->read(BeginOfMemChunk, SizeOfMemChunk); + file->close(); + + CurPlace = BeginOfMemChunk; + + setString(&LOWERFLOORS); + setString(&MIDDLEFLOORS); + setString(&UPPERFLOORS); + setString(&MEDMAZEFLOORS); + setString(&HEDGEMAZEFLOORS); + setString(&SURMAZEFLOORS); + setString(&CARNIVALFLOOR); + setString(&SURMAZEMSG); + + setString(&FACINGNORTH); + setString(&FACINGEAST); + setString(&FACINGSOUTH); + setString(&FACINGWEST); + + setString(&LAMPONMSG); + + setString(&TURNLEFT); + setString(&TURNRIGHT); + setString(&GOFORWARDDIR); + setString(&NOPATH); + setString(&TAKEITEM); + + setString(&SAVETEXT); + setString(&LOADTEXT); + setString(&BOOKMARKTEXT); + setString(&PERSONALTEXT); + setString(&DISKTEXT); + + setString(&SAVEBOOK); + setString(&RESTOREBOOK); + setString(&SAVEFLASH); + setString(&RESTOREFLASH); + setString(&SAVEDISK); + setString(&RESTOREDISK); + setString(&NODISKINDRIVE); + setString(&WRITEPROTECTED); + setString(&SELECTDISK); + + setString(&FORMATFLOPPY); + setString(&FORMATTING); + + setString(&NOTHING); + setString(&USEONWHAT); + setString(&TAKEWHAT); + setString(&MOVEWHAT); + setString(&OPENWHAT); + setString(&CLOSEWHAT); + setString(&LOOKWHAT); + + setString(&USEMAP); + setString(&USEJOURNAL); + setString(&TURNLAMPON); + setString(&TURNLAMPOFF); + setString(&USEWHISKEY); + setString(&USEPITH); + setString(&USEHELMET); + + return true; } |