Commit graph

33042 commits

Author SHA1 Message Date
Charles Dang
f2a870b97c Game Display: removed unused variable
No idea what this did. It was added 11 years ago (9f11735f32)
but became unused at some point.
2018-04-20 10:23:43 +11:00
Charles Dang
3792612fb7 Removed OpenMP-related code
After some discussion, we concluded that this code was unmaintained, not even used in
some places (display.cpp, units/frame.cpp), leaving the only area that really used it
at all the image surface cache. Considering there was never really a conclusive benchmark
of its benefits and because said surface cache will be used a lot less going forward,
we're just removing it and simplifying everything for everyone.

Closes #1260 since it's now irrelevant.
2018-04-19 23:06:04 +11:00
Iris Morelle
fa15142150 gui2/title_screen: Make Version label formatted and translatable
Closes #2914.

This doesn't break the string freeze since it reuses a format string
from the same textdomain required by gui2/game_version for the exact
same purpose.
2018-04-18 21:16:14 -03:00
Charles Dang
44feb05ae0 Attempt to fix tests
Fixup a02100a0f1.
2018-04-18 16:06:29 +11:00
Charles Dang
c085c380f6 Loading Screen: rethrow exception if worker thread creation fails 2018-04-18 15:37:39 +11:00
Charles Dang
baab5a8156 Loading Screen: temporarily disable animation rate limiter
Seems to make the loading screen progress faster and gets rid of the weird issue
where the animation sometime wouldn't show up on game launch. Odd.
2018-04-18 15:16:13 +11:00
Charles Dang
be4b2c246f Random formatting cleanup I had sitting around 2018-04-18 13:52:39 +11:00
Charles Dang
86b3e6959b Loading Screen: refactor and clean up implementation
This covers several things:

Instead of creating a new worker thread manually and having it set class member state flags,
I instead utilized std::future and std::async. As far as I can tell, this should avoid the
(albeit unlikely) potential race condition wherein the ls could close before loading at all
if the thread was delayed in starting.

Removed the timer interface and split it into two components:
* A drawing callback that handles the animation. This has its granularity retained at 100 ms,
  but can be easily adjusted if we want it to go faster.
* A pump monitor that runs much more frequently (every time events::run_event_loop is called,
  technically). This handles checking the state of the std::future object and will then close
  the window. This makes the loading screen a bit speedier compared to the previous iteration
  since it no longer wastes time waiting for the next timer callback to close.

The one bit I'm not 100% sure about is the check for the future object's ready state in the dtor.
Though, relatedly, I wonder if perhaps we should wait for the worker thread to complete in that
case instead of exiting....

Also shuffled a few things around, such as immediately setting enter/esc disabled in pre_show
instead of waiting for everything there to finish.

Do note there occasionally seem to be a few odd issues with the dot animation after this commit.
Will look into that. But it may be some texture cache-related issue...

This also cleans up some unused log defines and a VS 2013 conditional include.
2018-04-18 13:52:07 +11:00
Iris Morelle
fc88cdff3b Fix segfault when trying to log into the MP server with an empty password
Probable regression introduced in commit
02ab29d2f1 (1.13.14).
2018-04-17 22:09:23 -03:00
Charles Dang
a7e1ff85ed Fixup c57a175fee
Turns out remove_const alone only removes the const from the pointer, not from the type
itself, so the expression wasn't returning true. This strips the pointer out before removing
const and matches against char instead of char*
2018-04-18 10:35:26 +11:00
Jyrki Vesterinen
a02100a0f1 Implement saving MP chat message history (#1194, #2802) 2018-04-17 22:29:26 +03:00
Charles Dang
28b1ab2861 Revert "Utilized 2x xBRZ scaling for portraitless units in game dialog"
This reverts commit 601c67d970 and 98ed802290.
2018-04-18 01:59:28 +11:00
Charles Dang
c57a175fee Lexical Cast: remove use of boost::mpl
The code was checking that the From type was either char* or const char*. Replaced it
with an equality check against char* with the const stripped from From so both match.
2018-04-18 01:40:26 +11:00
Charles Dang
1ec2de449e Revert some changes from 0b45363 I didn't mean to commit 2018-04-17 22:00:12 +11:00
Charles Dang
0b45363c95 GUI2: finished refactoring out usage of boost::mpl
dispatcher::has_event called the private find() function, which after a whole bunch of
jumping around essentially checked that the signal queue for the given event was not
empty. This was a run-time op, yet the code was set up using SFINAE in order to for
has_handler::oper() to call the event_signal function corresponding to the event's queue
(ie, the mouse queue for a mouse-type event).

Since this code was written before the era of constexpr, event type validation was done
using boost::mpl, which, in this case, resulted in a monstrous amalgamation of build-time
template specialization for a run-time check. I'm not certain, but I believe it might
have resulted in an specialization of find() (or at least, implementation::find()) for
every single event type (each member of the ui_event enum).

This converts the code to a purely run-time check and throws out all the template stuff.
It also removes the relevant event_signal overload dealing with events in a set. The
version dealing with function types is preserved as it's used in the fire_event()
implementation and is a fairly standard usecase of SFINAE.

The has_handler class has also been converted to a static function since it's no longer
needed for template specializations in find().

And finally, is_raw_event had to be renamed to is_raw_event_event to allow simple name
completion in IMPLEMENT_RUNTIME_EVENT_SIGNAL_CHECK. I could have also renamed the raw event
queue to signal_raw_queue but I figured keeping the name as signal_raw_event_queue made
its purpose clearer.
2018-04-17 21:52:28 +11:00
pentarctagon
fed813ef34 Revert "String View: use std::string_view on C++17 (untested)"
This reverts commit 00d87f8fe4.
2018-04-17 02:36:14 -05:00
pentarctagon
479d5fd01f Revert "Expand and fixup 00d87f8"
This reverts commit 52a516cfb7.
2018-04-17 02:36:14 -05:00
pentarctagon
298f1dc9c1 Attempt to fix UNUSEDNOWARN travis+gcc warnings. 2018-04-17 02:36:14 -05:00
pentarctagon
5dd5b6ec0b Attempt to fix travis error. 2018-04-17 02:36:14 -05:00
Iris Morelle
6d5f5d4299 campaignd: Remove last remaining trace of the master_password functionality 2018-04-17 02:42:38 -03:00
Iris Morelle
7d5d7ee7d4 campaignd: Add 'hide'/'unhide' control FIFO commands and hidden= attribute
These are used to hide an add-on from listings and deny the author the
ability to upload or delete it or change its passphrase. This is
meant to be used when enforcing add-ons server rules that do not justify
deleting all of the add-on's metadata (for example, issues with icons or
descriptions).
2018-04-17 02:42:15 -03:00
Iris Morelle
0475c349b8 campaignd: Add 'delete' control FIFO command 2018-04-17 02:42:02 -03:00
Iris Morelle
957be8b53e campaignd: Refactor add-on deletion code into its own method
This changes the order in which the hook_post_erase hook (currently
unused in production and fully untested) is fired so it will be run
*before* displaying the confirmation message to clients. This might need
to be changed at a later point if the hook functionality ever gets used
again, but for now it'll do.
2018-04-17 02:39:56 -03:00
Charles Dang
98ed802290 Fixup 601c67d970
Turns out that commit broke TC on unit images in messages since it broke the equality
check in lua_unit.cpp. Added the XBRZ IPF as part of the Lua unit portrait attribute
instead.

I *think* this is the proper place to do it.
2018-04-17 10:15:55 +11:00
Charles Dang
601c67d970 Utilized 2x xBRZ scaling for portraitless units in game dialog 2018-04-17 03:03:09 +11:00
Charles Dang
30257afd3f Drop Down Menu: allow right clicks to dismiss the window (fixes #2910) 2018-04-16 21:10:30 +11:00
Celtic Minstrel
7821f470c2 fixup! Support location_id in [recall] and [unstore_unit] 2018-04-16 00:55:55 -04:00
Celtic Minstrel
ea6578a87a fixup! Support location_id in [recall] and [unstore_unit] 2018-04-16 00:49:28 -04:00
Celtic Minstrel
ecc8785edb Support location_id in [recall] and [unstore_unit] 2018-04-16 00:00:51 -04:00
loonycyborg
2e24d20236 wesnothd: Fix UB caused by incorrect use of simple_wml::set_attr 2018-04-15 10:34:58 +03:00
Celtic Minstrel
0327085d99 Fix two of the dialog functions not accepting translatable strings 2018-04-15 02:03:31 -04:00
Iris Morelle
47b6b7f2a4 wesnothd: Use actual username when sending lobby messages too 2018-04-15 02:42:25 -03:00
Celtic Minstrel
0f267d0ede Fix #2894 2018-04-14 21:09:40 -04:00
loonycyborg
f5ab654760 wesnothd: made server fill in sender when forwarding whispers 2018-04-15 03:40:32 +03:00
Celtic Minstrel
8e4de9db67 Editor: Refresh named locations list when map context changes (fixes #1023)
This solution is a bit of a hack, but odds are this code will be
majorly refactored in 1.15 anyway. The important thing is that
this works.
2018-04-14 12:05:41 -04:00
Charles Dang
35590fd842 Lobby Info: filter on game name first
It's more common to want a name.
2018-04-15 02:53:01 +11:00
Charles Dang
ab54b62553 Attempt to fix non-required era being flagged for download
See #2747.
2018-04-15 02:02:14 +11:00
Charles Dang
29fcbd053d Replaced round_double and round_portable with std::round
std::round(double) uses the desired half-away-from-0 method.
2018-04-15 01:45:18 +11:00
Charles Dang
7621719c9a CVideo: added a macOS codepth for DIP fetch in screen_area() 2018-04-14 22:12:58 +11:00
Charles Dang
dbb56599c5 GUI2/Canvas: consolidate set_width and set_height into a single function
This is to enable me to do some testing with high DPI support.
Also there's never a situation where you'd only want to set one of these.
2018-04-14 21:15:53 +11:00
Charles Dang
c43f801aff Fixup 66dc671 (fixes #2887)
These changes somehow got lost in rebase...
2018-04-14 20:45:29 +11:00
Charles Dang
66dc67140f CVideo: removed "help string" interface
These will be handled by GUI2 tooltips once we get the editor all converted to
the new UI system.
2018-04-14 20:25:36 +11:00
Charles Dang
52a516cfb7 Expand and fixup 00d87f8 2018-04-14 17:25:19 +11:00
Charles Dang
9977addd64 Removed duplicate config_key_type alias
This isn't used in config_attribute_value.*pp but rather in config.*pp.
2018-04-14 17:25:14 +11:00
Charles Dang
96681151f0 Expand NORETURN, enable C99 unconditionally on MSVC
[[noreturn]] is supported on all the compilers we support. Still need to decide
the exact minimum versions and figure out what to do with DEPRECATED and FALLTHROUGH,
so leaving those for now.

And since we require VS 2015 and up we can enable C99 unconditionally.
2018-04-14 16:04:16 +11:00
Charles Dang
00d87f8fe4 String View: use std::string_view on C++17 (untested) 2018-04-14 16:04:03 +11:00
Charles Dang
17fc9d71db Removed bind_void
This is no longer needed with the compilers we support. It is needed on VS 2013, but
we dropped that. Don't know when GCC or Clang stopped needed it (if they ever did).

I'm guessing the "function that returns a value cannot be bound in a function type
that returns void" behavior wasn't an intentional design. Additionally, I don't believe
point 1 raised in the accompanying comment has ever been true... if so, pretty sure
we wouldn't have been able to build at all.

Also removed unnecessary global.hpp include from functional.hpp.
2018-04-14 15:53:13 +11:00
Charles Dang
164b6af766 Cleaned up even more joystick-related code... 2018-04-14 14:56:34 +11:00
Charles Dang
50407c1e8e Cleaned up some joystick-related code I missed (fixup d384b96) 2018-04-14 14:33:56 +11:00
Charles Dang
d384b96d97 Removed joystick code
This was never fully implemented and has been essentially abandoned. If we want to
add this again, we should look to adding full game controller support (Steam controller,
for example), though I don't know how suited this game is for controller support. As for
as I can tell, the only working part was ever map scrolling.

Includes a sqrt -> std::sqrt conversion I forgot in this file awhile back.
2018-04-14 14:16:18 +11:00