mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-06-17 11:13:28 +00:00
CLogBookScreen: Make use of structured bindings where applicable
Allows decomposing long pair names into their constituent elements
This commit is contained in:
parent
f21ee0786a
commit
251a2a7723
@ -106,12 +106,11 @@ void CLogBookScreen::UpdateRightTitles() {
|
|||||||
|
|
||||||
void CLogBookScreen::PumpArticleLoad() {
|
void CLogBookScreen::PumpArticleLoad() {
|
||||||
x260_24_loaded = true;
|
x260_24_loaded = true;
|
||||||
for (std::vector<std::pair<TLockedToken<CScannableObjectInfo>, TLockedToken<CStringTable>>>& category :
|
for (auto& category : x200_viewScans) {
|
||||||
x200_viewScans) {
|
for (auto& [scanInfo, stringTable] : category) {
|
||||||
for (std::pair<TLockedToken<CScannableObjectInfo>, TLockedToken<CStringTable>>& scan : category) {
|
if (scanInfo.IsLoaded()) {
|
||||||
if (scan.first.IsLoaded()) {
|
if (!stringTable) {
|
||||||
if (!scan.second) {
|
stringTable = g_SimplePool->GetObj({FOURCC('STRG'), scanInfo->GetStringTableId()});
|
||||||
scan.second = g_SimplePool->GetObj({FOURCC('STRG'), scan.first->GetStringTableId()});
|
|
||||||
x260_24_loaded = false;
|
x260_24_loaded = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -121,14 +120,14 @@ void CLogBookScreen::PumpArticleLoad() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rem = 6;
|
int rem = 6;
|
||||||
for (std::pair<TCachedToken<CScannableObjectInfo>, TCachedToken<CStringTable>>& scan : x1f0_curViewScans) {
|
for (auto& [scanInfo, stringTable] : x1f0_curViewScans) {
|
||||||
if (scan.first.IsLoaded()) {
|
if (scanInfo.IsLoaded()) {
|
||||||
if (!scan.second) {
|
if (!stringTable) {
|
||||||
scan.second = g_SimplePool->GetObj({FOURCC('STRG'), scan.first->GetStringTableId()});
|
stringTable = g_SimplePool->GetObj({FOURCC('STRG'), scanInfo->GetStringTableId()});
|
||||||
scan.second.Lock();
|
stringTable.Lock();
|
||||||
--rem;
|
--rem;
|
||||||
}
|
}
|
||||||
} else if (scan.first.IsLocked()) {
|
} else if (scanInfo.IsLocked()) {
|
||||||
--rem;
|
--rem;
|
||||||
}
|
}
|
||||||
if (rem == 0)
|
if (rem == 0)
|
||||||
@ -146,15 +145,18 @@ void CLogBookScreen::PumpArticleLoad() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::pair<TCachedToken<CScannableObjectInfo>, TCachedToken<CStringTable>>& scan : x1f0_curViewScans) {
|
for (const auto& [scanInfo, stringTable] : x1f0_curViewScans) {
|
||||||
if (scan.first.IsLoaded()) {
|
if (!scanInfo.IsLoaded()) {
|
||||||
if (scan.second && scan.second.IsLoaded()) {
|
continue;
|
||||||
|
}
|
||||||
|
if (!stringTable || !stringTable.IsLoaded()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateRightTitles();
|
UpdateRightTitles();
|
||||||
UpdateBodyText();
|
UpdateBodyText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CLogBookScreen::IsScanCategoryReady(CSaveWorld::EScanCategory category) const {
|
bool CLogBookScreen::IsScanCategoryReady(CSaveWorld::EScanCategory category) const {
|
||||||
CPlayerState& playerState = *x4_mgr.GetPlayerState();
|
CPlayerState& playerState = *x4_mgr.GetPlayerState();
|
||||||
@ -397,8 +399,9 @@ void CLogBookScreen::ChangedMode(EMode oldMode) {
|
|||||||
|
|
||||||
void CLogBookScreen::UpdateRightTable() {
|
void CLogBookScreen::UpdateRightTable() {
|
||||||
CPauseScreenBase::UpdateRightTable();
|
CPauseScreenBase::UpdateRightTable();
|
||||||
|
|
||||||
|
const auto& category = x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
|
||||||
x1f0_curViewScans.clear();
|
x1f0_curViewScans.clear();
|
||||||
std::vector<std::pair<CAssetId, bool>>& category = x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
|
|
||||||
x1f0_curViewScans.reserve(category.size());
|
x1f0_curViewScans.reserve(category.size());
|
||||||
for (const std::pair<CAssetId, bool>& scan : category) {
|
for (const std::pair<CAssetId, bool>& scan : category) {
|
||||||
x1f0_curViewScans.emplace_back(g_SimplePool->GetObj({FOURCC('SCAN'), scan.first}), TLockedToken<CStringTable>{});
|
x1f0_curViewScans.emplace_back(g_SimplePool->GetObj({FOURCC('SCAN'), scan.first}), TLockedToken<CStringTable>{});
|
||||||
@ -415,9 +418,8 @@ bool CLogBookScreen::ShouldLeftTableAdvance() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CLogBookScreen::ShouldRightTableAdvance() const {
|
bool CLogBookScreen::ShouldRightTableAdvance() const {
|
||||||
const std::pair<TLockedToken<CScannableObjectInfo>, TLockedToken<CStringTable>>& scan =
|
const auto& [info, stringTable] = x1f0_curViewScans[x1c_rightSel];
|
||||||
x1f0_curViewScans[x1c_rightSel];
|
return info.IsLoaded() && stringTable.IsLoaded();
|
||||||
return scan.first.IsLoaded() && scan.second.IsLoaded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CLogBookScreen::GetRightTableCount() const { return x1f0_curViewScans.size(); }
|
u32 CLogBookScreen::GetRightTableCount() const { return x1f0_curViewScans.size(); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user