changeset 12174:1f14f0dd0ca0 draft

(svn r16590) -Fix [FS#2967]: don't crash when tars/newgrfs are removed, just tell the file could be opened/found.
author rubidium <rubidium@openttd.org>
date Thu, 18 Jun 2009 09:47:06 +0000
parents 9b6009b271ee
children a8461c552ea5
files src/fileio.cpp src/newgrf.cpp
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -337,7 +337,7 @@
 FILE *FioFOpenFileTar(TarFileListEntry *entry, size_t *filesize)
 {
 	FILE *f = fopen(entry->tar_filename, "rb");
-	assert(f != NULL);
+	if (f == NULL) return f;
 
 	fseek(f, entry->position, SEEK_SET);
 	if (filesize != NULL) *filesize = entry->size;
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -6212,8 +6212,11 @@
 			if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue;
 			if (stage > GLS_INIT && HasBit(c->flags, GCF_INIT_ONLY)) continue;
 
-			/* @todo usererror() */
-			if (!FioCheckFileExists(c->filename)) usererror("NewGRF file is missing '%s'", c->filename);
+			if (!FioCheckFileExists(c->filename)) {
+				DEBUG(grf, 0, "NewGRF file is missing '%s'; disabling", c->filename);
+				c->status = GCS_NOT_FOUND;
+				continue;
+			}
 
 			if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid);
 			LoadNewGRFFile(c, slot++, stage);