CTransitionDatabaseGame: Tidy up GetMetaTrans()

We can leverage auto here to make the lambda functions significantly
less verbose.
This commit is contained in:
Lioncash 2020-04-10 23:51:16 -04:00
parent 89e2e65100
commit 0414235e76
1 changed files with 10 additions and 6 deletions

View File

@ -27,14 +27,18 @@ CTransitionDatabaseGame::CTransitionDatabaseGame(const std::vector<CTransition>&
} }
const std::shared_ptr<IMetaTrans>& CTransitionDatabaseGame::GetMetaTrans(u32 a, u32 b) const { const std::shared_ptr<IMetaTrans>& CTransitionDatabaseGame::GetMetaTrans(u32 a, u32 b) const {
auto it = rstl::binary_find(x14_transitions.cbegin(), x14_transitions.cend(), std::make_pair(a, b), const auto it = rstl::binary_find(x14_transitions.cbegin(), x14_transitions.cend(), std::make_pair(a, b),
[](const std::pair<std::pair<u32, u32>, std::shared_ptr<IMetaTrans>>& p) { return p.first; }); [](const auto& p) { return p.first; });
if (it != x14_transitions.cend()) if (it != x14_transitions.cend()) {
return it->second; return it->second;
auto it2 = rstl::binary_find(x24_halfTransitions.cbegin(), x24_halfTransitions.cend(), b, }
[](const std::pair<u32, std::shared_ptr<IMetaTrans>>& p) { return p.first; });
if (it2 != x24_halfTransitions.cend()) const auto it2 = rstl::binary_find(x24_halfTransitions.cbegin(), x24_halfTransitions.cend(), b,
[](const auto& p) { return p.first; });
if (it2 != x24_halfTransitions.cend()) {
return it2->second; return it2->second;
}
return x10_defaultTrans; return x10_defaultTrans;
} }