Decompile fn_11553 (UIListBoxEx::SendMsg)

Batch #17502 by cremane: 0 byte-identical, 1 confirmed by peer review.

- fn_11553 UIListBoxEx::SendMsg: logic confirmed by peer review

Peer-reviewed-by: eAthena, bibinir
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-11 23:46:55 +00:00
commit b75e65ced8

View file

@ -237,18 +237,19 @@ int UIListBoxEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
case UM_SCROLLVERTPAGEUP:
case UM_SCROLLVERTPAGEDOWN: {
const int previous = this->topLine;
const int visible = this->geometry.height / this->lineHeight;
const int delta = message == UM_SCROLLVERTPAGEUP ? (1 - visible) : message == UM_SCROLLVERTPAGEDOWN ? (visible - 1) : value;
this->topLine = previous + delta;
if (message == UM_SCROLLVERTPAGEUP) {
this->topLine = previous - this->geometry.height / this->lineHeight + 1;
} else if (message == UM_SCROLLVERTPAGEDOWN) {
this->topLine = previous - 1 + this->geometry.height / this->lineHeight;
} else {
this->topLine = previous + value;
}
if (this->topLine < 0) {
this->topLine = 0;
}
const int maximum = ((static_cast<int>(this->lines.size()) - visible) + this->bottomMargin);
if (static_cast<unsigned>(this->topLine) > static_cast<unsigned>(maximum)) {
this->topLine = maximum;
if (this->topLine > this->lines.size() - this->geometry.height / this->lineHeight + this->bottomMargin) {
this->topLine = this->lines.size() - this->geometry.height / this->lineHeight + this->bottomMargin;
}
this->verticalBar->position = this->topLine;