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/objtypes.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/objtypes.cpp')
-rw-r--r-- | engines/sludge/objtypes.cpp | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/engines/sludge/objtypes.cpp b/engines/sludge/objtypes.cpp index ba709777b4..5f82fb0281 100644 --- a/engines/sludge/objtypes.cpp +++ b/engines/sludge/objtypes.cpp @@ -42,8 +42,9 @@ objectType *findObjectType(int i) { objectType *huntType = allObjectTypes; while (huntType) { - if (huntType -> objectNum == i) return huntType; - huntType = huntType -> next; + if (huntType->objectNum == i) + return huntType; + huntType = huntType->next; } return loadObjectType(i); @@ -56,13 +57,13 @@ objectType *loadObjectType(int i) { if (checkNew(newType)) { if (openObjectSlice(i)) { nameNum = get2bytes(bigDataFile); - newType -> r = (byte) getch(bigDataFile); - newType -> g = (byte) getch(bigDataFile); - newType -> b = (byte) getch(bigDataFile); - newType -> speechGap = getch(bigDataFile); - newType -> walkSpeed = getch(bigDataFile); - newType -> wrapSpeech = get4bytes(bigDataFile); - newType -> spinSpeed = get2bytes(bigDataFile); + newType->r = (byte) getch(bigDataFile); + newType->g = (byte) getch(bigDataFile); + newType->b = (byte) getch(bigDataFile); + newType->speechGap = getch(bigDataFile); + newType->walkSpeed = getch(bigDataFile); + newType->wrapSpeech = get4bytes(bigDataFile); + newType->spinSpeed = get2bytes(bigDataFile); if (gameVersion >= VERSION(1, 6)) { // aaLoad @@ -72,13 +73,14 @@ objectType *loadObjectType(int i) { } if (gameVersion >= VERSION(1, 4)) { - newType -> flags = get2bytes(bigDataFile); + newType->flags = get2bytes(bigDataFile); } else { - newType -> flags = 0; + newType->flags = 0; } - newType -> numCom = get2bytes(bigDataFile); - newType -> allCombis = (newType -> numCom) ? new combination[newType -> numCom] : NULL; + newType->numCom = get2bytes(bigDataFile); + newType->allCombis = + (newType->numCom) ? new combination[newType->numCom] : NULL; #if DEBUG_COMBINATIONS FILE *callEventLog = fopen("callEventLog.txt", "at"); @@ -87,9 +89,9 @@ objectType *loadObjectType(int i) { } #endif - for (a = 0; a < newType -> numCom; a ++) { - newType -> allCombis[a].withObj = get2bytes(bigDataFile); - newType -> allCombis[a].funcNum = get2bytes(bigDataFile); + for (a = 0; a < newType->numCom; a++) { + newType->allCombis[a].withObj = get2bytes(bigDataFile); + newType->allCombis[a].funcNum = get2bytes(bigDataFile); #if DEBUG_COMBINATIONS if (callEventLog) { fprintf(callEventLog, "%d(%d) ", newType -> allCombis[a].withObj, newType -> allCombis[a].funcNum); @@ -103,9 +105,9 @@ objectType *loadObjectType(int i) { } #endif finishAccess(); - newType -> screenName = getNumberedString(nameNum); - newType -> objectNum = i; - newType -> next = allObjectTypes; + newType->screenName = getNumberedString(nameNum); + newType->objectNum = i; + newType->next = allObjectTypes; allObjectTypes = newType; return newType; } @@ -116,14 +118,14 @@ objectType *loadObjectType(int i) { objectType *loadObjectRef(Common::SeekableReadStream *stream) { objectType *r = loadObjectType(get2bytes(stream)); - delete r -> screenName; - r -> screenName = readString(stream); + delete r->screenName; + r->screenName = readString(stream); return r; } void saveObjectRef(objectType *r, Common::WriteStream *stream) { - put2bytes(r -> objectNum, stream); - writeString(r -> screenName, stream); + put2bytes(r->objectNum, stream); + writeString(r->screenName, stream); } int getCombinationFunction(int withThis, int thisObject) { @@ -137,9 +139,9 @@ int getCombinationFunction(int withThis, int thisObject) { } #endif - for (i = 0; i < obj -> numCom; i ++) { - if (obj -> allCombis[i].withObj == withThis) { - num = obj -> allCombis[i].funcNum; + for (i = 0; i < obj->numCom; i++) { + if (obj->allCombis[i].withObj == withThis) { + num = obj->allCombis[i].funcNum; break; } } @@ -155,21 +157,21 @@ int getCombinationFunction(int withThis, int thisObject) { } void removeObjectType(objectType *oT) { - objectType * * huntRegion = & allObjectTypes; + objectType * * huntRegion = &allObjectTypes; - while (* huntRegion) { - if ((* huntRegion) == oT) { + while (*huntRegion) { + if ((*huntRegion) == oT) { // FILE * debuggy2 = fopen ("debug.txt", "at"); // fprintf (debuggy2, "DELETING OBJECT TYPE: %p %s\n", oT, oT -> screenName); // fclose (debuggy2); - * huntRegion = oT -> next; - delete oT -> allCombis; - delete oT -> screenName; + *huntRegion = oT->next; + delete oT->allCombis; + delete oT->screenName; delete oT; return; } else { - huntRegion = & ((* huntRegion) -> next); + huntRegion = &((*huntRegion)->next); } } fatal("Can't delete object type: bad pointer"); |