All but two calls to this function manually checked the visibility,
so it seemed logical to roll the check into this function.
For the other calls, it seems like it wouldn't matter too much,
except maybe in rare edge cases
These differ from post_show events, which are part of tdialog and show after the window has closed.
Nothing in post_show can stop the dialog closing. This new exit hook functionality allows setting of
functions that fire before a window attempts to close by any method, and can halt the order.
This is much simpler than attempting to hook into every closure source on a per-dialog basis.
* If no game was show in the dialog (due to an invalid filter) one could still use Enter to load a game
* In the same situation above, ESC would cause a crash
* Canceling the Select Difficulty dialog would still try to load a game
This might have been the intended behavior, but it's not optimal.
A logic error caused any added aspects to be mixed together with
existing aspects if it was executed before the AI had been initialized.
This is the cause of the unknown aspect warnings from
GregoryLundberg/wesnoth#28
The support parameter in the attack evaluation quantifies how much
power the AI can bring to an attack hex. This is supposed to include
the attacking unit itself. However, in some circumstances (such as when
the unit cannot move for one reason or another) this unit is not
accounted for. If no other units can get to this hex either, support is
(erroneously) set to zero, resulting in an attack score of zero, which
in turn results in no attack. Skipping the multiplication of the score
by support in this case does not affect comparison with other attacks
here, as this is by definition the only attack possible on the given
hex.
Note that the '!is_surrounded' conditional is also covered by 'support
!= 0' and can therefore be deleted.
This fixes bug #23720.
Some explanations:
- savepng uses setjmp, so I changed it to C; this guarantees that someone does not accidentally introduce a C++ object in it (unlikely though that is)
- The loop in multiplayer.cpp seemed intended to allow the command-line to request repeated plays, so the break was removed rather than refactoring it to an if statement
- Some uninitialized structs were changed to be zero-initialized
- Use luaW_toboolean instead of lua_toboolean
- Needed explicit constructor for vconfig iterators, since their only member is const
The unit::get_ability_bool() function accessed resources::gameboard that
is not set in the editor. Now the function receives the display context
as a parameter instead.
I also fixed two crashes on editor startup in MSVC debug builds (both
caused by indexing the teams vector when there aren't any teams), and the
GUI2 unit list dialog showing wrong status icons.