PARA: Fixed some memory leaks
svn-id: r32519
This commit is contained in:
parent
0cbfc3a9d1
commit
fa75221e48
6 changed files with 21 additions and 29 deletions
|
@ -84,12 +84,12 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam
|
||||||
|
|
||||||
|
|
||||||
Parallaction::~Parallaction() {
|
Parallaction::~Parallaction() {
|
||||||
|
clearSet(_commandOpcodes);
|
||||||
|
clearSet(_instructionOpcodes);
|
||||||
|
|
||||||
delete _debugger;
|
delete _debugger;
|
||||||
|
|
||||||
delete _globalTable;
|
delete _globalTable;
|
||||||
|
|
||||||
delete _callableNames;
|
delete _callableNames;
|
||||||
//delete _localFlagNames;
|
|
||||||
|
|
||||||
freeLocation();
|
freeLocation();
|
||||||
|
|
||||||
|
@ -138,9 +138,11 @@ int Parallaction::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Parallaction::clearSet(OpcodeSet &opcodes) {
|
||||||
|
for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
|
||||||
|
delete *i;
|
||||||
|
opcodes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Parallaction::updateView() {
|
void Parallaction::updateView() {
|
||||||
|
@ -534,10 +536,10 @@ void Character::free() {
|
||||||
delete _objs;
|
delete _objs;
|
||||||
delete _ani->gfxobj;
|
delete _ani->gfxobj;
|
||||||
|
|
||||||
_ani->gfxobj = NULL;
|
|
||||||
_talk = NULL;
|
_talk = NULL;
|
||||||
_head = NULL;
|
_head = NULL;
|
||||||
_objs = NULL;
|
_objs = NULL;
|
||||||
|
_ani->gfxobj = NULL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,6 +385,9 @@ protected: // members
|
||||||
|
|
||||||
int16 pickupItem(ZonePtr z);
|
int16 pickupItem(ZonePtr z);
|
||||||
|
|
||||||
|
void clearSet(OpcodeSet &opcodes);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void callFunction(uint index, void* parm) { }
|
virtual void callFunction(uint index, void* parm) { }
|
||||||
|
|
||||||
|
@ -401,6 +404,7 @@ public:
|
||||||
|
|
||||||
void beep();
|
void beep();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// const char **_zoneFlagNamesRes;
|
// const char **_zoneFlagNamesRes;
|
||||||
// const char **_zoneTypeNamesRes;
|
// const char **_zoneTypeNamesRes;
|
||||||
|
|
|
@ -155,6 +155,8 @@ int Parallaction_ns::init() {
|
||||||
Parallaction_ns::~Parallaction_ns() {
|
Parallaction_ns::~Parallaction_ns() {
|
||||||
freeFonts();
|
freeFonts();
|
||||||
|
|
||||||
|
delete _locationParser;
|
||||||
|
delete _programParser;
|
||||||
delete _mouseComposedArrow;
|
delete _mouseComposedArrow;
|
||||||
|
|
||||||
_location._animations.remove(_char._ani);
|
_location._animations.remove(_char._ani);
|
||||||
|
|
|
@ -30,10 +30,7 @@ namespace Parallaction {
|
||||||
|
|
||||||
char _tokens[20][MAX_TOKEN_LEN];
|
char _tokens[20][MAX_TOKEN_LEN];
|
||||||
|
|
||||||
Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {
|
Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {}
|
||||||
|
|
||||||
// clearAllTokens();
|
|
||||||
}
|
|
||||||
|
|
||||||
Script::~Script() {
|
Script::~Script() {
|
||||||
if (_disposeSource)
|
if (_disposeSource)
|
||||||
|
@ -75,17 +72,6 @@ void Script::clearTokens() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void Script::clearAllTokens() {
|
|
||||||
|
|
||||||
for (uint16 i = 0; i < 20; i++)
|
|
||||||
for (uint16 j = 0; j < 50; j++)
|
|
||||||
_tokens[i][j] = '\0';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Script::skip(const char* endToken) {
|
void Script::skip(const char* endToken) {
|
||||||
|
|
||||||
while (scumm_stricmp(_tokens[0], endToken)) {
|
while (scumm_stricmp(_tokens[0], endToken)) {
|
||||||
|
|
|
@ -44,7 +44,6 @@ class Script {
|
||||||
uint _line; // for debug messages
|
uint _line; // for debug messages
|
||||||
|
|
||||||
void clearTokens();
|
void clearTokens();
|
||||||
//void clearAllTokens();
|
|
||||||
uint16 fillTokens(char* line);
|
uint16 fillTokens(char* line);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -222,7 +221,6 @@ public:
|
||||||
|
|
||||||
virtual ~LocationParser_ns() {
|
virtual ~LocationParser_ns() {
|
||||||
delete _parser;
|
delete _parser;
|
||||||
delete _script;
|
|
||||||
delete _commandsNames;
|
delete _commandsNames;
|
||||||
delete _locationStmt;
|
delete _locationStmt;
|
||||||
delete _locationZoneStmt;
|
delete _locationZoneStmt;
|
||||||
|
@ -230,8 +228,6 @@ public:
|
||||||
delete _zoneTypeNames;
|
delete _zoneTypeNames;
|
||||||
delete _zoneFlagNames;
|
delete _zoneFlagNames;
|
||||||
|
|
||||||
delete _parser;
|
|
||||||
|
|
||||||
clearSet(_commandParsers);
|
clearSet(_commandParsers);
|
||||||
clearSet(_locationAnimParsers);
|
clearSet(_locationAnimParsers);
|
||||||
clearSet(_locationZoneParsers);
|
clearSet(_locationZoneParsers);
|
||||||
|
@ -361,7 +357,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ProgramParser_ns() {
|
virtual ~ProgramParser_ns() {
|
||||||
|
delete _parser;
|
||||||
delete _instructionNames;
|
delete _instructionNames;
|
||||||
|
|
||||||
clearSet(_instructionParsers);
|
clearSet(_instructionParsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue