(svn r7495) -Fix (r7354): [NewGRF] Deactivate the target GRF, not the current GRF.
authorpeter1138
Thu, 14 Dec 2006 15:14:29 +0000
changeset 5333 dedf1f6de6d3
parent 5332 f54c1fed42df
child 5334 c8bb331492a6
(svn r7495) -Fix (r7354): [NewGRF] Deactivate the target GRF, not the current GRF.
newgrf.c
newgrf_config.c
newgrf_config.h
--- a/newgrf.c	Wed Dec 13 22:38:45 2006 +0000
+++ b/newgrf.c	Thu Dec 14 15:14:29 2006 +0000
@@ -2950,13 +2950,13 @@
 
 	for (i = 0; i < num; i++) {
 		uint32 grfid = grf_load_dword(&buf);
-		GRFFile *file = GetFileByGRFID(grfid);
+		GRFConfig *file = GetGRFConfig(grfid);
 
 		/* Unset activation flag */
 		if (file != NULL) {
 			grfmsg(GMS_NOTICE, "GRFInhibit: Deactivating file ``%s''", file->filename);
-			SETBIT(_cur_grfconfig->flags, GCF_DISABLED);
-			CLRBIT(_cur_grfconfig->flags, GCF_ACTIVATED);
+			SETBIT(file->flags, GCF_DISABLED);
+			CLRBIT(file->flags, GCF_ACTIVATED);
 		}
 	}
 }
--- a/newgrf_config.c	Wed Dec 13 22:38:45 2006 +0000
+++ b/newgrf_config.c	Thu Dec 14 15:14:29 2006 +0000
@@ -266,7 +266,7 @@
 
 
 /* Retrieve a NewGRF from the current config by its grfid */
-const GRFConfig *GetGRFConfig(uint32 grfid)
+GRFConfig *GetGRFConfig(uint32 grfid)
 {
 	GRFConfig *c;
 
--- a/newgrf_config.h	Wed Dec 13 22:38:45 2006 +0000
+++ b/newgrf_config.h	Thu Dec 14 15:14:29 2006 +0000
@@ -41,7 +41,7 @@
 
 void ScanNewGRFFiles(void);
 const GRFConfig *FindGRFConfig(uint32 grfid, uint8 *md5sum);
-const GRFConfig *GetGRFConfig(uint32 grfid);
+GRFConfig *GetGRFConfig(uint32 grfid);
 void ClearGRFConfig(GRFConfig *config);
 void ClearGRFConfigList(GRFConfig *config);
 void ResetGRFConfig(bool defaults);