diff options
author | dreammaster | 2019-06-22 03:41:11 +0100 |
---|---|---|
committer | Paul Gilbert | 2019-06-22 14:40:50 -0700 |
commit | a3fa9d12a94494f86134f56df6c064d7e48e8580 (patch) | |
tree | 7de5f43a53a281039bfa574ccd7bcc91efa84cf6 /engines/glk/alan2/alan2.cpp | |
parent | dd4108e7c79770ec8235bd4440e0cdc06becd9d9 (diff) | |
download | scummvm-rg350-a3fa9d12a94494f86134f56df6c064d7e48e8580.tar.gz scummvm-rg350-a3fa9d12a94494f86134f56df6c064d7e48e8580.tar.bz2 scummvm-rg350-a3fa9d12a94494f86134f56df6c064d7e48e8580.zip |
GLK: ALAN2: Fix gcc errors for references to packed struct fields
Diffstat (limited to 'engines/glk/alan2/alan2.cpp')
-rw-r--r-- | engines/glk/alan2/alan2.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp index 73b8a5e1a3..05e52335b5 100644 --- a/engines/glk/alan2/alan2.cpp +++ b/engines/glk/alan2/alan2.cpp @@ -91,6 +91,12 @@ Common::Error Alan2::writeGameData(Common::WriteStream *ws) { return Common::kNoError; } +// This works around gcc errors for passing packed structure fields +void syncVal(Common::Serializer &s, uint32 *fld) { + uint32 &v = *fld; + s.syncAsUint32LE(v); +} + void Alan2::synchronizeSave(Common::Serializer &s) { AtrElem *atr; int i; @@ -100,31 +106,31 @@ void Alan2::synchronizeSave(Common::Serializer &s) { // Save actors for (i = ACTMIN; i <= ACTMAX; ++i) { - s.syncAsSint32LE(acts[i-ACTMIN].loc); - s.syncAsSint32LE(acts[i-ACTMIN].script); - s.syncAsSint32LE(acts[i-ACTMIN].step); - s.syncAsSint32LE(acts[i-ACTMIN].count); + 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) - s.syncAsSint32LE(atr->val); + syncVal(s, &atr->val); } } // Sync locations for (i = LOCMIN; i <= LOCMAX; ++i) { - s.syncAsSint32LE(locs[i-LOCMIN].describe); + syncVal(s, &locs[i-LOCMIN].describe); if (locs[i-LOCMIN].atrs) for (atr = (AtrElem *)addrTo(locs[i-LOCMIN].atrs); !endOfTable(atr); atr++) - s.syncAsSint32LE(atr->val); + syncVal(s, &atr->val); } // Sync objects for (i = OBJMIN; i <= OBJMAX; ++i) { - s.syncAsSint32LE(objs[i-OBJMIN].loc); + syncVal(s, &objs[i-OBJMIN].loc); if (objs[i-OBJMIN].atrs) for (atr = (AtrElem *)addrTo(objs[i-OBJMIN].atrs); !endOfTable(atr); atr++) - s.syncAsSint32LE(atr->val); + syncVal(s, &atr->val); } // Sync the event queue @@ -140,7 +146,7 @@ void Alan2::synchronizeSave(Common::Serializer &s) { // Sync scores for (i = 0; scores[i] != EOF; i++) - s.syncAsSint32LE(scores[i]); + syncVal(s, &scores[i]); } bool Alan2::is_gamefile_valid() { |