diff options
author | Dylan Katz <dykatz@uw.edu> | 2022-01-09 20:40:39 -0800 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-01-10 00:58:40 -0800 |
commit | 0fda98dfb3d2212d865c9b1b41a122eb1bd07a4c (patch) | |
tree | 0fb9764c222ef9e2442e2088a0a16f68d649bec9 | |
parent | 2b206b18543323d7bf8e7e799817fd24a1a72729 (diff) | |
download | serenity-0fda98dfb3d2212d865c9b1b41a122eb1bd07a4c.zip |
2048: Fix off-by-1 when opening settings
When opening 2048's settings, it translates the target tile into
a power of 2. Previously, it was done incorrectly, causing the
resulting value to be off by one, and the number would increase
every time one opens, saves and closes the settings. With this
change, it now works as expected.
-rw-r--r-- | Userland/Games/2048/GameSizeDialog.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Games/2048/GameSizeDialog.cpp b/Userland/Games/2048/GameSizeDialog.cpp index 15d80e7571..8fda481852 100644 --- a/Userland/Games/2048/GameSizeDialog.cpp +++ b/Userland/Games/2048/GameSizeDialog.cpp @@ -16,7 +16,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t target, bool evil_ai) : GUI::Dialog(parent) , m_board_size(board_size) - , m_target_tile_power(AK::log2(target)) + , m_target_tile_power(AK::log2(target) - 1) , m_evil_ai(evil_ai) { set_rect({ 0, 0, 250, 150 }); |