src/newgrf.cpp
changeset 9468 7087fa70cfd4
parent 9458 9b2af80a696f
child 9470 08424e2e79e4
--- a/src/newgrf.cpp	Thu Jun 05 11:34:26 2008 +0000
+++ b/src/newgrf.cpp	Thu Jun 05 12:08:20 2008 +0000
@@ -417,18 +417,6 @@
 
 typedef bool (*VCI_Handler)(uint engine, int numinfo, int prop, byte **buf, int len);
 
-static void dewagonize(int condition, Engine *e)
-{
-	if (condition != 0) {
-		e->info.unk2 &= ~0x80;
-		if (e->u.rail.railveh_type == RAILVEH_WAGON)
-			e->u.rail.railveh_type = RAILVEH_SINGLEHEAD;
-	} else {
-		e->info.unk2 |= 0x80;
-		e->u.rail.railveh_type = RAILVEH_WAGON;
-	}
-}
-
 static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **bufp, int len)
 {
 	byte *buf = *bufp;
@@ -468,7 +456,15 @@
 
 			case 0x0B: // Power
 				rvi->power = grf_load_word(&buf);
-				dewagonize(rvi->power, e);
+
+				/* Set engine / wagon state based on power */
+				if (rvi->power != 0) {
+					if (rvi->railveh_type == RAILVEH_WAGON) {
+						rvi->railveh_type = RAILVEH_SINGLEHEAD;
+					}
+				} else {
+					rvi->railveh_type = RAILVEH_WAGON;
+				}
 				break;
 
 			case 0x0D: // Running cost factor
@@ -2300,7 +2296,7 @@
 							break;
 
 						case 0x02: // Decay speed
-							SB(ei->unk2, 0, 7, grf_load_byte(&buf) & 0x7F);
+							ei->decay_speed = grf_load_byte(&buf);
 							break;
 
 						case 0x03: // Vehicle life