With this it puts the player back to the title screen after showing
an error dialog, so it's not much better, but at least it's not a
crash.
Fixes issue 7164. We weren't able to work out what caused the file corruption
reported, but I believe it's a race condition about saving while the AI is
recruiting. The file in the bug report has a `[snapshot]` tag with
`init_side_done=yes` but without a `playing_team` attribute, which must be the
result of `game_state::write()` when not in the `PLAY` phase. Loading such a
file causes `game_state::start_event_fired_ == false`, and triggers
`play_controller::start_game` to call `replay::add_start_if_not_there_yet`.
The i18n'd string is reused from `game_launcher.cpp`.
* Add lua mouse button event handler that can be consumed.
* Fix middle-mouse down/click not getting sent to lua
This is a flexible event handler mechanism to allow for more advanced
add-on features. It does not allow the add-on to consume the value
however, so there's no mechanism for the add-on to requrest the default
action not be executed.
We would normally deal separately with mouse down, up and click, with
the later being an event where the mouse has gone both down and up on
the same UI component. However, Wesnoth's code seems to allow a mouse up
on many UI components to serve as a click, so this implementation
follows that behavior.
This addresses issue #7949
The mouse handling code needs an overhaul, so this patch works with it
in it's current state in the best possible way. The revised code
attempts to restrict clicks to those events where a mouse went both down
and up on the same map tile. It is able to do this with the right mouse
button as well as X1 and X2, but must work as existing click events are
treated for now.
This means that "left click" is managed via the `left_click()` function
which occurrs at mouse down, "right click" via `right_mouse_up()` when
the right mouse button comes up, and the middle button's click behavior
is coded directly into mouse_handler_base::mouse_press() (so no function
is called) and "clicks" when the button comes down. The new
`on_mouse_button()` code will allow the mod developer to consume any
click event, preventing the default behavior, and also receive event
callbacks for up and down events, although the return value is ignored
for these calls and left and middle click occur on mouse down.
The code keeps record of the previous hp to prevent unit:transform form changing it. But it reads it before the object was added which prevented the object from increasing the units hp.
a free random training on easier difficulties should only be given in the first scenario. (Otherwise they'll accumulate to 5 free trainings at scenario 5.)
Fix https://github.com/wesnoth/wesnoth/issues/7923 .when we want to detect an ability with value=0-20 and an ability with add=15 is present, this is detected because the system assigns a value of 0 when 'value' is not present, and so the system matches abilities that do not use 'value' or even no numerical value at all. it is therefore necessary to decide that the absence of an attribute is a non-correspondence to the criteria.