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

Method hashTableContains

src/OpenLoco/src/World/Company.cpp:906–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

904 }
905
906 bool Company::hashTableContains(const Unk25C0HashTableEntry& entry) const
907 {
908 auto index = entry.calculateHash();
909 while (var_25C0[index].var_00 != 0xFFFF)
910 {
911 auto& rhsEntry = var_25C0[index];
912 if (rhsEntry.getPosition() == entry.getPosition()
913 && rhsEntry.getDirection() == entry.getDirection()
914 && rhsEntry.getTrackRoadId() == entry.getTrackRoadId())
915 {
916 return true;
917 }
918
919 if (!(rhsEntry.hasHashCollision()))
920 {
921 break;
922 }
923
924 index++;
925 if (index >= std::size(var_25C0))
926 {
927 index = 0;
928 }
929 }
930 return false;
931 }
932
933 bool Company::addHashTableEntry(const Unk25C0HashTableEntry& entry)
934 {

Callers 2

Calls 5

calculateHashMethod · 0.80
getTrackRoadIdMethod · 0.80
hasHashCollisionMethod · 0.80
getPositionMethod · 0.45
getDirectionMethod · 0.45

Tested by

no test coverage detected