MCPcopy Create free account
hub / github.com/DFHack/dfhack / is_wagon_dynamic_traversible

Function is_wagon_dynamic_traversible

plugins/pathable.cpp:221–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219};
220
221static bool is_wagon_dynamic_traversible(df::tiletype_shape shape, const df::coord & pos) {
222 auto bld = Buildings::findAtTile(pos);
223 if (!bld) return false;
224
225 auto btype = bld->getType();
226 // open hatch should be inaccessible regardless of the tile it sits on
227 if (btype == df::building_type::Hatch) {
228 if (shape == df::tiletype_shape::RAMP_TOP)
229 return false;
230
231 auto& hatch = *static_cast<df::building_hatchst*>(bld);
232 if (hatch.door_flags.bits.closed)
233 return true;
234 // open floor grate/bar should be inaccessible regardless of the tile it sits on
235 } else if (btype == df::building_type::GrateFloor) {
236 auto& b = *static_cast<df::building_grate_floorst*>(bld);
237 if (b.gate_flags.bits.closed)
238 return true;
239 } else if (btype == df::building_type::BarsFloor) {
240 auto& b = *static_cast<df::building_bars_floorst*>(bld);
241 if (b.gate_flags.bits.closed)
242 return true;
243 }
244 // Doors, traps..etc
245 return false;
246}
247
248// NOTE: When i.e. tracks, stairs have a bridge over them, the tile will have
249// an occupancy of floored.

Callers 1

is_wagon_traversibleFunction · 0.85

Calls 1

getTypeMethod · 0.80

Tested by

no test coverage detected