MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / Sort

Method Sort

src/openrct2/object/StringTable.cpp:161–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159 }
160
161 void StringTable::Sort()
162 {
163 const auto& languageOrder = GetContext()->GetLocalisationService().GetLanguageOrder();
164 std::sort(
165 _strings.begin(), _strings.end(), [languageOrder](const StringTableEntry& a, const StringTableEntry& b) -> bool {
166 if (a.Id == b.Id)
167 {
168 if (a.LanguageId == b.LanguageId)
169 {
170 return String::compare(a.Text, b.Text, true) < 0;
171 }
172
173 for (const auto& language : languageOrder)
174 {
175 if (a.LanguageId == language)
176 {
177 return true;
178 }
179 if (b.LanguageId == language)
180 {
181 return false;
182 }
183 }
184
185 return a.LanguageId < b.LanguageId;
186 }
187 return a.Id < b.Id;
188 });
189 }
190} // namespace OpenRCT2

Callers 15

LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45
LoadMethod · 0.45

Calls 4

GetContextFunction · 0.85
compareFunction · 0.85
endMethod · 0.65
beginMethod · 0.45

Tested by

no test coverage detected