Commit graph

33042 commits

Author SHA1 Message Date
Jyrki Vesterinen
82e04ab761 Fix #2850: [modify_side] share_vision=yes doesn't do anything
Thanks to @gfgtdf for the suggested fix that works well.
2018-04-13 22:49:51 +03:00
Charles Dang
7cf9341379 Removed last boost/thread.hpp include
Locale doesn't rely on boost, so it must have been some other issue in Boost 1.60
that was incidentally fixed by including that file. If anyone ever happens to build
with 1.60 again we can revisit this.

For the record, there are no issues with VS 2017 and Boost 1.66.
2018-04-13 23:52:56 +11:00
loonycyborg
846bf8f208 Fix "host networked game" option
It was broken by b95c9996bf because
ignoring SIGCHLD makes it impossible to query exit status of wesnothd
subprocess. Fix this by spawning a thread to wait for the browser
instead of ignoring SIGCHLD.
2018-04-13 15:45:19 +03:00
Charles Dang
593e673734 Shot-in-the-dark attempt to fix the tests 2018-04-13 23:28:44 +11:00
Charles Dang
802bbe8cdc Game Load: added a convenient button in Load Game to open your saves folder 2018-04-13 18:21:35 +11:00
Charles Dang
fee641516b Fixup 7767902 2018-04-13 10:49:38 +11:00
Charles Dang
7767902261 Update tests for acc3fe8
We can just use a wesnothd_connection object directly here.
2018-04-13 10:42:39 +11:00
Charles Dang
acc3fe8906 Refactor out custom wesnothd_connection_ptr class again
I originally did this in 699047766a and then reverted it in
08a866dc20 due to @gfgtdf pointing out the object was never
actually destroyed since io_service::stop was never called (issue #1927).

This new method foregoes the custom wrapper class and instead waits for the worker thread
to terminate in the wesnothd_connection dtor. The use of the wrapper class is also why using
thread::detach alone worked (@jyrkive) and using join did not.

Additionally, the ptr alias is now of a unique_ptr instead of a shared_ptr.

I have verified that the connection dtor is actually called. This new method makes it clearer
what's actually going on.
2018-04-13 10:24:25 +11:00
Jyrki Vesterinen
8667e5bbdd Hotkey manager: drop duplicate commands
We use both SDL_KEYDOWN and SDL_TEXTINPUT events for hotkeys. It's possible
for both events (caused by the same keypress) to trigger the hotkey command
and we don't want that. Hence, let's drop duplicate commands.

Fixes #1736.
2018-04-12 19:46:56 +03:00
Charles Dang
2edcbdced8 Convert uses of boost::thread to std::thread
Also covers uses of boost::this_thread.

Turns out std::thread calls std::terminate if it's destroyed while still joinable.
thread::detach needs to be called or else the program will crash.

There's also no standard library equivalent of boost:🧵:timed_join so I just
replaced it with the is_worker_running_ variable.
2018-04-13 01:08:41 +11:00
loonycyborg
19d9e150e1 Fix issue #1757: prevent abnormal termination if failed to bind address 2018-04-12 14:30:45 +03:00
Celtic Minstrel
8f6613ea09 Fix #2745 2018-04-11 21:05:31 -04:00
Iris Morelle
7f8cb13bd3 help: Use new attack stats separator in unit descriptions
Closes #2873.

(This is part of a commented-out block in master because Vultraz hasn't
updated the code yet. He said I could forward-port the patch into it
anyway. For the time being unit descriptions are just completely missing
because of this.)
2018-04-11 22:02:14 -03:00
Jyrki Vesterinen
934f0326d8 Revert "Fix #1736: on GNU/Linux, a hotkey can trigger multiple commands"
This reverts commit c42401a8de.

As @CelticMinstrel pointed out, that commit made it impossible to input characters which require
AltGr to type (e.g. @, € and $ in Finnish keyboard).

Reopens #1736.
2018-04-11 18:58:15 +03:00
Charles Dang
607bc4c935 Fixup 4b6e547 because apparently I cannot write
[ci skip]
2018-04-11 17:43:47 +11:00
Charles Dang
4b6e5478be Fixup a1810bde32 (better comment)
[ci skip]
2018-04-11 17:40:58 +11:00
Charles Dang
a1810bde32 Game Events/Manager: skip disabled assertion if write_events is called mid-event
This reverts afaa75842c and replaces it with a more general
no-assert-during-events check. This is because there are other instances besides [inspect]
where this function can be called mid-event, and it wouldn't be convenient to add nested
'strict' parameters to multiple functions just to handle them.

Fixes #2750.
2018-04-11 13:08:27 +11:00
Charles Dang
1c8b508777 Connect Engine: attempt to fix fallback user team name not being translated
See #2863.
2018-04-11 10:46:51 +11:00
Charles Dang
275057df59 Gettext: used [[maybe_unused]] for UNUSEDNOWARN on C++17 2018-04-11 10:46:45 +11:00
Charles Dang
a4dd74c32a MP Create Game: fixed campaign player numbers label being untranslatable
Fixes #2861.

Also changed the logic for when the "min to max" label is shown from != to >.
2018-04-11 10:14:45 +11:00
Jyrki Vesterinen
c42401a8de Fix #1736: on GNU/Linux, a hotkey can trigger multiple commands
SDL_TEXTINPUT events aren't generated on Windows when Alt is held down.
Let's ensure that the behavior is the same on all platforms.
2018-04-10 19:05:40 +03:00
Charles Dang
15fdabbac9 Removed now-unused storage of team colors in the image namespace
Was used by ~TC(). That now uses the team class color helpers.
2018-04-10 21:20:36 +11:00
Charles Dang
c446e679f0 IPFs: simplify ~TC() implementation
This results in the same behavior as before (default color outside a scenario, side's
chosen color during one) and is more consistent with other places in the code. They
both end up accessing `game_config::team_rgb_range` anyway, this is just in a slightly
more roundabout way.
2018-04-10 21:02:48 +11:00
Charles Dang
325691107a Spritesheet Generator: implemented multi-thread image loading
This results in a rough performance increase of anywhere from 30% - 50%.
2018-04-10 17:00:23 +11:00
Charles Dang
f9e44ea282 Spritesheet Generator: simplified intermediate surface data storage 2018-04-10 13:48:12 +11:00
Charles Dang
d6ee95c763 Spritesheet Generator: simplified sheet height calculation 2018-04-10 13:19:38 +11:00
Charles Dang
f7d2924b27 Added initial implementation of a dynamic spritesheet generator
This isn't used anywhere yet. Right now it only takes a directory and generates one
sheet for all the images in that directory and its sub-directories. The sheets are
fully-functional textures, and a path -> rect mapping exists, but I haven't added anything
that uses it yet.

This will definitely need some improvements and changes to properly integrate with @jyrkive 's
OGL work.
2018-04-10 03:03:56 +11:00
Celtic Minstrel
46c46b5548 Add u and v variables to pixel_callable
It's currently calculated from x,y and w,h, but with the switch to shaders
this situation could be reversed to calculate x,y from u,v and w,h
2018-04-08 13:56:25 -04:00
Charles Dang
ccce10511a Unit Create: fixed unit selection not persisting between uses (fixes #2822)
I had been unconditionally selecting the first entry after setting the active
sorting option. This overrode the previous unit selection.

Regression from 6b52d16fae.
2018-04-08 13:11:27 +11:00
Celtic Minstrel
4b2dd68595 Support alignment= in SUF 2018-04-07 12:24:21 -04:00
Celtic Minstrel
62d39d6532 Support usage= in SUF 2018-04-07 12:24:11 -04:00
Celtic Minstrel
46f4b51482 SWF: Support lists for special= and special_active= 2018-04-07 12:23:06 -04:00
Celtic Minstrel
c62a4820fc Deprecate [replace_map]map= in favour of [replace_map]map_data=
This gives greater consistency between similar APIs, and allows macros
intended to drop a map into [scenario] to also work in [replace_map].
2018-04-07 12:22:52 -04:00
Jyrki Vesterinen
e7ed3cbbb9 Fix linking of C++ unit tests with CMake
The problem with them is that the "libraries" into which Wesnoth is split
have circular dependencies, and linking of the game succeeds only by chance
(everything just happens to be used by the time the linker encounters it).

Fixed by allowing the linker to use multiple passes over the libraries
until all references are resolved.
2018-04-07 13:15:01 +03:00
Charles Dang
d786fd6622 Image: handle case where l10n-track file is not present
Resolves #2825.
2018-04-07 19:34:10 +11:00
Charles Dang
3e7159e78e Minimap: removed old surface-based drawing implementation
Also cleaned up a minimap.hpp include.
2018-04-06 15:53:41 +11:00
Charles Dang
f5ec886cb5 Display: removed minimap drawing code
I kept some helper code (mainly the redraw_minimap function so I know where it needs
to be called) around for references.
2018-04-06 15:52:21 +11:00
Charles Dang
24d787c593 Minimap: added support for drawing unit markers
This moves the logic from the display class here. Will be utilized by the upcoming
interactive minimap widget I'm working on.
2018-04-06 15:39:50 +11:00
Charles Dang
e7a8af0c40 Renamed two t-prefix typedefs
[ci skip]
2018-04-06 12:20:35 +11:00
Celtic Minstrel
2afb40e3e9 Remove ai.synced_command stub 2018-04-05 19:45:36 -04:00
Martin Hrubý
31192cb44b Fixed typo 2018-04-05 16:00:41 +03:00
Charles Dang
3c5eb48601 Removed unused image::set_pixel_format
Its use was dropped when I got rid of the window framebuffer surface.
Also removed the image.hpp include from video.hpp.
2018-04-05 13:01:31 +11:00
Charles Dang
3922a48c5c Removed GUI1 formatting deliminator definitions 2018-04-05 12:45:21 +11:00
Charles Dang
b82516ffe6 Team: cleaned up some redundancy in color getters
* The one case of get_side_color_range().mid() was converted to get_side_color();
  These are equivalent
* get_side_rgb() was removed. Before color_range was refactored to use color_t
  (f2ab245e8d), the only difference between it and
  get_side_color() was that the former used to return uint32_t (the color they returned
  was the same.
* get_side_rgb_min() and get_side_rgb_max() were renamed to get_side_color_min() and
  get_side_color_max(), respectively. Both were unused in any case.
* get_side_highlight_pango() was renamed get_side_color_pango() and now takes a 1-indexed
  side like the other color functions instead of taking 0-indexed and adding 1.
2018-04-05 12:27:33 +11:00
Charles Dang
594877aaaa Game Config: removed unused UI sound variables
These were used by GUI1. GUI2 doesn't need them; it defines its sounds elsewhere
(see data/gui/default.cfg);
2018-04-05 11:40:39 +11:00
Charles Dang
1deacd89f6 Convert custom unicode type aliases to proper types (available as of C++11)
This changes:
utf8::char_t   ->  char
utf8::string   ->  std::string
utf16::char_t  ->  char16_t
utf16::string  ->  std::u16string
ucs4::char_t   ->  char32_t
ucs4::string   ->  std::u32string

utf16::string and ucs4::string are now proper strings instead of vectors of characters too.

In order to get this change to compile at all, I needed to add a ucs4_convert_impl::convert_impl
specialization for wchar_t alongside the new char16_t specialization; both point to the same
conversion implementation type.

This commit doesn't do any additional cleanup. I'm sure if we looked, we could get rid of a
lot of the custom conversion code and probably a bunch of stuff that might have had to do with
supporting utf16::string and ucs4::string being vectors instead of basic_string specializations.
Either way, I don't know the code (or encoding handling in general) to make a call as to what's
needed or not. I'll let someone else do that.
2018-04-04 18:54:29 +03:00
Charles Dang
cc78bb3b1c Preprocessor: cleaned up an unnecessary header include
enum classes can be forward-declared. Also removed redundant version.hpp include
and did some include re-ordering.
2018-04-04 22:20:54 +11:00
Charles Dang
b8d051cb72 Moved game version stuff from game_config.hpp to version.hpp
They're still in the game_config namespace but are now in a more logical header.

game_config::version has been replaced with wesnoth_version.str(), save for one case
where it was replaced with wesnoth_version directly (it was a comparison against another
version_info object; no need to compare against a string...).

Also cleaned up a bunch of game_config.hpp includes.
2018-04-04 22:08:18 +11:00
Charles Dang
6babb773d2 Fixed images with no alpha channel rendering incorrectly
See https://forums.wesnoth.org/viewtopic.php?p=625159#p625159

Since this problem can also be solved with make_neutral_surface, and is_neutral already
check a surface's alpha mask, I moved the is-not-indexed check to is_neutral and made use
of it for the on-load standardization check.
2018-04-04 20:16:43 +11:00
Charles Dang
464f7ce628 GUI2: minor refactoring of window construction to guard against memory leaks
This ensures the window object is managed by a smart pointer from the moment of its
creation, instead of being passed around as a raw pointer first. If an exception were
thrown during window creation, it would have resulted in a memory leak.

* Moved window_ member assignment to build_window() in both modal_dialog and modeless_dialog.
* Added an assertion after window creation in modeless_dialog.
* Renamed the global build() function to build_window_impl() to avoid confusion with
  builder_widget::build.
2018-04-04 17:05:51 +11:00