Closed wzdev-ci closed 5 years ago
Forgon _uploaded file reticule_icons.patch
(25.0 KiB)_
patch file based on revision 01c74c97ee049f315875b19d3685a5da3be1fc86
Forgon _uploaded file tutorial3_close_button.png
(487.3 KiB)_
beginning of base building tutorial in version 3.2.3 with correct central button
Forgon _uploaded file tutorial3_close_button_bug.png
(503.7 KiB)_
beginning of base building tutorial with broken central button before applying this patch series
Forgon2100 forgon2100@... changed status from new
to closed
Forgon2100 forgon2100@... changed resolution from ` to
fixed`
Forgon2100 forgon2100@... commented
In https://github.com/Warzone2100/warzone2100/commit/e5c456a7e5a7f57ed1056124ebe750640dee03db:
#CommitTicketReference repository="" revision="e5c456a7e5a7f57ed1056124ebe750640dee03db"
Fix wrong icon for central button in reticule area
* show disabled "Close" button in reticule area with its correct green icon
instead of grey icon, which is of the wrong size and consequently misaligned
* fix visual glitch in tutorial, which starts with this button in disabled state
Fixes #4855
Forgon2100 forgon2100@... commented
In https://github.com/Warzone2100/warzone2100/commit/cb1252cd7df301ed87c8ef4e2da7399cd12a00f2:
#CommitTicketReference repository="" revision="cb1252cd7df301ed87c8ef4e2da7399cd12a00f2"
Change calculation of reticule button coordinates
* simplify coordinates for all reticule button images
* merge setReticuleBut() into intAddReticule()
* remove useless variables RETXOFFSET and RETYOFFSET
Fixes #4855
Forgon2100 forgon2100@... committed [5530]
In https://github.com/Warzone2100/warzone2100/commit/5530a063fd31b5379705bc2e56dc285a4ca93618:
#CommitTicketReference repository="" revision="5530a063fd31b5379705bc2e56dc285a4ca93618"
Change function setReticuleButton()
* remove filename arguments because they are unnecessary to enable buttons
and too obscure as an undocumented mechanism to disable them
* add boolean argument to enable/disable buttons
Fixes #4855
Forgon edited the issue description
resolution_fixed
type_patch (an actual patch, not a request for one)
| by ForgonBefore the base building tutorial was converted to JavaScript, it started with all buttons in the reticule area grayed out, except for the central button.
To achieve a similar look in the JavaScript tutorial, all reticule area buttons, including the central button, were disabled in
This change had two unintended consequences: The central button
The close button was disabled and its reticule button shown by the following instructions in data/base/script/tutorial.js:
Because setReticuleButton() in src/qtscriptfuncs.cpp was called with an empty third argument (meant to contain a filename), setReticuleStats() in src/hci.cpp disabled its button number, 0 (the value of CLOSE_BUTTON).
Later, js_showInterface() in src/qtscriptfuncs.cpp displayed reticule buttons through functions in src/hci.cpp: intAddReticule() called addReticuleBut() called intDisplayReticuleButton(), which showed the same picture every time a reticule button is disabled, the wrong one in the case of the central button:
Because the wrong picture was shown, its coordinates were wrong, too. The position of of reticule area images was calculated by the addition of:
The correct central button picture is 46x37 pixels in size, larger than an ordinary reticule button picture of 37x28 pixels. The latter includes a shadow at its right side, one pixel wide. The smaller picture's offset from its correct position is thus expected to be (46-37-1)/2,(37-28)/2 = 5,4 pixels. The actual value of 5,3 resulted from offsets in data/base/images/intfac.img:
=== Refactoring
In the course of investigating this bug, some related code was refactored:
=== Simplify script function setReticuleButton()
The function setReticuleButton() no longer takes filenames that determine which images need to be displayed or whether the reticule button is enabled. The images that need to be shown for different buttons never change, and disabling buttons via empty filename argument was an undocumented feature. As a replacement for the filename arguments, a boolean argument determines whether a button is enabled (if set to true) or not (if set to false).
Edit: This commit has been reverted on request.
Issue migrated from trac:4855 at 2022-04-16 13:33:58 -0700