aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2011-09-13 00:28:31 +0200
committerStrangerke2011-09-13 00:28:31 +0200
commitc9900b605ac8f943bdc3231ba415fdda5ce48964 (patch)
treefe52a877ea048196352d0b383f1a3b2748cd3633 /engines
parent5d8bbc2f48a5c736fbeeb42b31b3fa6e453cc5e1 (diff)
downloadscummvm-rg350-c9900b605ac8f943bdc3231ba415fdda5ce48964.tar.gz
scummvm-rg350-c9900b605ac8f943bdc3231ba415fdda5ce48964.tar.bz2
scummvm-rg350-c9900b605ac8f943bdc3231ba415fdda5ce48964.zip
CGE: Some more cleanup in fileIo
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/cge.cpp4
-rw-r--r--engines/cge/fileio.cpp13
-rw-r--r--engines/cge/fileio.h9
3 files changed, 10 insertions, 16 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index a5967da13e..9ff8a76a30 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -79,8 +79,8 @@ void CGEEngine::init() {
_miniShp = NULL;
_miniShpList = NULL;
_sprite = NULL;
- _dat = new IoHand(kDatName, XCrypt);
- _cat = new BtFile(kCatName, XCrypt);
+ _dat = new IoHand(kDatName);
+ _cat = new BtFile(kCatName);
// Create debugger console
_console = new CGEConsole(this);
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
index 5c63d41ff2..ddefc573f5 100644
--- a/engines/cge/fileio.cpp
+++ b/engines/cge/fileio.cpp
@@ -38,12 +38,11 @@ namespace CGE {
/*-----------------------------------------------------------------------
* IOHand
*-----------------------------------------------------------------------*/
-IoHand::IoHand(Crypt *crypt) : _error(0), _crypt(crypt), _seed(kCryptSeed) {
+IoHand::IoHand() : _error(0) {
_file = new Common::File();
}
-IoHand::IoHand(const char *name, Crypt *crypt)
- : _error(0), _crypt(crypt), _seed(kCryptSeed) {
+IoHand::IoHand(const char *name) : _error(0) {
_file = new Common::File();
_file->open(name);
}
@@ -60,8 +59,7 @@ uint16 IoHand::read(void *buf, uint16 len) {
uint16 bytesRead = _file->read(buf, len);
if (!bytesRead)
error("Read %s - %d bytes", _file->getName(), len);
- if (_crypt)
- _seed = _crypt(buf, len);
+ XCrypt(buf, len);
return bytesRead;
}
@@ -104,9 +102,8 @@ void BtPage::read(Common::ReadStream &s) {
/*-----------------------------------------------------------------------
* BtFile
*-----------------------------------------------------------------------*/
-BtFile::BtFile(const char *name, Crypt *crpt)
- : IoHand(name, crpt) {
- debugC(1, kCGEDebugFile, "BtFile::BtFile(%s, crpt)", name);
+BtFile::BtFile(const char *name) : IoHand(name) {
+ debugC(1, kCGEDebugFile, "BtFile::BtFile(%s)", name);
for (int i = 0; i < kBtLevel; i++) {
_buff[i]._page = new BtPage;
diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h
index bc4fd0a074..443cddde14 100644
--- a/engines/cge/fileio.h
+++ b/engines/cge/fileio.h
@@ -62,15 +62,12 @@ struct Header {
};
class IoHand {
-protected:
- uint16 _seed;
- Crypt *_crypt;
public:
Common::File *_file;
uint16 _error;
- IoHand(const char *name, Crypt crypt);
- IoHand(Crypt *crypt);
+ IoHand(const char *name);
+ IoHand();
virtual ~IoHand();
uint16 read(void *buf, uint16 len);
long mark();
@@ -101,7 +98,7 @@ class BtFile : public IoHand {
BtPage *getPage(int lev, uint16 pgn);
public:
- BtFile(const char *name, Crypt *crpt);
+ BtFile(const char *name);
virtual ~BtFile();
BtKeypack *find(const char *key);
bool exist(const char *name);