diff options
author | Christopher Page | 2008-06-02 21:36:45 +0000 |
---|---|---|
committer | Christopher Page | 2008-06-02 21:36:45 +0000 |
commit | 0cbfc3a9d1b30822373360aa4c398518c9a74990 (patch) | |
tree | 24c865ed3153978aa00df03613b1bdde1a6efe5d /engines/parallaction/parser.h | |
parent | a338d5fdb2715a7b29ae789c632a0cfa05803079 (diff) | |
parent | 6f09c5a9286f97a1fac6e85fa4092295bc779440 (diff) | |
download | scummvm-rg350-0cbfc3a9d1b30822373360aa4c398518c9a74990.tar.gz scummvm-rg350-0cbfc3a9d1b30822373360aa4c398518c9a74990.tar.bz2 scummvm-rg350-0cbfc3a9d1b30822373360aa4c398518c9a74990.zip |
Merged revisions 32348-32349,32351-32356,32358-32411,32413-32441,32443-32445,32449,32453-32454,32456-32457,32459-32462,32464-32465,32467-32492,32494-32503 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
svn-id: r32505
Diffstat (limited to 'engines/parallaction/parser.h')
-rw-r--r-- | engines/parallaction/parser.h | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index e8de07822e..79e9cc7df0 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -60,31 +60,7 @@ public: }; - -class Opcode { - -public: - virtual void operator()() const = 0; - virtual ~Opcode() { } -}; - -template <class T> -class OpcodeImpl : public Opcode { - - typedef void (T::*Fn)(); - - T* _instance; - Fn _fn; - -public: - OpcodeImpl(T* instance, const Fn &fn) : _instance(instance), _fn(fn) { } - - void operator()() const { - (_instance->*_fn)(); - } - -}; - +typedef Common::Functor0<void> Opcode; typedef Common::Array<const Opcode*> OpcodeSet; @@ -233,6 +209,11 @@ protected: uint _numForwardedCommands; void init(); + void clearSet(OpcodeSet &opcodes) { + for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i) + delete *i; + opcodes.clear(); + } public: LocationParser_ns(Parallaction_ns *vm) : _vm(vm) { @@ -248,6 +229,13 @@ public: delete _locationAnimStmt; delete _zoneTypeNames; delete _zoneFlagNames; + + delete _parser; + + clearSet(_commandParsers); + clearSet(_locationAnimParsers); + clearSet(_locationZoneParsers); + clearSet(_locationParsers); } void parse(Script *script); @@ -361,6 +349,11 @@ protected: virtual void parseRValue(ScriptVar &var, const char *str); void init(); + void clearSet(OpcodeSet &opcodes) { + for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i) + delete *i; + opcodes.clear(); + } public: ProgramParser_ns(Parallaction_ns *vm) : _vm(vm) { @@ -369,6 +362,7 @@ public: virtual ~ProgramParser_ns() { delete _instructionNames; + clearSet(_instructionParsers); } void parse(Script *script, ProgramPtr program); @@ -400,6 +394,8 @@ public: virtual ~ProgramParser_br() { delete _instructionNames; + delete _parser; + } }; |