MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / HandleAircraftSmoke

Function HandleAircraftSmoke

src/aircraft_cmd.cpp:1249–1283  ·  view source on GitHub ↗

* Handle smoke of broken aircraft. * @param v Aircraft * @param mode Is this the non-first call for this vehicle in this tick? */

Source from the content-addressed store, hash-verified

1247 * @param mode Is this the non-first call for this vehicle in this tick?
1248 */
1249static void HandleAircraftSmoke(Aircraft *v, bool mode)
1250{
1251 static const struct {
1252 int8_t x;
1253 int8_t y;
1254 } smoke_pos[] = {
1255 { 5, 5 },
1256 { 6, 0 },
1257 { 5, -5 },
1258 { 0, -6 },
1259 { -5, -5 },
1260 { -6, 0 },
1261 { -5, 5 },
1262 { 0, 6 }
1263 };
1264
1265 if (!v->vehstatus.Test(VehState::AircraftBroken)) return;
1266
1267 /* Stop smoking when landed */
1268 if (v->cur_speed < 10) {
1269 v->vehstatus.Reset(VehState::AircraftBroken);
1270 v->breakdown_ctr = 0;
1271 return;
1272 }
1273
1274 /* Spawn effect et most once per Tick, i.e. !mode */
1275 if (!mode && (v->tick_counter & 0x0F) == 0) {
1276 CreateEffectVehicleRel(v,
1277 smoke_pos[v->direction].x,
1278 smoke_pos[v->direction].y,
1279 2,
1280 EV_BREAKDOWN_SMOKE_AIRCRAFT
1281 );
1282 }
1283}
1284
1285void HandleMissingAircraftOrders(Aircraft *v)
1286{

Callers 1

AircraftEventHandlerFunction · 0.85

Calls 3

CreateEffectVehicleRelFunction · 0.85
TestMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected