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

Function isLoggedDivergenceUserString

src/OpenLoco/src/GameSaveCompare.cpp:124–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 }
123
124 static bool isLoggedDivergenceUserString(const std::string type, const std::span<char[32]> lhsArr, const std::span<char[32]> rhsArr, bool displayAllDivergences)
125 {
126 long divergentBytesTotal = 0;
127 for (auto offset = 0U; offset < lhsArr.size(); offset++)
128 {
129 bool isSame = strcmp(lhsArr[offset], rhsArr[offset]) == 0;
130 if (!isSame)
131 {
132 divergentBytesTotal++;
133 if (displayAllDivergences || divergentBytesTotal == 1)
134 {
135 Logging::info("DIVERGENCE");
136 Logging::info("TYPE: {}", type);
137 Logging::info(" OFFSET: {}", offset);
138 Logging::info(" LHS: {}", lhsArr[offset]);
139 Logging::info(" RHS: {}", rhsArr[offset]);
140 }
141 }
142 }
143 if (!displayAllDivergences && divergentBytesTotal > 1)
144 {
145 Logging::info(" {} other diverging bytes omitted", divergentBytesTotal);
146 }
147 return divergentBytesTotal > 0;
148 }
149
150 template<typename T>
151 bool isLoggedDivergentGameStateField(const std::string type, int offset, const T& lhs, const T& rhs)

Callers 1

compareGameStatesFunction · 0.85

Calls 2

infoFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected