NetPlay: Remove PadMapping type

Its usage was inconsistent, confusing, and buggy, so I opted to just
remove it entirely. It has been replaced with PadIndex for the
appropriate instances (mainly networking), and inappropriate usages
(where it was really just a player ID) have been replaced with the
PlayerId type. The definition of "no mapping" has been changed from -1
to 0 to match the defintion of "no player", as -1 (255 unsigned) is
actually a valid player ID.

The bugs never manifested because it only occurs with a full lobby of
255 players, at which point the last player's ID collides with the "no
mapping" definition and some undefined behavior occurs. Nevertheless, I
thought it best to fix it anyways as the usage of PadMapping was
confusing.
This commit is contained in:
Techjar
2018-11-19 05:30:39 -05:00
parent e6b2758ab4
commit 529796bd59
6 changed files with 37 additions and 37 deletions

View File

@ -90,7 +90,7 @@ int PadMappingDialog::exec()
const auto index = gc ? m_pad_mapping[i] : m_wii_mapping[i];
combo->setCurrentIndex(index == -1 ? 0 : index);
combo->setCurrentIndex(index);
}
}
@ -114,7 +114,7 @@ void PadMappingDialog::OnMappingChanged()
int gc_id = m_gc_boxes[i]->currentIndex();
int wii_id = m_wii_boxes[i]->currentIndex();
m_pad_mapping[i] = gc_id > 0 ? m_players[gc_id - 1]->pid : -1;
m_wii_mapping[i] = wii_id > 0 ? m_players[wii_id - 1]->pid : -1;
m_pad_mapping[i] = gc_id > 0 ? m_players[gc_id - 1]->pid : 0;
m_wii_mapping[i] = wii_id > 0 ? m_players[wii_id - 1]->pid : 0;
}
}