diff options
author | Eugene Sandulenko | 2013-06-02 22:52:37 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:48:07 +0300 |
commit | 82cbf508b57f1b01ef06f0cd8dea9d53874203a4 (patch) | |
tree | 990adcb418b205cad2397dacdcf98730aacf4120 /engines | |
parent | fa30dcef152aab077346ecf08e5436609535ef13 (diff) | |
download | scummvm-rg350-82cbf508b57f1b01ef06f0cd8dea9d53874203a4.tar.gz scummvm-rg350-82cbf508b57f1b01ef06f0cd8dea9d53874203a4.tar.bz2 scummvm-rg350-82cbf508b57f1b01ef06f0cd8dea9d53874203a4.zip |
FULLPIPE: Refactored pascal style string reader
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/objects.h | 5 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 25 |
2 files changed, 13 insertions, 17 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index 5e4b28866b..dbeb7bc07b 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -67,7 +67,7 @@ class SceneTagList { CPtrList list; public: - SceneTagList(Common::File &file); + SceneTagList(CFile &file); }; class GameProject { @@ -78,7 +78,8 @@ class GameProject { int _field_10; public: - GameProject(Common::File &file); + GameProject(CFile &file); + ~GameProject(); }; class CInteractionController { diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 9a45fadcee..60b83a04db 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -24,6 +24,7 @@ #include "common/file.h" +#include "fullpipe/utils.h" #include "fullpipe/objects.h" namespace Fullpipe { @@ -40,17 +41,12 @@ bool FullpipeEngine::loadGam(const char *fname) { } bool CGameLoader::loadFile(const char *fname) { - Common::File file; + CFile file; if (!file.open(fname)) return false; - char *tmp; - int len = file.readByte(); - tmp = (char *)calloc(len + 1, 1); - file.read(tmp, len); - - _gameName = tmp; + _gameName = file.readPascalString(); _gameProject = new GameProject(file); @@ -61,7 +57,7 @@ CGameLoader::~CGameLoader() { free(_gameName); } -GameProject::GameProject(Common::File &file) { +GameProject::GameProject(CFile &file) { _field_4 = 0; _headerFilename = 0; _field_10 = 12; @@ -71,12 +67,7 @@ GameProject::GameProject(Common::File &file) { int _gameProjectValue = file.readUint16LE(); int _scrollSpeed = file.readUint32LE(); - char *tmp; - int len = file.readByte(); - tmp = (char *)calloc(len + 1, 1); - file.read(tmp, len); - - _headerFilename = tmp; + _headerFilename = file.readPascalString(); _sceneTagList = new SceneTagList(file); @@ -94,7 +85,11 @@ GameProject::GameProject(Common::File &file) { } } -SceneTagList::SceneTagList(Common::File &file) { +GameProject::~GameProject() { + free(_headerFilename); +} + +SceneTagList::SceneTagList(CFile &file) { } } // End of namespace Fullpipe |