aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/variables.h
diff options
context:
space:
mode:
authorSven Hesse2008-07-12 15:21:38 +0000
committerSven Hesse2008-07-12 15:21:38 +0000
commitc1ec21d999253d86513ce66876c692be198b91c0 (patch)
treed4e514987d92251eb1dca5c410d5332407bdc2dc /engines/gob/variables.h
parent7ddd961bf2ded1d9cad114ea03018d44258e9ca8 (diff)
downloadscummvm-rg350-c1ec21d999253d86513ce66876c692be198b91c0.tar.gz
scummvm-rg350-c1ec21d999253d86513ce66876c692be198b91c0.tar.bz2
scummvm-rg350-c1ec21d999253d86513ce66876c692be198b91c0.zip
Changed tricky variable access from pointers to a new class that minds endianess.
This should fix a few regressions with BE games on LE systems and vice versa that I introduced when I changed how variables are stored (which was necessary to get Woodruff work on BE systems). svn-id: r33014
Diffstat (limited to 'engines/gob/variables.h')
-rw-r--r--engines/gob/variables.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/engines/gob/variables.h b/engines/gob/variables.h
index 5989ed38ee..32f160a6bd 100644
--- a/engines/gob/variables.h
+++ b/engines/gob/variables.h
@@ -30,6 +30,12 @@ namespace Gob {
class Variables {
public:
+ enum Type {
+ kVariableType8,
+ kVariableType16,
+ kVariableType32
+ };
+
Variables(uint32 size);
virtual ~Variables();
@@ -142,6 +148,26 @@ protected:
uint32 read32(const byte *buf) const;
};
+class VariableReference {
+ public:
+ VariableReference();
+ VariableReference(Variables &vars, uint32 offset,
+ Variables::Type type = Variables::kVariableType32);
+ ~VariableReference();
+
+ void set(Variables &vars, uint32 offset, Variables::Type type = Variables::kVariableType32);
+
+ VariableReference &operator=(uint32 value);
+ VariableReference &operator+=(uint32 value);
+ VariableReference &operator*=(uint32 value);
+ operator uint32();
+
+ private:
+ Variables *_vars;
+ uint32 _offset;
+ Variables::Type _type;
+};
+
} // End of namespace Gob
#endif // GOB_VARIABLES_H