get rid of the gameDataPath stuff as File::open already handles it

svn-id: r15781
This commit is contained in:
Gregory Montoir 2004-11-10 18:09:14 +00:00
parent 695667d934
commit 507d02d8d2
3 changed files with 9 additions and 37 deletions

View File

@ -99,14 +99,12 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *syst)
_mixer->setVolume(ConfMan.getInt("sfx_volume") * ConfMan.getInt("master_volume") / 255);
//getGameDataPath();
// Initialize backen
syst->initSize(320, 200);
_screen = new uint8[320*200];
memset((void*)_screen, 0, sizeof(_screen));
_screen = new uint8[320 * 200];
memset(_screen, 0, 320 * 200);
_resMgr = new Resourcemanager(this, getGameDataPath());
_resMgr = new Resourcemanager(this);
assert(_resMgr);
setCurrentPalette(_resMgr->loadPalette("PALETTE.COL"));
@ -125,6 +123,7 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *syst)
KyraEngine::~KyraEngine() {
delete _resMgr;
delete _screen;
delete _mouse;
delete _items;
delete _npcScript;
@ -175,7 +174,7 @@ void KyraEngine::shutdown() {
}
void KyraEngine::updateScreen(void) {
_system->copyRectToScreen(_screen, 320, 0, 0, 320, 240);
_system->copyRectToScreen(_screen, 320, 0, 0, 320, 200);
_system->updateScreen();
}

View File

@ -27,8 +27,7 @@
#include "script.h"
namespace Kyra {
Resourcemanager::Resourcemanager(KyraEngine* engine, const char* gamedir) {
_gameDir = gamedir;
Resourcemanager::Resourcemanager(KyraEngine* engine) {
_engine = engine;
// prefetches all PAK Files
@ -43,7 +42,7 @@ namespace Kyra {
for (uint32 tmp = 0; kyraFilelist[tmp]; ++tmp) {
// prefetch file
PAKFile* file = new PAKFile(getPath() + kyraFilelist[tmp]);
PAKFile* file = new PAKFile(kyraFilelist[tmp]);
assert(file);
if (file->isOpen() && file->isValid())
@ -70,7 +69,7 @@ namespace Kyra {
File file_;
// test to open it in the main dir
if (file_.open((getPath() + file).c_str())) {
if (file_.open(file)) {
*size = file_.size();
@ -152,30 +151,6 @@ namespace Kyra {
return context;
}
Common::String Resourcemanager::getPath(void) {
assert(_gameDir);
int32 len = strlen(_gameDir);
if(len < 1)
error("no valid gamedir");
// tests for an path seperator at the end
if (_gameDir[len - 1] == '\\') {
return string(_gameDir);
} else if (_gameDir[len - 1 ] == '/') {
return string(_gameDir);
}
// creates a path seperator at the end
// we are always using the path seperator from the system
// even if Windows shoudl accept '/'
#ifdef WIN32
return string(_gameDir) + "\\";
#else
return string(_gameDir) + "/";
#endif
}
///////////////////////////////////////////
// Pak file manager
#define PAKFile_Iterate Common::List<PakChunk*>::iterator start=_files.begin();start != _files.end(); ++start

View File

@ -70,7 +70,7 @@ namespace Kyra {
public:
Resourcemanager(KyraEngine* engine, const char* gamedir);
Resourcemanager(KyraEngine* engine);
virtual ~Resourcemanager();
uint8* fileData(const char* file, uint32* size);
@ -84,8 +84,6 @@ namespace Kyra {
protected:
KyraEngine* _engine;
string getPath(void);
const char* _gameDir;
Common::List<PAKFile*> _pakfiles;
};