2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:07:42 +00:00

Runtime/CGameOptions: Use std::array where applicable

Makes the data a little more strongly typed; preventing implicit
array->pointer decay. It also allows simplifying assignments within the
CGameState code.

While we're at it, we can also eliminate several instances of magic
numbers related to the array sizes throughout the code.
This commit is contained in:
Lioncash
2019-08-14 02:49:40 -04:00
parent cf294db9eb
commit acb9ac92e7
4 changed files with 64 additions and 47 deletions

View File

@@ -1502,12 +1502,12 @@ void CFrontEndUI::SOptionsFrontEndFrame::HandleRightSelectionChange() {
}
void CFrontEndUI::SOptionsFrontEndFrame::SetRightUIText() {
int userSel = x24_tablegroup_leftmenu->GetUserSelection();
const std::pair<int, const SGameOption*>& options = GameOptionsRegistry[userSel];
const int userSel = x24_tablegroup_leftmenu->GetUserSelection();
const auto& options = GameOptionsRegistry[userSel];
for (int i = 0; i < 5; ++i) {
std::string name = fmt::format(fmt("textpane_right{}"), i);
if (i < options.first) {
if (i < static_cast<int>(options.first)) {
FindTextPanePair(x1c_loadedFrame, name.c_str()).SetPairText(
x20_loadedPauseStrg->GetString(options.second[i].stringId));
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(true);