1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix General/SegmentSupportHeightCalls

This commit is contained in:
Marijn van der Werf
2016-10-17 23:12:54 +02:00
parent 4f10555002
commit a44745e2fa
6 changed files with 50 additions and 48 deletions

View File

@@ -27,7 +27,7 @@ bool GeneralSupportHeightCall::CallsMatch(SupportCall tileSupportCalls[4]) {
return true;
}
SupportCall *GeneralSupportHeightCall::FindMostCommonSupportCall(SupportCall calls[4]) {
bool GeneralSupportHeightCall::FindMostCommonSupportCall(SupportCall calls[4], SupportCall *out) {
std::map<SupportCall, int> map;
for (int i = 0; i < 4; ++i) {
@@ -39,30 +39,33 @@ SupportCall *GeneralSupportHeightCall::FindMostCommonSupportCall(SupportCall cal
}
if (map.size() == 1) {
return &calls[0];
(*out) = calls[0];
return true;
}
if (map.size() == 2) {
for (auto &&item : map) {
if (item.second == 3) {
return (SupportCall *)&item.first;
(*out) = item.first;
return true;
}
}
return nullptr;
return false;
}
if (map.size() == 3) {
for (auto &&item : map) {
if (item.second == 2) {
return (SupportCall *)&item.first;
if (item.second == 2) {
(*out) = item.first;
return true;
}
}
return nullptr;
return false;
}
return nullptr;
return false;
}
bool GeneralSupportHeightCall::AssertEquals(const SupportCall *lhs, const SupportCall *rhs) {