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

Method update

src/OpenLoco/src/Map/RoadElement.cpp:30–123  ·  view source on GitHub ↗

0x00477FC2

Source from the content-addressed store, hash-verified

28
29 // 0x00477FC2
30 bool RoadElement::update(const World::Pos2& loc)
31 {
32 if (owner() == CompanyId::neutral || CompanyManager::isPlayerCompany(owner()))
33 {
34 return true;
35 }
36
37 if (!(getGameState().roadObjectIdIsAnyRoadTypeCompatible & (1 << roadObjectId())))
38 {
39 return true;
40 }
41
42 if (sequenceIndex())
43 {
44 return true;
45 }
46
47 if (hasUnk7_10() || hasLevelCrossing() || hasUnk7_40() || hasUnk7_80())
48 {
49 return true;
50 }
51
52 if (isGhost() || isAiAllocated())
53 {
54 return true;
55 }
56
57 if (hasStationElement())
58 {
59 return true;
60 }
61
62 // Verify there are no other conflicting tile elements on the current tile either.
63 // This probably duplicates the above series of checks as well?
64 auto tile = TileManager::get(loc);
65 for (auto& el : tile)
66 {
67 auto* roadEl = el.as<RoadElement>();
68 if (roadEl == nullptr)
69 {
70 continue;
71 }
72
73 if (roadEl->baseZ() != baseZ())
74 {
75 continue;
76 }
77
78 if (roadEl->owner() == CompanyId::neutral || CompanyManager::isPlayerCompany(roadEl->owner()))
79 {
80 continue;
81 }
82
83 if (!(getGameState().roadObjectIdIsAnyRoadTypeCompatible & (1 << roadEl->roadObjectId())))
84 {
85 continue;
86 }
87

Callers 1

updateFunction · 0.45

Calls 12

isPlayerCompanyFunction · 0.85
getUpdatingCompanyIdFunction · 0.85
setUpdatingCompanyIdFunction · 0.85
baseZMethod · 0.80
roadObjectIdMethod · 0.80
isAiAllocatedMethod · 0.80
getFunction · 0.70
doCommandFunction · 0.50
ownerMethod · 0.45
sequenceIndexMethod · 0.45
isGhostMethod · 0.45
hasStationElementMethod · 0.45

Tested by

no test coverage detected