equal
deleted
inserted
replaced
415 } |
415 } |
416 } |
416 } |
417 |
417 |
418 typedef bool (*VCI_Handler)(uint engine, int numinfo, int prop, byte **buf, int len); |
418 typedef bool (*VCI_Handler)(uint engine, int numinfo, int prop, byte **buf, int len); |
419 |
419 |
420 static void dewagonize(int condition, Engine *e) |
|
421 { |
|
422 if (condition != 0) { |
|
423 e->info.unk2 &= ~0x80; |
|
424 if (e->u.rail.railveh_type == RAILVEH_WAGON) |
|
425 e->u.rail.railveh_type = RAILVEH_SINGLEHEAD; |
|
426 } else { |
|
427 e->info.unk2 |= 0x80; |
|
428 e->u.rail.railveh_type = RAILVEH_WAGON; |
|
429 } |
|
430 } |
|
431 |
|
432 static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **bufp, int len) |
420 static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **bufp, int len) |
433 { |
421 { |
434 byte *buf = *bufp; |
422 byte *buf = *bufp; |
435 bool ret = false; |
423 bool ret = false; |
436 |
424 |
466 rvi->max_speed = speed; |
454 rvi->max_speed = speed; |
467 } break; |
455 } break; |
468 |
456 |
469 case 0x0B: // Power |
457 case 0x0B: // Power |
470 rvi->power = grf_load_word(&buf); |
458 rvi->power = grf_load_word(&buf); |
471 dewagonize(rvi->power, e); |
459 |
|
460 /* Set engine / wagon state based on power */ |
|
461 if (rvi->power != 0) { |
|
462 if (rvi->railveh_type == RAILVEH_WAGON) { |
|
463 rvi->railveh_type = RAILVEH_SINGLEHEAD; |
|
464 } |
|
465 } else { |
|
466 rvi->railveh_type = RAILVEH_WAGON; |
|
467 } |
472 break; |
468 break; |
473 |
469 |
474 case 0x0D: // Running cost factor |
470 case 0x0D: // Running cost factor |
475 rvi->running_cost = grf_load_byte(&buf); |
471 rvi->running_cost = grf_load_byte(&buf); |
476 break; |
472 break; |
2298 case 0x00: // Introduction date |
2294 case 0x00: // Introduction date |
2299 ei->base_intro = grf_load_word(&buf) + DAYS_TILL_ORIGINAL_BASE_YEAR; |
2295 ei->base_intro = grf_load_word(&buf) + DAYS_TILL_ORIGINAL_BASE_YEAR; |
2300 break; |
2296 break; |
2301 |
2297 |
2302 case 0x02: // Decay speed |
2298 case 0x02: // Decay speed |
2303 SB(ei->unk2, 0, 7, grf_load_byte(&buf) & 0x7F); |
2299 ei->decay_speed = grf_load_byte(&buf); |
2304 break; |
2300 break; |
2305 |
2301 |
2306 case 0x03: // Vehicle life |
2302 case 0x03: // Vehicle life |
2307 ei->lifelength = grf_load_byte(&buf); |
2303 ei->lifelength = grf_load_byte(&buf); |
2308 break; |
2304 break; |