Skip to content

Commit

Permalink
Fixed tribe selection gui not scrolling to the correct position when …
Browse files Browse the repository at this point in the history
…opening
  • Loading branch information
Sollace committed Feb 12, 2024
1 parent cdcbfea commit db53f49
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ protected void init() {
addOption(race, top);
}

if (SELECTION == -1) {
SELECTION = options.size() / 2;
}
scroll(SELECTION, false);
scroll(SELECTION == -1 ? options.size() / 2 : SELECTION, false);
}

private void addOption(Race race, int y) {
Expand Down Expand Up @@ -167,11 +164,12 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
}

private void scroll(int target, boolean animate) {
if (target == SELECTION) {
SELECTION = target;
target *= 4;
if (targetScroll == target) {
return;
}
SELECTION = target;
targetScroll = SELECTION * 4;
targetScroll = target;
if (!animate) {
scrollPosition = targetScroll;
prevScrollPosition = scrollPosition;
Expand Down

0 comments on commit db53f49

Please sign in to comment.