|
@@ -212,16 +212,16 @@ static void dewagonize(int condition, in
|
|
|
{
|
|
|
EngineInfo *ei = &_engine_info[engine];
|
|
|
RailVehicleInfo *rvi = &_rail_vehicle_info[engine];
|
|
|
|
|
|
if (condition != 0) {
|
|
|
ei->unk2 &= ~0x80;
|
|
|
rvi->flags &= ~2;
|
|
|
rvi->railveh_type = RAILVEH_SINGLEHEAD;
|
|
|
} else {
|
|
|
ei->unk2 |= 0x80;
|
|
|
rvi->flags |= 2;
|
|
|
rvi->railveh_type = RAILVEH_WAGON;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **bufp, int len)
|
|
|
{
|
|
|
EngineInfo *ei = &_engine_info[engine];
|
|
@@ -262,24 +262,24 @@ static bool RailVehicleChangeInfo(uint e
|
|
|
break;
|
|
|
|
|
|
case 0x0B: /* Power */
|
|
|
FOR_EACH_OBJECT {
|
|
|
uint16 power = grf_load_word(&buf);
|
|
|
|
|
|
if (rvi[i].flags & RVI_MULTIHEAD) power /= 2;
|
|
|
if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) power /= 2;
|
|
|
|
|
|
rvi[i].power = power;
|
|
|
dewagonize(power, engine + i);
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 0x0D: /* Running cost factor */
|
|
|
FOR_EACH_OBJECT {
|
|
|
uint8 runcostfact = grf_load_byte(&buf);
|
|
|
|
|
|
if (rvi[i].flags & RVI_MULTIHEAD) runcostfact /= 2;
|
|
|
if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) runcostfact /= 2;
|
|
|
|
|
|
rvi[i].running_cost_base = runcostfact;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 0x0E: /* Running cost base */
|
|
@@ -312,25 +312,25 @@ static bool RailVehicleChangeInfo(uint e
|
|
|
|
|
|
case 0x13: /* Dual-headed */
|
|
|
FOR_EACH_OBJECT {
|
|
|
uint8 dual = grf_load_byte(&buf);
|
|
|
|
|
|
if (dual != 0) {
|
|
|
if (!(rvi[i].flags & RVI_MULTIHEAD)) {
|
|
|
if (rvi[i].railveh_type != RAILVEH_MULTIHEAD) {
|
|
|
// adjust power and running cost if needed
|
|
|
rvi[i].power /= 2;
|
|
|
rvi[i].running_cost_base /= 2;
|
|
|
}
|
|
|
rvi[i].flags |= RVI_MULTIHEAD;
|
|
|
rvi[i].railveh_type = RAILVEH_MULTIHEAD;
|
|
|
} else {
|
|
|
if (rvi[i].flags & RVI_MULTIHEAD) {
|
|
|
if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) {
|
|
|
// adjust power and running cost if needed
|
|
|
rvi[i].power *= 2;
|
|
|
rvi[i].running_cost_base *= 2;
|
|
|
}
|
|
|
rvi[i].flags &= ~RVI_MULTIHEAD;
|
|
|
rvi[i].railveh_type = RAILVEH_SINGLEHEAD;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 0x14: /* Cargo capacity */
|
|
|
FOR_EACH_OBJECT rvi[i].capacity = grf_load_byte(&buf);
|
|
@@ -3585,13 +3585,13 @@ static void CalculateRefitMasks(void)
|
|
|
}
|
|
|
} else {
|
|
|
// Don't apply default refit mask to wagons or engines with no capacity
|
|
|
if (xor_mask == 0 && (
|
|
|
GetEngine(engine)->type != VEH_Train || (
|
|
|
RailVehInfo(engine)->capacity != 0 &&
|
|
|
!(RailVehInfo(engine)->flags & RVI_WAGON)
|
|
|
RailVehInfo(engine)->railveh_type != RAILVEH_WAGON
|
|
|
)
|
|
|
)) {
|
|
|
xor_mask = _default_refitmasks[GetEngine(engine)->type - VEH_Train];
|
|
|
}
|
|
|
}
|
|
|
_engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _landscape_global_cargo_mask[_opt.landscape];
|
|
@@ -3798,6 +3798,7 @@ void LoadNewGRF(uint load_index, uint fi
|
|
|
CalculateRefitMasks();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|