From 0fe605be4b4f6c5890088c5f59e367f4074f8a0f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 12 Jun 2014 10:16:14 +0300 Subject: FULLPIPE: Implement GameVar::~GameVar() --- engines/fullpipe/stateloader.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 41641457d3..141196c7d7 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -162,7 +162,43 @@ GameVar::GameVar() { } GameVar::~GameVar() { - warning("STUB: GameVar::~GameVar()"); + if (_varType == 2) + free(_value.stringValue); + + if (_parentVarObj && !_prevVarObj ) { + if (_parentVarObj->_subVars == this) { + _parentVarObj->_subVars = _nextVarObj; + } else if (_parentVarObj->_field_14 == this) { + _parentVarObj->_field_14 = _nextVarObj; + } else { + _parentVarObj = 0; + } + } + + if (_prevVarObj) + _prevVarObj->_nextVarObj = _nextVarObj; + + if (_nextVarObj) + _nextVarObj->_prevVarObj = _prevVarObj; + + _prevVarObj = 0; + _nextVarObj = 0; + + GameVar *s = _subVars; + + while (s) { + delete s; + s = _subVars; + } + + s = _field_14; + + while (s) { + delete s; + s = _field_14; + } + + free(_varName); } bool GameVar::load(MfcArchive &file) { -- cgit v1.2.3