src/newgrf.cpp
changeset 9118 bf19f7f901bc
parent 9073 740f7aaa3ff6
child 9122 bc3651767850
equal deleted inserted replaced
9117:5aaa21219f68 9118:bf19f7f901bc
   375 			case 0x0D: { // Running cost factor
   375 			case 0x0D: { // Running cost factor
   376 				uint8 runcostfact = grf_load_byte(&buf);
   376 				uint8 runcostfact = grf_load_byte(&buf);
   377 
   377 
   378 				if (rvi->railveh_type == RAILVEH_MULTIHEAD) runcostfact /= 2;
   378 				if (rvi->railveh_type == RAILVEH_MULTIHEAD) runcostfact /= 2;
   379 
   379 
   380 				rvi->running_cost_base = runcostfact;
   380 				rvi->running_cost = runcostfact;
   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 
   409 
   409 
   410 				if (dual != 0) {
   410 				if (dual != 0) {
   411 					if (rvi->railveh_type != RAILVEH_MULTIHEAD) {
   411 					if (rvi->railveh_type != RAILVEH_MULTIHEAD) {
   412 						// adjust power and running cost if needed
   412 						// adjust power and running cost if needed
   413 						rvi->power /= 2;
   413 						rvi->power /= 2;
   414 						rvi->running_cost_base /= 2;
   414 						rvi->running_cost /= 2;
   415 					}
   415 					}
   416 					rvi->railveh_type = RAILVEH_MULTIHEAD;
   416 					rvi->railveh_type = RAILVEH_MULTIHEAD;
   417 				} else {
   417 				} else {
   418 					if (rvi->railveh_type == RAILVEH_MULTIHEAD) {
   418 					if (rvi->railveh_type == RAILVEH_MULTIHEAD) {
   419 						// adjust power and running cost if needed
   419 						// adjust power and running cost if needed
   420 						rvi->power *= 2;
   420 						rvi->power *= 2;
   421 						rvi->running_cost_base *= 2;
   421 						rvi->running_cost *= 2;
   422 					}
   422 					}
   423 					rvi->railveh_type = rvi->power == 0 ?
   423 					rvi->railveh_type = rvi->power == 0 ?
   424 						RAILVEH_WAGON : RAILVEH_SINGLEHEAD;
   424 						RAILVEH_WAGON : RAILVEH_SINGLEHEAD;
   425 				}
   425 				}
   426 			} break;
   426 			} break;