(svn r10917) [NewGRF_ports] -Fix: if you force NewGRFs to be always loaded, make sure it still forces the NewGRF to be loaded when it is marked as "init only". NewGRF_ports
authorrubidium
Thu, 16 Aug 2007 08:19:52 +0000
branchNewGRF_ports
changeset 6834 970db24bf26c
parent 6833 40ae45d56c69
child 6835 0364f49694ea
(svn r10917) [NewGRF_ports] -Fix: if you force NewGRFs to be always loaded, make sure it still forces the NewGRF to be loaded when it is marked as "init only".
src/newgrf_config.cpp
--- a/src/newgrf_config.cpp	Thu Aug 16 02:48:35 2007 +0000
+++ b/src/newgrf_config.cpp	Thu Aug 16 08:19:52 2007 +0000
@@ -119,14 +119,23 @@
  */
 void AddGRFTToGameListByGRFid(uint32 grfid)
 {
+	for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
+		if (c->grfid == grfid) {
+			/* The required GRF is already in the list; for it to be loaded properly */
+			CLRBIT(c->flags, GCF_INIT_ONLY);
+			return;
+		}
+	}
+
 	/* Copy GRF details from scanned list */
 	GRFConfig *c = CallocT<GRFConfig>(1);
-	const GRFConfig *src = FindGRFConfig(grfid, NULL);  // OAPD - airportsbasic.grf
+	const GRFConfig *src = FindGRFConfig(grfid, NULL);
 	*c = *src;
 	c->filename = strdup(src->filename);
 	if (src->name != NULL) c->name = strdup(src->name);
 	if (src->info != NULL) c->info = strdup(src->info);
 	c->next = NULL;
+
 	AppendToGRFConfigList(&_grfconfig, c);
 }