From 5c7267b49ecccf6f7b8d9c507b311b3a23cf214b Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Thu, 2 Feb 2006 12:53:42 +0000 Subject: 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 --- sky/compact.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sky/compact.cpp') 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**)); -- cgit v1.2.3