diff options
| author | Alyssa Milburn | 2011-07-15 15:19:37 +0200 | 
|---|---|---|
| committer | Alyssa Milburn | 2011-07-15 15:19:37 +0200 | 
| commit | 8517c17b0440bd8368479ea0fa3e048e050e028b (patch) | |
| tree | 39c3cd9cb9d3e322e80ff68444b392cd0a6d9257 | |
| parent | add71297bd283516ff3bd75f13bea69b6898adaa (diff) | |
| download | scummvm-rg350-8517c17b0440bd8368479ea0fa3e048e050e028b.tar.gz scummvm-rg350-8517c17b0440bd8368479ea0fa3e048e050e028b.tar.bz2 scummvm-rg350-8517c17b0440bd8368479ea0fa3e048e050e028b.zip | |
COMPOSER: Handle single-directory games.
| -rw-r--r-- | engines/composer/composer.cpp | 18 | ||||
| -rw-r--r-- | engines/composer/composer.h | 1 | 
2 files changed, 18 insertions, 1 deletions
| diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index fba699660d..961665bafc 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -486,7 +486,12 @@ Common::Error ComposerEngine::run() {  		_queuedScripts[i]._scriptId = 0;  	} -	_bookIni.loadFromFile("programs/book.ini"); +	_directoriesToStrip = 1; +	if (!_bookIni.loadFromFile("book.ini")) { +		_directoriesToStrip = 0; +		if (!_bookIni.loadFromFile("programs/book.ini")) +			error("failed to find book.ini"); +	}  	uint width = 640;  	if (_bookIni.hasKey("Width", "Common")) @@ -595,6 +600,17 @@ Common::String ComposerEngine::getFilename(const Common::String §ion, uint i  	Common::String filename = getStringFromConfig(section, key);  	while (filename.size() && (filename[0] == '~' || filename[0] == ':' || filename[0] == '\\'))  		filename = filename.c_str() + 1; + +	uint slashesToStrip = _directoriesToStrip; +	while (slashesToStrip--) { +		for (uint i = 0; i < filename.size(); i++) { +			if (filename[i] != '\\') +				continue; +			filename = filename.c_str() + i + 1; +			break; +		} +	} +  	Common::String outFilename;  	for (uint i = 0; i < filename.size(); i++) {  		if (filename[i] == '\\') diff --git a/engines/composer/composer.h b/engines/composer/composer.h index e535bfbc6e..b18b3575f2 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -164,6 +164,7 @@ private:  	Graphics::Surface _surface;  	Common::List<Sprite> _sprites; +	uint _directoriesToStrip;  	Common::ConfigFile _bookIni;  	Common::List<Library> _libraries; | 
