From 803d0f45de320d38cfe24a05595361764ebb5362 Mon Sep 17 00:00:00 2001 From: Dav999-v Date: Mon, 29 Jun 2020 23:18:33 +0200 Subject: [PATCH] Document menu width limit better The reason for the menu width to be limited to 272 pixels was rather undocumented in the code, now the comment explains more about it. --- desktop_version/src/Game.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index aef1d554..62598925 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -7466,7 +7466,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) } // Automatically center the menu. We must check the width of the menu with the initial horizontal spacing. - // If it doesn't fit onscreen (including square brackets), reduce the horizontal spacing by 5 and retry. + // If it's too wide, reduce the horizontal spacing by 5 and retry. + // Try to limit the menu width to 272 pixels: 320 minus 16*2 for square brackets, minus 8*2 padding. + // The square brackets fall outside the menu width (i.e. selected menu options are printed 16 pixels to the left) bool done_once = false; int menuwidth = 0; for (; !done_once || (menuwidth > 272 && menuspacing > 0); maxspacing -= 5)