[Scummvm-git-logs] scummvm master -> 2fd5d82078605b17d59343dd2f6b55d75e86601b
dreammaster
paulfgilbert at gmail.com
Sun Jul 7 02:59:50 CEST 2019
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:
2fd5d82078 GLK: ALAN3: Refactoring save code to see if it fixes openpandora gcc
Commit: 2fd5d82078605b17d59343dd2f6b55d75e86601b
https://github.com/scummvm/scummvm/commit/2fd5d82078605b17d59343dd2f6b55d75e86601b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-07-06T17:59:39-07:00
Commit Message:
GLK: ALAN3: Refactoring save code to see if it fixes openpandora gcc
Changed paths:
engines/glk/alan2/alan2.cpp
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp
index 7e942b1..9b2478f 100644
--- a/engines/glk/alan2/alan2.cpp
+++ b/engines/glk/alan2/alan2.cpp
@@ -124,57 +124,64 @@ void syncVal(Common::Serializer &s, uint32 *fld) {
s.syncAsUint32LE(v);
}
-void Alan2::synchronizeSave(Common::Serializer &s) {
- AtrElem *atr;
- Aword i;
-
- // Sync current values
- cur.synchronize(s);
-
- // Save actors
- for (i = ACTMIN; i <= ACTMAX; ++i) {
+static void syncActors(Common::Serializer &s) {
+ for (uint i = ACTMIN; i <= ACTMAX; ++i) {
syncVal(s, &acts[i - ACTMIN].loc);
syncVal(s, &acts[i - ACTMIN].script);
syncVal(s, &acts[i - ACTMIN].step);
syncVal(s, &acts[i - ACTMIN].count);
if (acts[i - ACTMIN].atrs) {
- for (atr = (AtrElem *)addrTo(acts[i - ACTMIN].atrs); !endOfTable(atr); ++atr)
+ for (AtrElem *atr = (AtrElem *)addrTo(acts[i - ACTMIN].atrs); !endOfTable(atr); ++atr)
syncVal(s, &atr->val);
}
}
+}
- // Sync locations
- for (i = LOCMIN; i <= LOCMAX; ++i) {
+static void syncLocations(Common::Serializer &s) {
+ for (uint i = LOCMIN; i <= LOCMAX; ++i) {
syncVal(s, &locs[i - LOCMIN].describe);
if (locs[i - LOCMIN].atrs)
- for (atr = (AtrElem *)addrTo(locs[i - LOCMIN].atrs); !endOfTable(atr); atr++)
+ for (AtrElem *atr = (AtrElem *)addrTo(locs[i - LOCMIN].atrs); !endOfTable(atr); atr++)
syncVal(s, &atr->val);
}
+}
- // Sync objects
- for (i = OBJMIN; i <= OBJMAX; ++i) {
+static void syncObjects(Common::Serializer &s) {
+ for (uint i = OBJMIN; i <= OBJMAX; ++i) {
syncVal(s, &objs[i - OBJMIN].loc);
if (objs[i - OBJMIN].atrs)
- for (atr = (AtrElem *)addrTo(objs[i - OBJMIN].atrs); !endOfTable(atr); atr++)
+ for (AtrElem *atr = (AtrElem *)addrTo(objs[i - OBJMIN].atrs); !endOfTable(atr); atr++)
syncVal(s, &atr->val);
}
+}
- // Sync the event queue
+static void syncEventQueue(Common::Serializer &s) {
if (s.isSaving()) {
eventq[etop].time = 0; // Mark the top
- for (i = 0; i <= (Aword)etop; ++i)
+ for (int i = 0; i <= etop; ++i)
eventq[i].synchronize(s);
} else {
for (etop = 0; eventq[etop - 1].time; ++etop)
eventq[etop].synchronize(s);
--etop;
}
+}
- // Sync scores
- for (i = 0; scores[i] != EOD; i++)
+static void syncScores(Common::Serializer &s) {
+ for (int i = 0; scores[i] != EOD; i++)
syncVal(s, &scores[i]);
}
+void Alan2::synchronizeSave(Common::Serializer &s) {
+ // Sync various savegame data
+ cur.synchronize(s);
+ syncActors(s);
+ syncLocations(s);
+ syncObjects(s);
+ syncEventQueue(s);
+ syncScores(s);
+}
+
} // End of namespace Alan2
} // End of namespace Glk
More information about the Scummvm-git-logs
mailing list