PARA: Fixed some memory leaks

svn-id: r32519
This commit is contained in:
Christopher Page 2008-06-03 18:24:54 +00:00
parent 0cbfc3a9d1
commit fa75221e48
6 changed files with 21 additions and 29 deletions

View File

@ -84,18 +84,18 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam
Parallaction::~Parallaction() {
clearSet(_commandOpcodes);
clearSet(_instructionOpcodes);
delete _debugger;
delete _globalTable;
delete _callableNames;
//delete _localFlagNames;
freeLocation();
freeCharacter();
destroyInventory();
delete _localFlagNames;
delete _gfx;
delete _soundMan;
@ -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() {
@ -534,10 +536,10 @@ void Character::free() {
delete _objs;
delete _ani->gfxobj;
_ani->gfxobj = NULL;
_talk = NULL;
_head = NULL;
_objs = NULL;
_ani->gfxobj = NULL;
return;
}

View File

@ -385,6 +385,9 @@ protected: // members
int16 pickupItem(ZonePtr z);
void clearSet(OpcodeSet &opcodes);
public:
virtual void callFunction(uint index, void* parm) { }
@ -401,6 +404,7 @@ public:
void beep();
public:
// const char **_zoneFlagNamesRes;
// const char **_zoneTypeNamesRes;

View File

@ -154,7 +154,9 @@ int Parallaction_ns::init() {
Parallaction_ns::~Parallaction_ns() {
freeFonts();
delete _locationParser;
delete _programParser;
delete _mouseComposedArrow;
_location._animations.remove(_char._ani);

View File

@ -30,10 +30,7 @@ namespace Parallaction {
char _tokens[20][MAX_TOKEN_LEN];
Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {
// clearAllTokens();
}
Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {}
Script::~Script() {
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) {
while (scumm_stricmp(_tokens[0], endToken)) {

View File

@ -44,7 +44,6 @@ class Script {
uint _line; // for debug messages
void clearTokens();
//void clearAllTokens();
uint16 fillTokens(char* line);
public:
@ -222,7 +221,6 @@ public:
virtual ~LocationParser_ns() {
delete _parser;
delete _script;
delete _commandsNames;
delete _locationStmt;
delete _locationZoneStmt;
@ -230,8 +228,6 @@ public:
delete _zoneTypeNames;
delete _zoneFlagNames;
delete _parser;
clearSet(_commandParsers);
clearSet(_locationAnimParsers);
clearSet(_locationZoneParsers);
@ -361,7 +357,9 @@ public:
}
virtual ~ProgramParser_ns() {
delete _parser;
delete _instructionNames;
clearSet(_instructionParsers);
}

View File

@ -1396,7 +1396,7 @@ void LocationParser_ns::parseZone(ZoneList &list, char *name) {
list.push_front(z);
_parser->pushTables(&_locationZoneParsers, _locationZoneStmt);
return;
}