(svn r3606) - NewGRF: Convert from TTDP railtype values to our own railtypes. (These are currently the same, but won't be forever...)
authorpeter1138
Wed, 15 Feb 2006 12:53:36 +0000
changeset 3026 7bbf6cbf3749
parent 3025 9e60c370415c
child 3027 d2ebfd04bb77
(svn r3606) - NewGRF: Convert from TTDP railtype values to our own railtypes. (These are currently the same, but won't be forever...)
newgrf.c
--- a/newgrf.c	Tue Feb 14 09:31:05 2006 +0000
+++ b/newgrf.c	Wed Feb 15 12:53:36 2006 +0000
@@ -214,13 +214,21 @@
 	bool ret = false;
 
 	switch (prop) {
-		case 0x05: { /* Track type */
+		case 0x05: // Track type
 			FOR_EACH_OBJECT {
 				uint8 tracktype = grf_load_byte(&buf);
 
-				ei[i].railtype = tracktype;
+				switch (tracktype) {
+					case 0: ei[i].railtype = RAILTYPE_RAIL; break;
+					case 1: ei[i].railtype = RAILTYPE_MONO; break;
+					case 2: ei[i].railtype = RAILTYPE_MAGLEV; break;
+					default:
+						grfmsg(GMS_WARN, "RailVehicleChangeInfo: Invalid track type %d specified, ignoring.", tracktype);
+						break;
+				}
 			}
-		} break;
+			break;
+
 		case 0x08: { /* AI passenger service */
 			/* TODO */
 			FOR_EACH_OBJECT {