Commit graph

70547 commits

Author SHA1 Message Date
Charles Dang
6d8cbf281f Merge branch 'master' of github.com:wesnoth/wesnoth 2017-11-25 09:03:23 +11:00
Charles Dang
fafdb95c84 Title Screen: minor refactoring to button callback registering
* Removed window reference from callback function signature. Instead, bind (or capture)
  window reference when register_button is called.
* Moved long callbacks to their own functions.
2017-11-25 09:03:06 +11:00
pentarctagon
7ff30491fe Make strict builds consistent between scons and cmake 2017-11-24 15:00:01 -06:00
mattsc
5987ff88ae Update Xcode project 2017-11-24 11:23:52 -08:00
loonycyborg
821b4ecbc7 Move asio streambufs in network_asio::connection into unique_ptrs
This is needed to properly reinitialize streambuf objects after cancel.
This prevents crash from issue #2203 but download after cancel still doesn't
work properly. More investigation needed.
2017-11-24 18:18:42 +03:00
Charles Dang
8bf95ce69a GUI2: changed hotkey callback return value to void
The bool retval was presumably meant to allow stopping execution of the main hotkey callbacks
if a local one was meant to take precedence. However, that wasn't used anywhere (all callbacks
were returning true) and the return value just meant we had to create lambdas or wrapper functions
everywhere. If necessary, we can re-add halt functionality later.

I did leave sdl_event_handler::hotkey_pressed returning a bool value, though, except now it signals
whether there was a valid dispatcher with which to execute the hotkey callback. This seemed reasonable
since we probably wouldn't want to continue if there were no dispatcher anyway, though this only has
any effect in the key_down handler.
2017-11-25 02:09:49 +11:00
Charles Dang
b7367b8b07 Create Engine: keep a member reference to the game config
Shortens the code slightly by avoiding continuously fetching it from the gc manager.
2017-11-25 00:19:51 +11:00
Charles Dang
5481a7985f Cleaned up SP initialization function parameters
As of f4584b6b72 the game_config isn't needed in SP initialization anymore, and
enter_connect_mode can be made to return void.
2017-11-24 23:34:53 +11:00
Charles Dang
f4584b6b72 MP Game Settings: removed show_connect member
Early in the 1.13 development cycle there used to be an option to show the mp_connect screen
(now mp_staging) before starting an SP campaign. That was scrapped and the only code that used
it (in the SP initialization process) commented it out. Since we're not going to restore it,
might as well remove this flag.

Also removes the one instance remaining of a "show_configure" flag. Pretty sure this might have
also been a relic from the same time as show_connect, but it looks like it was since removed.
SP now has a dedicated screen for configuring active modifications in SP, which was the only
reason to show the configure dialog anyway (plus the mp create and configure screens were combined
later in 1.13 anyway).
2017-11-24 23:16:33 +11:00
Charles Dang
acd31b1a77 MP Game Utils: formatting and minor code cleanup 2017-11-24 23:08:40 +11:00
Nils Kneuper
21eb31b757 updated Spanish translation 2017-11-24 00:18:27 +01:00
Nils Kneuper
6f9f1904fd fixed syntax error in pofix and "problem"
note: please do only enter "Part of the string", not the full strings.
The text in the po files is broken into parts and full strings, with
missing newlines, will not cause matches for the string.
2017-11-24 00:16:19 +01:00
Gregory A Lundberg
81fc44ad5d Fix typos in ad01dbd404 2017-11-23 16:32:56 -06:00
Gregory A Lundberg
0eb25f41d0 Fix wesnoth.print
Pass each parameter through Lua tostring() to convert to strings. This also allows meta-method tostring on userdata.

This aligns the operation of wesnoth print() to be closer to what a Lua programmer would expect from the normal Lua print() which is not available.

Closes Issue #2236
2017-11-23 10:59:39 -06:00
kallaballa
2150cdbde6 replaced recieve with receive 2017-11-24 02:50:44 +11:00
Charles Dang
693735d90c Fixed a bunch of log output and code comment typos
[ci skip]
2017-11-24 01:14:03 +11:00
sigurdfdragon
ec7b536c7c update changelog 2017-11-22 20:27:34 -05:00
sigurdfdragon
23c23b7a55 WML: Add [show_if] usage in [objectives] subtag [gold_carryover] 2017-11-22 20:27:13 -05:00
sigurdfdragon
64d3aa1ab6 SotA: Fix and improve freeze/thaw unit implementation
Bug was that when a unit was thawed, mouse over in unit sidebar would show
incorrect movement costs (all 1's).

New implementation properly uses {UNREACHABLE} and makes use of the now
available [remove_object] tag.
2017-11-22 17:37:14 -05:00
Alexander van Gessel
ca03818fa8 >= 1.64, not > 1.64 2017-11-22 16:16:53 +01:00
Alexander van Gessel
0cbab6eeed Bump minimum boost version for external string_view 2017-11-22 15:48:42 +01:00
Charles Dang
111ca03510 Wesnothd Connection: formatting cleanup 2017-11-22 20:22:26 +11:00
Jyrki Vesterinen
722f319c50 Make hotkeys copyable again
There is barely any point in moving hotkeys because the command is the only
member variable that's both 1) movable and 2) faster to move than copy. In
2cc3f99651, @Vultraz talked about "avoiding hundreds of copies", but
moving isn't necessarily any faster than copying. Seriously, making hotkeys
noncopyable was just a premature and obviously unprofiled optimization.

Besides, this also fixes build on Visual Studio 2013.
2017-11-22 08:42:41 +02:00
pentarctagon
a4a1cec637 Remove -rdynamic from the linker. 2017-11-22 07:16:16 +02:00
Charles Dang
2cc3f99651 Hotkeys: cleanup and simplification of hotkey_command list
* Used an std::array instead of C array for hotkey_list_.
* Used an std::vector instead of boost::ptr_array for known_hotkeys.
* Made hotkey_command non-copyable and movable in order to avoid hundreds of copies.
* Added a hotkey_command ctor that takes a hotkey_command_temp reference.
* Hopefully prevent some reallocations by reserving an appropriate amount of memory for known_hotkeys
  before filling it up.
* Search from the end of know_hotkeys when calling remove_wml_hotkey(). This avoids traversing the almost
  200 vector members that likely will not match.
* Deployed auto/range-for.
* For some reason I needed to add a <cassert> include to gui2/widgets/grid.hpp.
2017-11-22 12:06:20 +11:00
Alexander van Gessel
1a98327779 Convert indexes to unsigned
This should assure coverity that no negative indexes will be used.
2017-11-22 05:12:42 +11:00
Alexander van Gessel
80cae581ab Make check earlier 2017-11-22 05:12:42 +11:00
Alexander van Gessel
554555bb03 Assert that indexes are on board 2017-11-22 05:12:42 +11:00
Alexander van Gessel
d4df2cc6c4 Remove negative index use-case 2017-11-22 05:12:42 +11:00
Charles Dang
b1c9cb41c3 Cleaned up unnecessary video.hpp includes 2017-11-21 18:24:45 +11:00
Charles Dang
b51677d985 Made use of SDL_CreateRGBSurfaceWithFormat* on SDL 2.0.6+
These functions were introduced in 2.0.5, but a packaging error meant they weren't properly
included in the VS libs for that release. So I set the minimum to 2.0.6. Not sure if we want
to leave the fallbacks for the other versions or bump the minimum to 2.0.6.
2017-11-21 17:16:49 +11:00
Charles Dang
976f37c08a Fixed graphical artifacts appearing in Fake Map Border/Off Map terrains with SDL 2.0.6+ (fixes #2061)
[ci skip]

Something was screwy about these image's alpha. Normally when I remove an alpha channel in GIMP,
it shows up white. With these images, it showed up black. Maybe they had an embedded palette or
something, I don't know, but the problem is fixed.

Something must have changed in SDL 2.0.6 that caused this issue to appear. Not sure if anything
needs to be patched in our source code, though (but not likely)
2017-11-21 16:22:12 +11:00
Jyrki Vesterinen
bc7ce292cd Attempt to fix build with GCC 4.8 2017-11-21 06:44:33 +02:00
Jyrki Vesterinen
89ad1b2676 Rewrite the link detection code
The previous code sometimes produced invalid Pango markup.

Instead of attempting to parse Pango markup, simply scan for links in the
raw text and replace them in Pango markup. This way there is no way to
accidentally break the markup.
2017-11-21 06:44:33 +02:00
Charles Dang
5703c49ae4 Game Display: removed unused create_dummy_display function
This was probably used before we had the fake_display_manager class.
2017-11-21 14:20:15 +11:00
Charles Dang
3da9077312 CVideo/Display: cleaned up/slightly refactored a few things
* display::w() and display::h() now simply forward to CVideo::getx() and gety() instead of querying
  the underlying window object. This is a slight semantic change, since now these functions return
  screen coordinates instead of pixels, but that's probably what we want in the long term anyway.
* sdl:🪟:get_flags() now returns the proper uint32_t instead of int
* Added a dedicated CVideo::window_has_flags function since testing window flags was the most common
  use of the underlying sdl window outside the class.
* Made CVideo::set_window_mode private. This is an implementation detail and shouldn't be public.
* Removed BPP argument from CVideo::make_test_fake. It's never passed anything other than 32, and
  we're long past the time when we care about window BPP.
* Removed sdl/window.hpp include from video.hpp. This was mostly only there to allow other area of
  the code to call get_window()->get_flags() (and for display.hpp). There's no real reason for it to
  be there anymore and was just making any modification to the sdl window header take ages.
2017-11-21 14:20:14 +11:00
Charles Dang
edb07f0cd4 CVideo: formatting and doc update
Also renamed a few functions to use snake case or be a little more descriptive.
2017-11-21 13:22:37 +11:00
Gregory A Lundberg
05cc5e6b88 Autodoc cleanup for CVideo mess 2017-11-20 11:39:34 -06:00
Gregory A Lundberg
5d7f268b59 Partially revert 321c350
Accidental revert of PR 2212 (whose commit is completely gone).
2017-11-20 10:52:06 -06:00
Gregory A Lundberg
28ccc95d6f Still _more_ CVideo fixes 2017-11-20 10:26:23 -06:00
Charles Dang
4232788579 Use CVideo::get_singleton() over resources::screen->video()
They point to the same thing, but it's more consistent to use the former.
2017-11-21 03:16:51 +11:00
Charles Dang
935e07af03 Fixup b46a64b8ad (forgot to commit this bit) 2017-11-21 03:09:07 +11:00
Charles Dang
c67f5c352a Cleaned up more unnecessary CVideo function arguments and class members
* Dropped unused CVideo class member references.
* Replaced the lone usecase of the CVideo member in loadgame with the singleton and removed said member.
* Removed CVideo references from a bunch of addon management functions.
* Cleaned up a *lot* of now-unnecessary forward CVideo declarations.
2017-11-21 03:07:23 +11:00
Charles Dang
9dd497db4a Cleaned up the mess of CVideo references passed around the game initialization process
Essentially, we had CVideo arguments being passed down this chain:
- game_launcher
- free-standing MP initialization functions
- campaign_controller
- playsingle_controller/playmp_controller
- play_controller
- game_display
- display

And likewise down through
- game_launcher
- editor_controller
- editor_display
- display

With only a minimal number of actual calls along the way. :| There were maybe... two remaining?

This removes the CVideo arguments and class members from both chains (except of course, game_launcher.
That's where the "real" CVideo object lives).

The display class now initializes its CVideo reference from the singleton, which is also used in the
very few other places it's needed. I also replaced a check for a null video ptr in show_tooltip()
with a faked() check (see src/tooltips.cpp). That seems to make more sense, since CVideo is never
null now.
2017-11-21 02:30:19 +11:00
Charles Dang
b46a64b8ad Dropped CVideo parameter from loading screen and prefs display functions (missed in f2b31ba)
I had left the former alone in the above commit since I thought it might be worth keeping for the
faked() call, but that's not really a great reason.

As for the latter, I didn't realize the CVideo argument wasn't really even needed. I didn't even
need to replace it with a get_singleton() call since the resolution list is updated by set_resolution_list
before it's used.
2017-11-21 01:32:57 +11:00
Charles Dang
464cf07a8b Fix Travis GCC warnings for f2b31ba082
This also removes a bunch of unnecessary CVideo arguments from various savegame functions that
emerged as I cleaned up the unused parameters. savegame::save_game did take a CVideo pointer
that did look like it was intended to be a sort of do-show-dialog flag, but since that parameter
was never passed as null, I removed it.
2017-11-20 22:29:49 +11:00
Charles Dang
7fad7144d7
Merge pull request #2221 from Vultraz/master
Removed CVideo parameters from dialog show() functions, simplified display/execute implementation
2017-11-20 19:25:35 +11:00
Charles Dang
3029107847 Update tests for 335ffa1b81 2017-11-20 19:24:41 +11:00
Charles Dang
f2b31ba082 Massive cleanup of GUI2 display/show and execute functions implementations and related CVideo arguments
This a two part commit. First:
----------------------------------------------------------------------------------------------------
Added and deployed two new helper macros for the standard implementations of the static execute
and display functions. I also made use of a variadic template in order greatly simplify code
maintenance. Now, even if the dialog's ctor parameters change, no one has to worry about updating
the associated execute/display functions (though of course, this only applies if the helper macros
are used). \o/

I did not deploy the macro in cases where there were multiple overloads or the functions did more
than just show their dialogs. I might add an additional __VA_ARGS_ parameter to the macros later.
Do note for the end_credits dialog I moved the default empty-string parameter from the display
function to the ctor.

Second:
----------------------------------------------------------------------------------------------------
Another change is that modal_dialog::show and modeless_dialog::show no longer take CVideo arguments.
Since the video argument couldn't be included in the parameter pack (maintaining the argument would
have meant making it the first one, which would be just as much work), and using CVideo::get_singleton
in the macros would require adding video.hpp includes in a whole bunch of files, I simply removed the
argument. I had been intending to do this for a while anyway.

This therefor also removes the CVideo argument from:
* All dialog display/execute functions.
* modal_dialog::show
* modal_dialog::build_window
* modeless_dialog::show
* modeless_dialog::build_window
* wml_exception::show
* gui2::show_message
* gui2::show_error_message
* gui2::show_transient_message
* gui2::show_transient_error_message
* gui2::show_wml_message
* gui2::build
* gui2:🪟:window
* gui2::dialogs::tip::show
* Various GUI2-related Lua functions. The video_dispatch helper was also removed.
* Any functions that took a CVideo argument for the sole purpose of passing it to one of the above.

Ya know, all these damn CVideo arguments didn't actually do anything, besides an occasional check to
CVideo::faked. At the end of the pipeline, they just got assigned to the video_ member of gui2::window.
Huge code bloat for nothing.
2017-11-20 19:24:41 +11:00
Jyrki Vesterinen
321c350d76 Merge branch 'static-libs'
Manual merge of pull request #2208.
2017-11-20 07:52:54 +02:00