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

Method calculateHash

src/OpenLoco/src/World/Company.cpp:1148–1160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1146 }
1147
1148 constexpr uint16_t Company::Unk25C0HashTableEntry::calculateHash() const
1149 {
1150 const auto direction = getDirection();
1151 const auto pos = getPosition();
1152 const auto trackRoadId = getTrackRoadId();
1153
1154 const auto hash1 = direction ^ ((pos.z / World::kSmallZStep) & 0xFF);
1155 const auto hash2 = hash1 ^ ((pos.x / 32) * 8);
1156 const auto hash3 = hash2 ^ (pos.y / 32);
1157 const auto hash4 = hash3 ^ (trackRoadId * 64);
1158
1159 return hash4 & 0xFFFU;
1160 }
1161}

Callers 2

hashTableContainsMethod · 0.80
addHashTableEntryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected