mirror of https://github.com/OpenTTD/OpenTTD
(svn r3071) -NewGRF: Add support for rail vehicle weight greater than 255 tons.
parent
4253f3d330
commit
d5eb4183b8
2
engine.h
2
engine.h
|
@ -14,7 +14,7 @@ typedef struct RailVehicleInfo {
|
||||||
byte base_cost;
|
byte base_cost;
|
||||||
uint16 max_speed;
|
uint16 max_speed;
|
||||||
uint16 power;
|
uint16 power;
|
||||||
byte weight;
|
uint16 weight;
|
||||||
byte running_cost_base;
|
byte running_cost_base;
|
||||||
byte engclass; // 0: steam, 1: diesel, 2: electric
|
byte engclass; // 0: steam, 1: diesel, 2: electric
|
||||||
byte capacity;
|
byte capacity;
|
||||||
|
|
14
newgrf.c
14
newgrf.c
|
@ -311,7 +311,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
||||||
FOR_EACH_OBJECT {
|
FOR_EACH_OBJECT {
|
||||||
uint8 weight = grf_load_byte(&buf);
|
uint8 weight = grf_load_byte(&buf);
|
||||||
|
|
||||||
rvi[i].weight = weight;
|
SB(rvi[i].weight, 0, 8, weight);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case 0x17: { /* Cost factor */
|
case 0x17: { /* Cost factor */
|
||||||
|
@ -390,13 +390,23 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
||||||
rvi[i].pow_wag_weight = wag_weight;
|
rvi[i].pow_wag_weight = wag_weight;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case 0x24: { /* High byte of vehicle weight */
|
||||||
|
FOR_EACH_OBJECT {
|
||||||
|
byte weight = grf_load_byte(&buf);
|
||||||
|
|
||||||
|
if (weight < 4) {
|
||||||
|
grfmsg(GMS_NOTICE, "RailVehicleChangeInfo: Nonsensical weight of %d tons, ignoring.", weight << 8);
|
||||||
|
} else {
|
||||||
|
SB(rvi[i].weight, 8, 8, weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
/* TODO */
|
/* TODO */
|
||||||
/* Fall-through for unimplemented one byte long properties. */
|
/* Fall-through for unimplemented one byte long properties. */
|
||||||
case 0x1A: /* Sort order */
|
case 0x1A: /* Sort order */
|
||||||
case 0x1C: /* Refit cost */
|
case 0x1C: /* Refit cost */
|
||||||
case 0x1F: /* Tractive effort */
|
case 0x1F: /* Tractive effort */
|
||||||
case 0x20: /* Air drag */
|
case 0x20: /* Air drag */
|
||||||
case 0x24: /* High byte of vehicle weight */
|
|
||||||
case 0x25: /* User-defined bit mask to set when checking veh. var. 42 */
|
case 0x25: /* User-defined bit mask to set when checking veh. var. 42 */
|
||||||
case 0x26: /* Retire vehicle early */
|
case 0x26: /* Retire vehicle early */
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue