Commit graph

33042 commits

Author SHA1 Message Date
Charles Dang
6920729812 Pango/Escape: used a stringstream for constructing the escaped text 2018-06-23 04:46:03 +11:00
Charles Dang
b6a0b2cb87 Drop Down List: added documentation and did some code cleanup 2018-06-23 04:41:19 +11:00
josteph
46fb1b6d48 Rename unit_recall_default_compare to default_compare 2018-06-23 04:40:43 +11:00
josteph
5316a83349 Unit List: Sort by XP as second criterion when sorting by level.
Fixes #3260.
2018-06-23 04:40:42 +11:00
josteph
175aa81941 MP Faction Select dialog: Always show the leading unit information, never "Unknown Unit". 2018-06-21 06:36:54 +03:00
Jyrki Vesterinen
18c266c2e7 Removed code that creates a help_manager
Adjusts the changes for commit 20a58fd8f8.
2018-06-21 06:34:27 +03:00
josteph
a8f83f6e68 MP Faction Select dialog: Show leader unit details.
If the leader hasn't been discovered, the "Unknown Unit" topic will be shown.

Fixes #1491
2018-06-21 06:30:20 +03:00
Pentarctagon
0a7ed44c08 Remove unused test file and images. 2018-06-20 18:46:01 +11:00
Iris Morelle
0c2298d8c2 config/cache: Ensure built-in symbols like WESNOTH_VERSION are always defined
Half-fix for issue #1634 and issue #1924.

The issue that remains to be solved is that on subsequent sessions after
a campaign has failed to load, it is possible for the game to generate a
cache entry for it that only contains the main menu WML for it.
Apparently the config cache transactions mechanism causes the game to
try to generate a cache entry with the wrong defines (a define set that
doesn't include the campaign's symbol, for instance) instead of the ones
that are actually needed and used to match the cache entry's filename
via checksumming. As a result, on subsequent sessions the failed
campaign is aborted with "failed to load the scenario" instead of
displaying the real WML error again (since the error is not hit again if
it depends on the campaign's symbol being defined).

In the meantime, this at least removes the red herring error and makes
the underlying issue a bit more visible. It's a very crude hack but it
does the job.
2018-06-18 18:34:02 -04:00
Iris Morelle
cdc8da25ae wesnothd: Fix lobby messages and whispers not being truncated as they should
For lobby messages, there was a length cap in place already, but the
truncated message was lost in processing because it ended up in a WML
document that isn't the one relayed to listening clients.

On the other hand, whisper messages were missing the truncate logic
entirely. Oops.

(The logic for in-game messages does truncate messages correctly as far
as I can tell, and additionally the client UI doesn't allow overlong
messages.)

Thanks to Soliton for pointing me towards the faulty code.
2018-06-18 04:48:29 -04:00
Iris Morelle
be41a692fb wesnothd: Only disclose the number of online admins to admins using adminmsg 2018-06-18 00:30:16 -04:00
josteph
e126e5ba36 Preferences: Keep the acceleration speed slider enabled even when the checkbox is disabled.
Apparently, this also causes the slider's value to be saved when dismissing the dialog with the checkbox disabled.

Fixes #2741
2018-06-17 10:42:47 +11:00
Charles Dang
30121aeb9c Select Orb Colors: cleaned up dialog implementation
Also fixes #2958 in the process since the entire setup process isn't repeated
when resetting selections.
2018-06-16 19:58:00 +11:00
Charles Dang
ea2ae55159 Attempt to fix console spam about images not drawing when running the tests
I don't think there's really any point drawing the UI in non-interactive mode.
2018-06-16 15:20:23 +11:00
Charles Dang
f54b3f7225 GUI2/Multimenu Button: fixed maximum_shown defaulting to 0 instead of 1
Fixes the campaign selection dialog's modification dropdown saying "1 other" for
the first mod you select.
2018-06-16 15:06:49 +11:00
Charles Dang
23740ea3cf GUI2/Multimenu Button: store max shown count as an unsigned int
A negative count here makes no sense...
2018-06-16 15:03:45 +11:00
Charles Dang
f95dc40f13 Cleaned up two emplace_back calls 2018-06-16 14:56:12 +11:00
Charles Dang
e8bd3c26d2 GUI2/Menu Button: store selected index as an unsigned int
Also initialized it to 0 in the ctor instead of relying on that being set
via set_values().
2018-06-16 14:54:58 +11:00
Charles Dang
3526aa8e86 Fixup unused parameter 2018-06-16 14:26:07 +11:00
Charles Dang
c2c613325b Faction Select: fixed changes persisting even if you cancel the dialog 2018-06-16 14:03:01 +11:00
Charles Dang
0632f91bd6 Faction Select: declared an execute() helper 2018-06-16 13:47:25 +11:00
Charles Dang
a5169f7c50 GUI2/Menu Button: allow changing selections with the scrollwheel (closes #3251)'
The changelog entry is under 1.14.3+dev since this is going to be backported.
2018-06-16 13:43:42 +11:00
Charles Dang
55f14ff22c GUI2/Menu Button: changed callbacks to NOTIFY_MODIFIED ones
menu_button doesn't even actually inherit from clickable_item. The only reason
[dis]connect_click_handler was declared in this class is the original implementation
was copied extensively from the Button widget.

Using NOTIFY_MODIFIED also means callbacks can fire if set_value/set_selected is used
on a menu_button.

The [dis]connect_click_handler functions were also removed from multimenu_button. All
callbacks for this widget type already used NOTIFY_MODIFIED signals.
2018-06-16 13:26:29 +11:00
Charles Dang
2d9b7d82c6 GUI2/[Multi]Menu Button: removed retval handling
Retvals are only relevant for widgets that are supposed to trigger something
like a window closure, and that makes sense for neither of these widgets. The
only reason the Menu Button widget has it is its original implementation was
largely copied from the Button widget, and the Multimenu Button widget copied
from the Menu Button widget.
2018-06-16 12:53:11 +11:00
Charles Dang
d7edb83b16 GUI2: added a bunch of missing virtual specifiers 2018-06-16 12:46:42 +11:00
Charles Dang
e8d55062c4 Fixed MP admins being unable to observe private games (fixes #2851)
This was due to the change in the MP initialization process wherein the lobby wouldn't
show up until the initial gamelist was received. Since the admin auth message is sent
after [join_game] and before the initial gamelist, and the chatbox widget handled parsing
the auth message, the client was never marked as authenticated and therefor couldn't
observe private games. This fixes that by adding auth parsing to the MP initialization
process.

Note this doesn't fix the issue of the auth confirmation not showing up in the lobby chat
(issue #2920). I'll have to think of a way to fix that separately.
2018-06-11 13:05:11 +11:00
Charles Dang
f1d2f85479 Statistics Dialog: keep the same stat selected between scenario selections
Fixes #3223, closes #3226.
2018-06-10 14:50:14 +11:00
Charles Dang
142a2f20ca Statistics Dialog: merge unit name and count labels
Makes it easier for translators to do something specific with this label if needs
be. I remember the reason the count (NUMx) label was moved prior to the name had
to do with language conventions too, so this should alleviate any other such issues.

Also made the name label default size instead of small.
2018-06-10 12:57:37 +11:00
Charles Dang
b5f1e1a48a Statistics Dialog: remove mode toggle in favor of an All Scenarios menu entry
Closes #2886.
2018-06-10 12:57:35 +11:00
Charles Dang
42349651cb Fixed [scenario] map_file basically being unusable
Automatically checking the path relative to a maps/ directory without binary
path support results in an invalid path almost every single time. If I remember
correctly from my testing, the only time that worked was if I added a data/maps
folder.
2018-06-10 10:32:39 +11:00
gfgtdf
25840c8a4b fix teamchat not marked #3119 2018-06-10 07:17:43 +11:00
gfgtdf
c79e1645c8 fix issues caused by empty save id
ee50171d13 broke some codes that relied on
unique save ids, that is in particular the statistic code and
scoped_recall_unit, so now these codes fallback to the side number if
the save id is empty.
2018-06-10 07:17:42 +11:00
Charles Dang
8fea48ab85 Preferences Dialog: cleaned up advanced prefs widget setup 2018-06-10 07:14:02 +11:00
Jyrki Vesterinen
f0896bdf8c Remove game_events::wml_event_pump::wml_tracking()
The variable **always** changed when event handlers were run, and thus the
optimizations to avoid updating some status after WML/Lua has run weren't
doing anything. In addition, commit 62ec3b3951 removed the most
important optimization that relied on wml_tracking().

Resolves #2578.
2018-06-09 19:35:01 +03:00
Charles Dang
00e58f12f9 Unit Attack: fixed issues arising from displayed items potentially not equally available items
Since there were weapons included that weren't shown, it was possible for the best
weapon selection to be a hidden one (in which case, the initial selection would be
wrong, and it was possible for the returned index to point to a hidden, disabled
weapon.

This resolves both issues by excluding these disabled attacks from the weapon choices
list altogether. They aren't considered when calculating the best attack either.

mouse_handler::fill_weapon_choices is also used in mouse_handler::attack_enemy_, but
I don't foresee this change should cause any issues there, since you aren't supposed
to be able to actually attack with disabled weapons anyway.
2018-06-09 03:34:22 +11:00
Charles Dang
eade3dd494 Fixup ea5945b (fixes #3221) 2018-06-08 22:36:44 +11:00
Charles Dang
ea5945b357 Fixup 79adc68 2018-06-08 20:05:51 +11:00
Charles Dang
424e0e0ab4 Fixup this atomic_bool again
Apparently atomic types aren't copy-assignable.
2018-06-08 19:45:52 +11:00
Charles Dang
79adc68ef6 Attempt to update tests for 3d894fa 2018-06-08 19:43:07 +11:00
Charles Dang
bc0ad54ab0 Added missing <atomic> include 2018-06-08 19:28:15 +11:00
Charles Dang
34195ae654 GUI2: removed now-redundant type parameter from build_single_widget_and_cast_to 2018-06-08 19:16:52 +11:00
Charles Dang
52f7fcf5cc GUI2: added a public static type getter to all widgets implementing get_control_type
Fixes #2400. See comment in styled_widget.hpp for details.
2018-06-08 19:16:19 +11:00
Charles Dang
3d894faf11 GUI2: made widget initialization process more secure against memory leaks
This commit is the followup to a similar one I did regarding window initialization. Instead
of widgets being created on the heap and not being managed by a smart pointer until they're
added to a grid, they are now always managed by a shared_ptr. To that end, this commit covers
bunch of things:

* builder_widget::build (both overloads) and all its overrides (which have now been marked
  as such) now return shared_ptr<widget>.
* The builder_grid::build() override now returns the same instead of grid* since you can't
  use covariant return types with smart pointers.
* The two implementation build helpers in builder_grid have been combined with an optional
  replacement map as the second parameter. Uses of the version that took a grid pointer could
  be easily converted to pass a reference instead.
* The pane, matrix, and viewport build() functions were removed in favor of making the ctor
  public. In case there was a deprecated ctor, that was removed.
* The viewport now keeps a widget shared_ptr instead of a reference that was then deleted
  by address-of. This was both better design and necessary to fix a crash.
* build_single_widget_instance_helper and build_single_widget_instance were renamed to
  build_single_widget and build_single_widget_and_cast_to to better represent their roles
  and to indicate the latter was more a convenience extension for the latter than the other
  way around.
2018-06-08 18:27:35 +11:00
Charles Dang
b70463b6ad Ensure events::call_in_main_thread is thread-safe 2018-06-08 07:33:42 +11:00
loonycyborg
787a1a0dae wesnothd: fix prematurely adding new players to games_and_users_list_
If dc happens during asio read that would call server::add_player
then a "ghost" player will appear in games_and_users_list_. Fix works by
moving the list update into the handler, it will be called only if read is
successful.

This should prevent issue #2989 unless it has some other mechanism
2018-06-06 19:47:20 +03:00
Iris Morelle
085236f556 gui2/unit_create: Do not exclude do_not_list units
This is a debug mode-only dialog. If I want to spawn a unit, the game
had better allow me to spawn any unit I want. do_not_list was created
for use by wmlunits anyway.
2018-06-06 03:14:07 -04:00
Jyrki Vesterinen
91afbfd586 Fix #2602: music doesn't change immediately on loading a save
This time I added an option to disable the feature to allow the currently
playing track to finish when changing the playlist. This allows more
fine-grained control of distinct use cases.

In wesnoth.cpp:do_gameloop(), I reversed the order of the title screen
music and default music because otherwise adding the default music would
enable play_once for the title screen music and prevent instant music
change when the player loads a save. I play title screen music with
immediate=yes, so it's still played first.
2018-06-05 20:45:04 +03:00
Jyrki Vesterinen
cafede479c Revert "Fix #2602: music doesn't change immediately on loading a save"
This reverts commit 94b69e0281.
2018-06-05 20:44:31 +03:00
loonycyborg
0c0bf7f91d wesnothd: fix server terminating in response to unregistered login
if unregistered logins are allowed
2018-06-05 14:27:45 +03:00
loonycyborg
a251808933 wesnothd: avoid needlessly casting pointer to long int 2018-06-05 14:27:45 +03:00