Doesn't make sense to have the Paths StaticBox inside the Common
settings StaticBox so make it a top-level item as well.
While at it dissolve nested constructors to make the creation of the
widgets more readable.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
To follow coding convention rename the vector Node to m_Nodes,
MaxDistance to m_MaxDistance and NodeCount to m_NodeCount.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Commit 81c57e8a28 added support for adding and removing paths.
Reloading path list stores the current selection but it's unused, assume
the idea was to restore it again.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Commit 309ed5ef28 used dynamic events
which prevents some other menu items from working properly. So don't mix
static and dynamic events for top window.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Bump wxWidgets, the upstream fix was backported to 3.2.9 with commit
a6fc33b416e2ebc804d80a1ac66021935c434573
Fixes: #8594
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Since #7786, the GUI tick completed normally after calling
`closePageCallback` instead of being cancelled like previously. Since
`Engine.EndGame` deletes the internal `g_Game` pointer, every Engine call
after it that tried to access `g_Game` caused a segfault.
This patch solves it by moving `Engine.EndGame` to the very end, right
before closing the session page.
In order to follow the convention that only functions directly closing
the page are called `closePageCallback`, that function is in turn
renamed to `closeSession`. Additionally, this allows only resolving
the promise with a bool (`showSummary`) and then only calling
`getNextPageOpenRequest` at the end of `init` for reasons of simplicity.
The issue was introduced by 8a2a450686.
It affected GUI text objects (CText) with `scrollbar` set to true; when
their caption was long enough for a scrollbar to be visible and then the
size changed (got bigger) so that no scrollbar was needed anymore, then
for a single frame the text was completely misaligned. This happened
because in `CText::Draw` the scrollbar wasn't updated yet, so the newly
added `GetScrollBar(0).IsVisible()` check still returned true, even
though it wouldn't end up being rendered anyway -- it was updated in
`IGUITextOwner::DrawText` eventually.
This happened to the tutorial info panel in the starting economy
walkthrough, for example. Note: in that case the scrollbar wasn't ever
drawn, but it was temporarily set visible within a frame by the JS
object resizing logic.
This patch adds a new type of tutorial steps called "GUI explanation",
with a corresponding GUI panel. The purpose of it is to explain what a
certain GUI element does. To make use of it the trigger script has to
specify the target GUI object's name as well as the side on which to
place the explanation panel relative to the target itself. The panel
then highlights the target object by fading everything else out with
black and also uses an arrow to point to it. Whilever the target GUI
object is hidden, the panel hides the background fade too and shows a
warning message.
Unlike for the other steps, the TutorialManager does not hide the
previously active panel when showing a GUI explanation, but instead
only disables it, since it could contain relevant information and the
GUI explanation panel is visibly placed "above" all other panels (in the
Z axis).
This patch introduces two functions `CompleteTutorial` and
`FailTutorial` for the tutorial steps to call. They can pass a
message to it to be shown on the victory/defeat screen.
`CompleteTutorial` is also called automatically when all steps are
finished, which resolves#8583 and prevents it from happening in the
future.
`FailTutorial` isn't used anywhere at the moment, but it'll be useful
for the future.
Fixes#8583
This patch allows steps to override the default hint caption and button
caption set by the PanelControlSection class. This allows them to better
communicate what the player is supposed to do, e.g. don't show "Follow
the instructions" if the player is only supposed to wait.
This patch fixes the TODO comment in playersFinished and moves
all of the calls to handlers. The only reason for adding back the
function `handlePlayersFinished` is to prevent duplication in the "won"
and "defeated" message handlers. In the future, code to execute when
players finish in the future should exclusively be added by registering
new handlers, not by adding it to that function.
966727b52e made the player state an enum and introduced more descriptive
functions to achieve the same thing, but it seems they were forgotten to
be replaced in a few places, which this patch fixes.
If a new tutorial step has already been completed by the player it isn't
skipped, but instead shown with the continue button, so that the player
can manually switch to the next one. However, it wasn't well
communicated to the player that this was the case and why the continue
button was shown at the same time as the instruction. This patch adds a
hint "You have already done this." to explain the this to the player.
This allows the trigger scripts to combine consecutive tutorial steps
that only differ in the `panelData.text` property into a single one that
instead defines a `panelData.texts` array.
This patch adds a new tutorial step type and corresponding tutorial
panel labelled "info". It is intended to display steps whose purpose it
is to explain something to the player and give tips -- rather than
just giving instructions and telling the player what to do, like the
instruction panel does.
Also, it can show several related steps at once. To do that, the first
step has to set the 'appendable' flag to true and can also define a
title; then the succeeding steps can then set the 'appendToPrevious'
flag to true in order to do exactly that.
Note: 'info'-type tutorial steps are still supposed to be able to define
triggers, switch to the next step on their own and hide the continue
button on the info panel, to teach the topic interactively, e.g.
"Select a unit by left-clicking on it."
In order to prevent code duplication between `InfoPanel` and
`InstructionPanel` a generic superclass `TutorialPanel` is introduced,
which manages the text, hint, and button objects.
The idea is to add different types of panels to the tutorial in the
future. And the only texts that players might read multiple times are
tips or explanations, which the plan is to display on an entirely
separate panel anyway.
Move the code that checks whether a player command is a "continue
tutorial" into a separate method, so that it never overrides the player
command action of the active tutorial step. This could previously
happen if a step had the showContinueButton flag was set to true (and
a OnPlayerCommand method defined).
Make the naming consistent with e.g. the Triggers Demo map
Remove the "On" at the start, since it's otherwise used for message
handlers, and replace "Trigger" at the end with "Action", since that
more accurately describes what it is.
- Remove the delay functionality from the tutorial. It was unused and
that for a reason. Switching to the next step after a fixed amount of
time is never wanted. It was only used to force-show the ready button
in one case, but a designated bool communicates the purpose better.
- Rename the "ready" button to "continue" as it fits better.
- Rename "leave" to "isLast" as it's more descriptive.
- Rename the "warning" object of the instruction panel to "hint" as it's
not always display warnings, and move its captions to the class
prototype like the coding conventions state.
- Simplify the logic in NextStep a bit to make it more readable.