aboutsummaryrefslogtreecommitdiff
path: root/sky/compact.cpp
diff options
context:
space:
mode:
authorJoost Peters2006-02-02 12:53:42 +0000
committerJoost Peters2006-02-02 12:53:42 +0000
commit5c7267b49ecccf6f7b8d9c507b311b3a23cf214b (patch)
treee0fb1bf00e1286700271f45d9a9533564655d8f2 /sky/compact.cpp
parent64ec8a95cf419810cc31aa5d83a406c66b8c3367 (diff)
downloadscummvm-rg350-5c7267b49ecccf6f7b8d9c507b311b3a23cf214b.tar.gz
scummvm-rg350-5c7267b49ecccf6f7b8d9c507b311b3a23cf214b.tar.bz2
scummvm-rg350-5c7267b49ecccf6f7b8d9c507b311b3a23cf214b.zip
Because incomplete SKY.CPT files are apparently a common problem due to some problems with the scummvm.org server or connection, check if it's the expected size.
svn-id: r20349
Diffstat (limited to 'sky/compact.cpp')
-rw-r--r--sky/compact.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/sky/compact.cpp b/sky/compact.cpp
index ab8414f00d..218dbd2fdb 100644
--- a/sky/compact.cpp
+++ b/sky/compact.cpp
@@ -27,6 +27,8 @@
namespace Sky {
+#define SKY_CPT_SIZE 419427
+
#define OFFS(type,item) (((long)(&((type*)0)->item)))
#define MK32(type,item) OFFS(type, item),0,0,0
#define MK16(type,item) OFFS(type, item),0
@@ -130,6 +132,12 @@ SkyCompact::SkyCompact(void) {
if (fileVersion != 0)
error("unknown \"sky.cpt\" version");
+ if (SKY_CPT_SIZE != _cptFile->size()) {
+ GUI::MessageDialog dialog("The \"sky.cpt\" file has an incorrect size.\nPlease (re)download it from www.scummvm.org", "OK", NULL);
+ dialog.runModal();
+ error("Incorrect sky.cpt size (%d, expected: %d)", _cptFile->size(), SKY_CPT_SIZE);
+ }
+
// set the necessary data structs up...
_numDataLists = _cptFile->readUint16LE();
_cptNames = (char***)malloc(_numDataLists * sizeof(char**));