MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / industryNearPosition

Function industryNearPosition

src/OpenLoco/src/World/IndustryManager.cpp:540–558  ·  view source on GitHub ↗

0x048FE92

Source from the content-addressed store, hash-verified

538
539 // 0x048FE92
540 bool industryNearPosition(const World::Pos2& position, IndustryObjectFlags flags)
541 {
542 for (auto& industry : industries())
543 {
544 const auto* industryObj = industry.getObject();
545 if (!industryObj->hasFlags(flags))
546 {
547 continue;
548 }
549
550 auto manhattanDistance = Math::Vector::manhattanDistance2D(World::Pos2{ industry.x, industry.y }, position);
551 if (manhattanDistance / World::kTileSize < 11)
552 {
553 return true;
554 }
555 }
556
557 return false;
558 }
559
560 // 0x004574E8
561 void updateProducedCargoStats()

Callers 1

generateNewStationNameFunction · 0.85

Calls 4

industriesFunction · 0.85
manhattanDistance2DFunction · 0.85
getObjectMethod · 0.45
hasFlagsMethod · 0.45

Tested by

no test coverage detected