diff options
author | Denis Kasak | 2009-07-14 00:41:17 +0000 |
---|---|---|
committer | Denis Kasak | 2009-07-14 00:41:17 +0000 |
commit | 25b884512d10023fb0004337bbe4ec47f83c6650 (patch) | |
tree | 8ac4c7e830856cd8225d84d45ba9e5b2becc0a01 /engines/draci | |
parent | 04e4bfdbbed01d71f3d5c74d4e3a2090430a1b35 (diff) | |
download | scummvm-rg350-25b884512d10023fb0004337bbe4ec47f83c6650.tar.gz scummvm-rg350-25b884512d10023fb0004337bbe4ec47f83c6650.tar.bz2 scummvm-rg350-25b884512d10023fb0004337bbe4ec47f83c6650.zip |
Made Game allocate its _info member statically instead of dinamically.
svn-id: r42464
Diffstat (limited to 'engines/draci')
-rw-r--r-- | engines/draci/game.cpp | 50 | ||||
-rw-r--r-- | engines/draci/game.h | 2 |
2 files changed, 25 insertions, 27 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index e7f1b2d454..8a4500c04c 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -72,24 +72,23 @@ Game::Game(DraciEngine *vm) : _vm(vm) { file = initArchive.getFile(3); Common::MemoryReadStream gameData(file->_data, file->_length); - _info = new GameInfo(); - _info->_currentRoom = gameData.readByte() - 1; - _info->_mapRoom = gameData.readByte() - 1; - _info->_numObjects = gameData.readUint16LE(); - _info->_numIcons = gameData.readUint16LE(); - _info->_numVariables = gameData.readByte(); - _info->_numPersons = gameData.readByte(); - _info->_numDialogs = gameData.readByte(); - _info->_maxIconWidth = gameData.readUint16LE(); - _info->_maxIconHeight = gameData.readUint16LE(); - _info->_musicLength = gameData.readUint16LE(); - _info->_crc[0] = gameData.readUint16LE(); - _info->_crc[1] = gameData.readUint16LE(); - _info->_crc[2] = gameData.readUint16LE(); - _info->_crc[3] = gameData.readUint16LE(); - - _info->_numDialogBlocks = curOffset; + _info._currentRoom = gameData.readByte() - 1; + _info._mapRoom = gameData.readByte() - 1; + _info._numObjects = gameData.readUint16LE(); + _info._numIcons = gameData.readUint16LE(); + _info._numVariables = gameData.readByte(); + _info._numPersons = gameData.readByte(); + _info._numDialogs = gameData.readByte(); + _info._maxIconWidth = gameData.readUint16LE(); + _info._maxIconHeight = gameData.readUint16LE(); + _info._musicLength = gameData.readUint16LE(); + _info._crc[0] = gameData.readUint16LE(); + _info._crc[1] = gameData.readUint16LE(); + _info._crc[2] = gameData.readUint16LE(); + _info._crc[3] = gameData.readUint16LE(); + + _info._numDialogBlocks = curOffset; // Read in variables @@ -128,11 +127,11 @@ Game::Game(DraciEngine *vm) : _vm(vm) { _objects[i]._location = (~(1 << 7) & tmp) - 1; } - assert(numDialogs == _info->_numDialogs); - assert(numPersons == _info->_numPersons); - assert(numVariables == _info->_numVariables); - assert(numObjects == _info->_numObjects); - assert(numIcons == _info->_numIcons); + assert(numDialogs == _info._numDialogs); + assert(numPersons == _info._numPersons); + assert(numVariables == _info._numVariables); + assert(numObjects == _info._numObjects); + assert(numIcons == _info._numIcons); } void Game::init() { @@ -172,7 +171,7 @@ void Game::loadRoom(int roomNum) { _currentRoom._escRoom = roomReader.readByte() - 1; _currentRoom._numGates = roomReader.readByte(); - for (uint i = 0; i < _info->_numObjects; ++i) { + for (uint i = 0; i < _info._numObjects; ++i) { debugC(1, kDraciLogicDebugLevel, "Checking if object %d (%d) is at the current location (%d)", i, _objects[i]._location, roomNum); @@ -186,7 +185,7 @@ void Game::loadRoom(int roomNum) { // Run the init scripts for room objects // We can't do this in the above loop because some objects' scripts reference // other objects that may not yet be loaded - for (uint i = 0; i < _info->_numObjects; ++i) { + for (uint i = 0; i < _info._numObjects; ++i) { if (_objects[i]._location == roomNum) { _vm->_script->run(getObject(i)->_program, getObject(i)->_init); } @@ -328,7 +327,7 @@ void Game::changeRoom(uint roomNum) { int oldRoomNum = _currentRoom._roomNum; - for (uint i = 0; i < _info->_numObjects; ++i) { + for (uint i = 0; i < _info._numObjects; ++i) { GameObject *obj = &_objects[i]; if (i != 0 && obj->_location == oldRoomNum) { @@ -366,7 +365,6 @@ Game::~Game() { delete[] _dialogOffsets; delete[] _iconStatus; delete[] _objects; - delete _info; } GameObject::~GameObject() { diff --git a/engines/draci/game.h b/engines/draci/game.h index c9f913dbc8..c68990dace 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -147,7 +147,7 @@ public: private: DraciEngine *_vm; int *_variables; - GameInfo *_info; + GameInfo _info; Person *_persons; uint16 *_dialogOffsets; byte *_iconStatus; |