src/newgrf.cpp
changeset 8626 9781464622be
parent 8622 75554fef1333
child 8649 a7a8060fb837
equal deleted inserted replaced
8625:30871547954b 8626:9781464622be
   381 			} break;
   381 			} break;
   382 
   382 
   383 			case 0x0E: { // Running cost base
   383 			case 0x0E: { // Running cost base
   384 				uint32 base = grf_load_dword(&buf);
   384 				uint32 base = grf_load_dword(&buf);
   385 
   385 
   386 				switch (base) {
   386 				/* These magic numbers are used in GRFs to specify the base cost:
   387 					case 0x4C30: rvi->running_cost_class = 0; break;
   387 				 * http://wiki.ttdpatch.net/tiki-index.php?page=BaseCosts
   388 					case 0x4C36: rvi->running_cost_class = 1; break;
   388 				 */
   389 					case 0x4C3C: rvi->running_cost_class = 2; break;
   389 				if (base == 0) {
   390 					case 0: break; // Used by wagons
   390 					rvi->running_cost_class = 0xFF;
   391 					default:
   391 				} else if (base < 0x4B34 || base > 0x4C54 || (base - 0x4B34) % 6 != 0) {
   392 						grfmsg(1, "RailVehicleChangeInfo: Unsupported running cost base 0x%04X, ignoring", base);
   392 					grfmsg(1, "RailVehicleChangeInfo: Unsupported running cost base 0x%04X, ignoring", base);
   393 						break;
   393 				} else {
       
   394 					/* Convert the magic number to an index into the price data */
       
   395 					rvi->running_cost_class = (base - 0x4B34) / 6;
   394 				}
   396 				}
   395 			} break;
   397 			} break;
   396 
   398 
   397 			case 0x12: { // Sprite ID
   399 			case 0x12: { // Sprite ID
   398 				uint8 spriteid = grf_load_byte(&buf);
   400 				uint8 spriteid = grf_load_byte(&buf);
   592 
   594 
   593 			case 0x09: // Running cost factor
   595 			case 0x09: // Running cost factor
   594 				rvi->running_cost = grf_load_byte(&buf);
   596 				rvi->running_cost = grf_load_byte(&buf);
   595 				break;
   597 				break;
   596 
   598 
   597 			case 0x0A: // Running cost base
   599 			case 0x0A: { // Running cost base
   598 				/** @todo : I have no idea. --pasky
   600 				uint32 base= grf_load_dword(&buf);
   599 				 * I THINK it is used for overriding the base cost of all road vehicle (_price.roadveh_base) --belugas */
   601 
   600 				grf_load_dword(&buf);
   602 				/* These magic numbers are used in GRFs to specify the base cost:
   601 				ret = true;
   603 				 * http://wiki.ttdpatch.net/tiki-index.php?page=BaseCosts
   602 				break;
   604 				 */
       
   605 				if (base == 0) {
       
   606 					rvi->running_cost_class = 0xFF;
       
   607 				} else if (base < 0x4B34 || base > 0x4C54 || (base - 0x4B34) % 6 != 0) {
       
   608 					grfmsg(1, "RailVehicleChangeInfo: Unsupported running cost base 0x%04X, ignoring", base);
       
   609 				} else {
       
   610 					/* Convert the magic number to an index into the price data */
       
   611 					rvi->running_cost_class = (base - 0x4B34) / 6;
       
   612 				}
       
   613 
       
   614 				break;
       
   615 			}
   603 
   616 
   604 			case 0x0E: { // Sprite ID
   617 			case 0x0E: { // Sprite ID
   605 				uint8 spriteid = grf_load_byte(&buf);
   618 				uint8 spriteid = grf_load_byte(&buf);
   606 
   619 
   607 				/* cars have different custom id in the GRF file */
   620 				/* cars have different custom id in the GRF file */