Decompile 2 functions in Source/UI/ProbabilityTable/UIProbabilityTable.cpp
Batch #7050 by Lumen: 0 byte-identical, 2 confirmed by peer review. - fn_16148 ProbabilityTableFreezeCallback::operator(): logic confirmed by peer review - fn_16152 ProbabilityTableSelectCallback::operator(): logic confirmed by peer review Peer-reviewed-by: eAthena, Landruca Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
d7ea111c8f
commit
f3d4b4804a
1 changed files with 55 additions and 0 deletions
|
|
@ -48,6 +48,61 @@ private:
|
|||
|
||||
}
|
||||
|
||||
struct ProbabilityTableFreezeCallback {
|
||||
virtual ~ProbabilityTableFreezeCallback() = default;
|
||||
|
||||
/* 0004 */ CUIListBoxEx<ProbabilityTable::CUIItem, ProbabilityTable::CItemData>* list;
|
||||
|
||||
void operator()(CUIListItem* const& item);
|
||||
};
|
||||
|
||||
struct ProbabilityTableSelectCallback {
|
||||
virtual ~ProbabilityTableSelectCallback() = default;
|
||||
|
||||
/* 0004 */ CUIListBoxEx<ProbabilityTable::CUIItem, ProbabilityTable::CItemData>* list;
|
||||
|
||||
void operator()(CUIListItem* const& item);
|
||||
};
|
||||
|
||||
// OFFSET: 0x00A4CD60
|
||||
// FUNCTION: fn_16148
|
||||
void ProbabilityTableFreezeCallback::operator()(CUIListItem* const& item) {
|
||||
CUIListItem* selectedItem = item;
|
||||
for (ProbabilityTable::CUIItem* row : this->list->items) {
|
||||
row->SetHighlighted(selectedItem == row);
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A4CE10
|
||||
// FUNCTION: fn_16152
|
||||
void ProbabilityTableSelectCallback::operator()(CUIListItem* const& item) {
|
||||
CUIListBoxEx<ProbabilityTable::CUIItem, ProbabilityTable::CItemData>* list = this->list;
|
||||
CUIListItem* selectedItem = item;
|
||||
if (!list->unknown_00C4) {
|
||||
for (ProbabilityTable::CUIItem* row : list->items) {
|
||||
if (selectedItem != row) {
|
||||
row->SetSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
selectedItem->SetSelected(true);
|
||||
if (selectedItem->index != static_cast<int>(list->selected) || !list->unknown_00E0) {
|
||||
ProbabilityTable::CUIItem* probabilityItem = dynamic_cast<ProbabilityTable::CUIItem*>(selectedItem);
|
||||
if (probabilityItem) {
|
||||
list->selected = probabilityItem->index;
|
||||
if (list->onSelect && probabilityItem->index >= 0 &&
|
||||
static_cast<unsigned int>(probabilityItem->index) < list->data.size()) {
|
||||
auto node = list->data.begin();
|
||||
for (int index = probabilityItem->index; index > 0; --index) {
|
||||
++node;
|
||||
}
|
||||
list->onSelect(probabilityItem, *node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void CUIListBoxEx<ProbabilityTable::CUIItem, ProbabilityTable::CItemData>::OnScroll(int position);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue