Change selection grid to maintain relative horizontal position when switching rows (#329)

* Change selection grid to maintain relative horizontal position when switching rows

* clang-format

* Fixed joker selling index error

* Protect against division by 0 and removed redundant fixed point conversions.
This commit is contained in:
MeirGavish
2025-12-21 22:00:08 -08:00
committed by GitHub
parent 955a0942f1
commit f76c25614c
2 changed files with 14 additions and 7 deletions
+5 -1
View File
@@ -3994,9 +3994,13 @@ static void jokers_sel_row_on_key_transit(SelectionGrid* selection_grid, Selecti
if (key_hit(SELL_KEY))
{
game_sell_joker(selection->x);
int sold_joker_idx = selection->x;
// Move the selection away from the jokers so it doesn't point to an invalid place
// Do this before selling the joker so valid row sizes are used
selection_grid_move_selection_vert(selection_grid, SCREEN_DOWN);
game_sell_joker(sold_joker_idx);
}
}