src/newgrf.cpp
branchgamebalance
changeset 9907 3b068c3a1c74
parent 9906 6f41b8713b65
child 9908 0fa543611bbe
--- a/src/newgrf.cpp	Thu Apr 19 14:43:25 2007 +0000
+++ b/src/newgrf.cpp	Thu Apr 19 14:48:10 2007 +0000
@@ -261,6 +261,20 @@
 	return str;
 }
 
+static uint8 MapDOSColour(uint8 colour)
+{
+	if (_use_dos_palette) return colour;
+
+	if (colour < 10) {
+		static uint8 dos_to_win_colour_map[] = { 0, 215, 216, 136, 88, 106, 32, 33, 40, 245 };
+		return dos_to_win_colour_map[colour];
+	}
+
+	if (colour >= 245 && colour < 254) return colour - 28;
+
+	return colour;
+}
+
 
 typedef bool (*VCI_Handler)(uint engine, int numinfo, int prop, byte **buf, int len);
 
@@ -1605,11 +1619,11 @@
 			break;
 
 		case 0x13: /* Colour for station rating bars */
-			FOR_EACH_OBJECT cs[i].rating_colour = grf_load_byte(&buf);
+			FOR_EACH_OBJECT cs[i].rating_colour = MapDOSColour(grf_load_byte(&buf));
 			break;
 
 		case 0x14: /* Colour for cargo graph */
-			FOR_EACH_OBJECT cs[i].legend_colour = grf_load_byte(&buf);
+			FOR_EACH_OBJECT cs[i].legend_colour = MapDOSColour(grf_load_byte(&buf));
 			break;
 
 		case 0x15: /* Freight status */
@@ -3142,7 +3156,7 @@
 		_skip_sprites = -1;
 
 		/* If an action 8 hasn't been encountered yet, disable the grf. */
-		if (_cur_grfconfig->status != GCS_ACTIVATED) _cur_grfconfig->status = GCS_DISABLED;
+		if (_cur_stage != GLS_RESERVE && _cur_grfconfig->status != GCS_ACTIVATED) _cur_grfconfig->status = GCS_DISABLED;
 	}
 }
 
@@ -4406,8 +4420,6 @@
 		}
 		_engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _cargo_mask;
 
-		if (_engine_info[engine].refit_mask == 0) continue;
-
 		/* Check if this engine's cargo type is valid. If not, set to the first refittable
 		 * cargo type. Apparently cargo_type isn't a common property... */
 		switch (GetEngine(engine)->type) {
@@ -4515,7 +4527,7 @@
 		/* 0x03 */ { NULL,     GRFUnsafe, NULL,            NULL,           NULL,              FeatureMapSpriteGroup, },
 		/* 0x04 */ { NULL,     NULL,      NULL,            NULL,           NULL,              FeatureNewName, },
 		/* 0x05 */ { NULL,     NULL,      NULL,            NULL,           NULL,              GraphicsNew, },
-		/* 0x06 */ { NULL,     NULL,      NULL,            CfgApply,       NULL,              CfgApply, },
+		/* 0x06 */ { NULL,     NULL,      NULL,            CfgApply,       CfgApply,          CfgApply, },
 		/* 0x07 */ { NULL,     NULL,      NULL,            NULL,           SkipIf,            SkipIf, },
 		/* 0x08 */ { ScanInfo, NULL,      NULL,            GRFInfo,        NULL,              GRFInfo, },
 		/* 0x09 */ { NULL,     NULL,      NULL,            SkipIf,         SkipIf,            SkipIf, },