newgrf.c
changeset 2836 9c023d993651
parent 2812 95102021c840
child 2838 abfaee414ae7
equal deleted inserted replaced
2835:c7fb346f209c 2836:9c023d993651
   248 		} break;
   248 		} break;
   249 		case 0x0D: { /* Running cost factor */
   249 		case 0x0D: { /* Running cost factor */
   250 			FOR_EACH_OBJECT {
   250 			FOR_EACH_OBJECT {
   251 				uint8 runcostfact = grf_load_byte(&buf);
   251 				uint8 runcostfact = grf_load_byte(&buf);
   252 
   252 
       
   253 				if (rvi[i].flags & RVI_MULTIHEAD)
       
   254 					runcostfact /= 2;
       
   255 
   253 				rvi[i].running_cost_base = runcostfact;
   256 				rvi[i].running_cost_base = runcostfact;
   254 				dewagonize(runcostfact, engine + i);
   257 				dewagonize(runcostfact, engine + i);
   255 			}
   258 			}
   256 		} break;
   259 		} break;
   257 		case 0x0E: { /* Running cost base */
   260 		case 0x0E: { /* Running cost base */
   276 		case 0x13: { /* Dual-headed */
   279 		case 0x13: { /* Dual-headed */
   277 			FOR_EACH_OBJECT {
   280 			FOR_EACH_OBJECT {
   278 				uint8 dual = grf_load_byte(&buf);
   281 				uint8 dual = grf_load_byte(&buf);
   279 
   282 
   280 				if (dual != 0) {
   283 				if (dual != 0) {
   281 					if (!(rvi[i].flags & RVI_MULTIHEAD)) // adjust power if needed
   284 					if (!(rvi[i].flags & RVI_MULTIHEAD)) {
       
   285 						// adjust power and running cost if needed
   282 						rvi[i].power /= 2;
   286 						rvi[i].power /= 2;
       
   287 						rvi[i].running_cost_base /= 2;
       
   288 					}
   283 					rvi[i].flags |= RVI_MULTIHEAD;
   289 					rvi[i].flags |= RVI_MULTIHEAD;
   284 				} else {
   290 				} else {
   285 					if (rvi[i].flags & RVI_MULTIHEAD) // adjust power if needed
   291 					if (rvi[i].flags & RVI_MULTIHEAD) {
       
   292 						// adjust power and running cost if needed
   286 						rvi[i].power *= 2;
   293 						rvi[i].power *= 2;
       
   294 						rvi[i].running_cost_base /= 2;
       
   295 					}
   287 					rvi[i].flags &= ~RVI_MULTIHEAD;
   296 					rvi[i].flags &= ~RVI_MULTIHEAD;
   288 				}
   297 				}
   289 			}
   298 			}
   290 		} break;
   299 		} break;
   291 		case 0x14: { /* Cargo capacity */
   300 		case 0x14: { /* Cargo capacity */