newgrf.c
changeset 5115 c489d3854de5
parent 5114 9487e87478ba
child 5161 e5ba90f4da6f
equal deleted inserted replaced
5114:9487e87478ba 5115:c489d3854de5
   265 		case 0x05: /* Track type */
   265 		case 0x05: /* Track type */
   266 			FOR_EACH_OBJECT {
   266 			FOR_EACH_OBJECT {
   267 				uint8 tracktype = grf_load_byte(&buf);
   267 				uint8 tracktype = grf_load_byte(&buf);
   268 
   268 
   269 				switch (tracktype) {
   269 				switch (tracktype) {
   270 					case 0: ei[i].railtype = RAILTYPE_RAIL; break;
   270 					case 0: ei[i].railtype = rvi[i].engclass == 2 ? RAILTYPE_ELECTRIC : RAILTYPE_RAIL; break;
   271 					case 1: ei[i].railtype = RAILTYPE_MONO; break;
   271 					case 1: ei[i].railtype = RAILTYPE_MONO; break;
   272 					case 2: ei[i].railtype = RAILTYPE_MAGLEV; break;
   272 					case 2: ei[i].railtype = RAILTYPE_MAGLEV; break;
   273 					default:
   273 					default:
   274 						grfmsg(GMS_WARN, "RailVehicleChangeInfo: Invalid track type %d specified, ignoring.", tracktype);
   274 						grfmsg(GMS_WARN, "RailVehicleChangeInfo: Invalid track type %d specified, ignoring.", tracktype);
   275 						break;
   275 						break;
   403 					engclass = 0;
   403 					engclass = 0;
   404 				} else if (traction <= 0x27) {
   404 				} else if (traction <= 0x27) {
   405 					engclass = 1;
   405 					engclass = 1;
   406 				} else if (traction <= 0x31) {
   406 				} else if (traction <= 0x31) {
   407 					engclass = 2;
   407 					engclass = 2;
   408 					ei[i].railtype = RAILTYPE_ELECTRIC;
       
   409 				} else if (traction <= 0x41) {
   408 				} else if (traction <= 0x41) {
   410 					engclass = 2;
   409 					engclass = 2;
   411 				} else {
   410 				} else {
   412 					break;
   411 					break;
   413 				}
   412 				}
       
   413 				if (ei[i].railtype == RAILTYPE_RAIL     && engclass == 2) ei[i].railtype = RAILTYPE_ELECTRIC;
       
   414 				if (ei[i].railtype == RAILTYPE_ELECTRIC && engclass != 2) ei[i].railtype = RAILTYPE_RAIL;
   414 
   415 
   415 				rvi[i].engclass = engclass;
   416 				rvi[i].engclass = engclass;
   416 			}
   417 			}
   417 			break;
   418 			break;
   418 
   419