diff options
author | Max Horn | 2003-05-08 15:48:50 +0000 |
---|---|---|
committer | Max Horn | 2003-05-08 15:48:50 +0000 |
commit | 98881c3a6a513c27a06e596c29e0b40b355844f6 (patch) | |
tree | a6ddbd3a2e3aa483bae3d82e63fa2ccb6fc40f13 /scumm/scumm.h | |
parent | 6ab104cc3ca433b672318b3e9bde26f7e882940c (diff) | |
download | scummvm-rg350-98881c3a6a513c27a06e596c29e0b40b355844f6.tar.gz scummvm-rg350-98881c3a6a513c27a06e596c29e0b40b355844f6.tar.bz2 scummvm-rg350-98881c3a6a513c27a06e596c29e0b40b355844f6.zip |
init all VAR_* variables to 0xFF; replaced access to _vars in the form _vars[VAR_*] by VARS(VAR_*) which performs a validity checK; renamed _vars to _scummVars to make sure I updated all places; fixed two places where V6 and newer games would access V5 vars (but there are still some left, it seems); checked VAR access for now only generates a warning
svn-id: r7393
Diffstat (limited to 'scumm/scumm.h')
-rw-r--r-- | scumm/scumm.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scumm/scumm.h b/scumm/scumm.h index be6cc8b911..0f0a976241 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -388,9 +388,19 @@ protected: byte *_arrays; uint16 *_newNames; public: - int32 *_vars; + // VAR is a wrapper around scummVar, which attempts to include additional + // useful information should an illegal var access be detected. + #define VAR(x) scummVar(x, #x, __FILE__, __LINE__) + inline int32& scummVar(byte var, const char *varName, const char *file, int line) + { + if (var == 0xFF) + warning("Illegal access to variable %s in file %s, line %d", varName, file, line); + return _scummVars[var]; + } + protected: int16 _varwatch; + int32 *_scummVars; byte *_bitVars; /* Global resource tables */ |