mirror of https://github.com/OpenTTD/OpenTTD
(svn r3150) Unify some code duplication in HandleLocomotiveSmokeCloud()
parent
bc25cd89bf
commit
8bcfa23d29
10
train_cmd.c
10
train_cmd.c
|
@ -1876,6 +1876,10 @@ static void HandleLocomotiveSmokeCloud(Vehicle *v)
|
||||||
(v->vehstatus & VS_HIDDEN) || (v->u.rail.track & 0xC0))
|
(v->vehstatus & VS_HIDDEN) || (v->u.rail.track & 0xC0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// No smoke in depots or tunnels
|
||||||
|
if (IsTileDepotType(v->tile, TRANSPORT_RAIL) || IsTunnelTile(v->tile))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (effect_type == 0) {
|
if (effect_type == 0) {
|
||||||
// Use default effect type for engine class.
|
// Use default effect type for engine class.
|
||||||
effect_type = RailVehInfo(engtype)->engclass;
|
effect_type = RailVehInfo(engtype)->engclass;
|
||||||
|
@ -1889,21 +1893,21 @@ static void HandleLocomotiveSmokeCloud(Vehicle *v)
|
||||||
switch (effect_type) {
|
switch (effect_type) {
|
||||||
case 0:
|
case 0:
|
||||||
// steam smoke.
|
// steam smoke.
|
||||||
if ( (v->tick_counter&0xF) == 0 && !IsTileDepotType(v->tile, TRANSPORT_RAIL) && !IsTunnelTile(v->tile)) {
|
if (GB(v->tick_counter, 0, 4) == 0) {
|
||||||
CreateEffectVehicleRel(v, x, y, 10, EV_STEAM_SMOKE);
|
CreateEffectVehicleRel(v, x, y, 10, EV_STEAM_SMOKE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// diesel smoke
|
// diesel smoke
|
||||||
if (u->cur_speed <= 40 && !IsTileDepotType(v->tile, TRANSPORT_RAIL) && !IsTunnelTile(v->tile) && GB(Random(), 0, 16) <= 0x1E00) {
|
if (u->cur_speed <= 40 && GB(Random(), 0, 16) <= 0x1E00) {
|
||||||
CreateEffectVehicleRel(v, 0, 0, 10, EV_DIESEL_SMOKE);
|
CreateEffectVehicleRel(v, 0, 0, 10, EV_DIESEL_SMOKE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
// blue spark
|
// blue spark
|
||||||
if (GB(v->tick_counter, 0, 2) == 0 && !IsTileDepotType(v->tile, TRANSPORT_RAIL) && !IsTunnelTile(v->tile) && GB(Random(), 0, 16) <= 0x5B0) {
|
if (GB(v->tick_counter, 0, 2) == 0 && GB(Random(), 0, 16) <= 0x5B0) {
|
||||||
CreateEffectVehicleRel(v, 0, 0, 10, EV_ELECTRIC_SPARK);
|
CreateEffectVehicleRel(v, 0, 0, 10, EV_ELECTRIC_SPARK);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue