Decompile fn_03871 (UIChangeMaterialWnd_List::sub_5E1080)
Batch #3295 by bigodeira: 0 byte-identical, 1 confirmed by peer review. - fn_03871 UIChangeMaterialWnd_List::sub_5E1080: logic confirmed by peer review Peer-reviewed-by: eAthena, meitogi 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
d5970c262b
commit
cef791300a
2 changed files with 48 additions and 0 deletions
|
|
@ -1,5 +1,33 @@
|
|||
#include "UI/UIChangeMaterialWnd.h"
|
||||
|
||||
// OFFSET: 0x005E1080
|
||||
// FUNCTION: fn_03871
|
||||
void UIChangeMaterialWnd_List::sub_5E1080(int delta) {
|
||||
int64_t newIndex = this->m_selectedIndex + delta;
|
||||
const int count = static_cast<int>(this->m_items.size());
|
||||
const int maxIndex = count - 1;
|
||||
|
||||
if (newIndex >= static_cast<uint32_t>(maxIndex)) {
|
||||
newIndex = maxIndex;
|
||||
}
|
||||
|
||||
int targetIndex = static_cast<int>(newIndex);
|
||||
if (targetIndex < this->m_scrollOffset || targetIndex >= this->m_scrollOffset + this->m_pageSize) {
|
||||
int newOffset = this->m_previousScrollOffset;
|
||||
if (targetIndex < newOffset || targetIndex >= newOffset + this->m_pageSize) {
|
||||
const int candidate = targetIndex - this->m_pageSize + 1;
|
||||
const int limit = count - this->m_pageSize;
|
||||
newOffset = static_cast<unsigned int>(candidate) < static_cast<unsigned int>(limit) ? candidate : limit;
|
||||
}
|
||||
|
||||
this->m_scrollOffset = newOffset;
|
||||
this->sub_5E2A70();
|
||||
this->m_previousScrollOffset = this->m_scrollOffset;
|
||||
}
|
||||
|
||||
this->sub_5E3B80(targetIndex);
|
||||
}
|
||||
|
||||
// OFFSET: 0x005E1120
|
||||
// FUNCTION: fn_03872
|
||||
ITEM_INFO* UIChangeMaterialWnd::GetItemAt(int x, int y) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue