equal
deleted
inserted
replaced
213 EngineInfo *ei = &_engine_info[engine]; |
213 EngineInfo *ei = &_engine_info[engine]; |
214 RailVehicleInfo *rvi = &_rail_vehicle_info[engine]; |
214 RailVehicleInfo *rvi = &_rail_vehicle_info[engine]; |
215 |
215 |
216 if (condition != 0) { |
216 if (condition != 0) { |
217 ei->unk2 &= ~0x80; |
217 ei->unk2 &= ~0x80; |
218 rvi->flags &= ~2; |
218 rvi->railveh_type = RAILVEH_SINGLEHEAD; |
219 } else { |
219 } else { |
220 ei->unk2 |= 0x80; |
220 ei->unk2 |= 0x80; |
221 rvi->flags |= 2; |
221 rvi->railveh_type = RAILVEH_WAGON; |
222 } |
222 } |
223 } |
223 } |
224 |
224 |
225 static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **bufp, int len) |
225 static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **bufp, int len) |
226 { |
226 { |
263 |
263 |
264 case 0x0B: /* Power */ |
264 case 0x0B: /* Power */ |
265 FOR_EACH_OBJECT { |
265 FOR_EACH_OBJECT { |
266 uint16 power = grf_load_word(&buf); |
266 uint16 power = grf_load_word(&buf); |
267 |
267 |
268 if (rvi[i].flags & RVI_MULTIHEAD) power /= 2; |
268 if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) power /= 2; |
269 |
269 |
270 rvi[i].power = power; |
270 rvi[i].power = power; |
271 dewagonize(power, engine + i); |
271 dewagonize(power, engine + i); |
272 } |
272 } |
273 break; |
273 break; |
274 |
274 |
275 case 0x0D: /* Running cost factor */ |
275 case 0x0D: /* Running cost factor */ |
276 FOR_EACH_OBJECT { |
276 FOR_EACH_OBJECT { |
277 uint8 runcostfact = grf_load_byte(&buf); |
277 uint8 runcostfact = grf_load_byte(&buf); |
278 |
278 |
279 if (rvi[i].flags & RVI_MULTIHEAD) runcostfact /= 2; |
279 if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) runcostfact /= 2; |
280 |
280 |
281 rvi[i].running_cost_base = runcostfact; |
281 rvi[i].running_cost_base = runcostfact; |
282 } |
282 } |
283 break; |
283 break; |
284 |
284 |
313 case 0x13: /* Dual-headed */ |
313 case 0x13: /* Dual-headed */ |
314 FOR_EACH_OBJECT { |
314 FOR_EACH_OBJECT { |
315 uint8 dual = grf_load_byte(&buf); |
315 uint8 dual = grf_load_byte(&buf); |
316 |
316 |
317 if (dual != 0) { |
317 if (dual != 0) { |
318 if (!(rvi[i].flags & RVI_MULTIHEAD)) { |
318 if (rvi[i].railveh_type != RAILVEH_MULTIHEAD) { |
319 // adjust power and running cost if needed |
319 // adjust power and running cost if needed |
320 rvi[i].power /= 2; |
320 rvi[i].power /= 2; |
321 rvi[i].running_cost_base /= 2; |
321 rvi[i].running_cost_base /= 2; |
322 } |
322 } |
323 rvi[i].flags |= RVI_MULTIHEAD; |
323 rvi[i].railveh_type = RAILVEH_MULTIHEAD; |
324 } else { |
324 } else { |
325 if (rvi[i].flags & RVI_MULTIHEAD) { |
325 if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) { |
326 // adjust power and running cost if needed |
326 // adjust power and running cost if needed |
327 rvi[i].power *= 2; |
327 rvi[i].power *= 2; |
328 rvi[i].running_cost_base *= 2; |
328 rvi[i].running_cost_base *= 2; |
329 } |
329 } |
330 rvi[i].flags &= ~RVI_MULTIHEAD; |
330 rvi[i].railveh_type = RAILVEH_SINGLEHEAD; |
331 } |
331 } |
332 } |
332 } |
333 break; |
333 break; |
334 |
334 |
335 case 0x14: /* Cargo capacity */ |
335 case 0x14: /* Cargo capacity */ |
3586 } else { |
3586 } else { |
3587 // Don't apply default refit mask to wagons or engines with no capacity |
3587 // Don't apply default refit mask to wagons or engines with no capacity |
3588 if (xor_mask == 0 && ( |
3588 if (xor_mask == 0 && ( |
3589 GetEngine(engine)->type != VEH_Train || ( |
3589 GetEngine(engine)->type != VEH_Train || ( |
3590 RailVehInfo(engine)->capacity != 0 && |
3590 RailVehInfo(engine)->capacity != 0 && |
3591 !(RailVehInfo(engine)->flags & RVI_WAGON) |
3591 RailVehInfo(engine)->railveh_type != RAILVEH_WAGON |
3592 ) |
3592 ) |
3593 )) { |
3593 )) { |
3594 xor_mask = _default_refitmasks[GetEngine(engine)->type - VEH_Train]; |
3594 xor_mask = _default_refitmasks[GetEngine(engine)->type - VEH_Train]; |
3595 } |
3595 } |
3596 } |
3596 } |
3799 } |
3799 } |
3800 |
3800 |
3801 |
3801 |
3802 |
3802 |
3803 |
3803 |
|
3804 |