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

Method addHashTableEntry

src/OpenLoco/src/World/Company.cpp:933–956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

931 }
932
933 bool Company::addHashTableEntry(const Unk25C0HashTableEntry& entry)
934 {
935 if (var_25C0_length >= 2048)
936 {
937 return false; // Hash table is full
938 }
939 auto index = entry.calculateHash();
940
941 while (var_25C0[index].var_00 != 0xFFFF)
942 {
943 auto& rhsEntry = var_25C0[index];
944 rhsEntry.var_02 |= 1U << 0; // mark as hash collision
945
946 index++;
947 if (index >= std::size(var_25C0))
948 {
949 index = 0;
950 }
951 }
952
953 var_25C0[index] = entry;
954 var_25C0_length++;
955 return true;
956 }
957
958 // 0x0042F0FC
959 void Company::setHeadquartersVariation(const uint8_t variation)

Callers 2

pathFindTrackSectionFunction · 0.80
pathFindRoadSectionFunction · 0.80

Calls 1

calculateHashMethod · 0.80

Tested by

no test coverage detected