150 Commits

Author SHA1 Message Date
Charles Dang
a21697fef3 Cleaned up various areas of code related to setting window resolution
* Added a point ctor that takes an SDL_Point.
* Added a toggle_fullscreen function to CVideo.
* Change all management of resolution data to use point instead of std::pair<int, int>. This
  shortens the code considerably.
* Cleaned up preferences_dialog::set_resolution_list
* Made CVideo::set_resolution return a bool indicating whether resolution was changed.
* Swapped which of the two set_resolution overloads contains the main implementation.
* Moved the events::raise_resize_event() call when setting resolution to the CVideo function
  where it should have always been (instead of the prefs dialog callback). This is a pretty
  essential component and having it localized in one place meant any other area of the code
  that might have called set_resolution wouldn't have it.
2017-11-27 05:53:23 +11:00
Charles Dang
5481a7985f Cleaned up SP initialization function parameters
As of f4584b6b722a9 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
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 f2b31ba082e1
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
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
a324534a6a Fix Wesnoth prompting for MP server even in local games
Regression from commit 9019074182753475b3b6788a35af0322d67ef08f.
2017-11-07 19:09:03 +02:00
Charles Dang
e07a32e658 Use an enum for loading screen stages instead of string IDs
This allows for compile-time verification of stage ID names, instead of leaving it until runtime.
It also allows the use of std::atomic for the current stage class variable since we're no longer
using a const-qualified type.
2017-11-07 18:11:05 +11:00
Charles Dang
9019074182 MP: prompt for server address before loading game config
This allows players to cancel and return to titlescreen quicker if they so choose.
2017-11-06 18:28:29 +11:00
Charles Dang
2eacb4e1c3 Use !std::string::empty() for string-is-not-empty comparisons 2017-09-05 06:25:25 +11:00
Jyrki Vesterinen
670bcf71a3 Address a bunch of Coverity Scan warnings 2017-09-01 23:24:04 +03:00
Jyrki Vesterinen
dc5e8b36ea Restore --max-fps
@gfgtdf explained in IRC that it's often used to slow Wesnoth down (instead
of speeding it up, as I had assumed).

This should also allow unit tests to compile again.
2017-07-22 23:35:53 +03:00
Jyrki Vesterinen
4e4d7b5277 Rewrite the FPS cap implementation
The FPS cap, originally implemented in 2007, is very poorly done. It
doesn't take frame time variance into account, and is therefore almost
guaranteed to cause missed frames all the time. It doesn't increase timer
granularity on Windows, which causes SDL_Delay() to often take much longer
than intended. And it's hardcoded for 50 FPS, which fits poorly with 60 Hz
displays.

This new implementation fixes all those issues.

My experience is that the game feels much, much smoother with the new
implementation, perfectly competitive with 1.12. In my opinion, performance
is now at an acceptable level for a stable release.
2017-07-22 15:48:46 +03:00
Jyrki Vesterinen
56433d12a3 Merge branch 'login_save_crypt' 2017-05-22 20:10:09 +03:00
Celtic Minstrel
96ca0b026e Replace config_of with new variadic config constructor 2017-05-21 16:27:46 -04:00
Celtic Minstrel
9365538b3b Don't store the user's password in plaintext in the prefs file
The game now supports @ or = in usernames for the purpose of saving them to a file.

Though I don't think these are allowed currently, it's probably better to
support it from the start rather than having things break if they later
become allowed.
2017-05-12 15:56:41 -04:00
Charles Dang
ba99ffded8 Fixup 194b5ef 2017-05-10 14:15:39 +11:00
Celtic Minstrel
b6eedd3df6 Allow launching test scenarios from the titlescreen
Unit test scenarios are excluded. There is no button and no default hotkey.
2017-05-04 19:20:44 -04:00
Charles Dang
e4f03fe459 Moved all preferences source files into a single folder 2017-05-04 11:04:19 +11:00
Charles Dang
dec0fd6dfd Convert outro screen to GUI2
It's the screen that shows 'The End' at the end of an SP campaign.
2017-04-09 21:37:16 +11:00
Charles Dang
d542e39762 Removed as much GUI1 backend as is now possible
We're now maintaining the bare minimum to keep Help running.
2017-03-22 02:52:51 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Charles Dang
7f820c1d58 SP: cleaned up a useless function argument
Seems the only purpose of this argument was to be passed around and never do anything.
2017-03-19 22:15:56 +11:00
Charles Dang
e22c8967ee Cleaned up global.hpp includes 2016-12-17 15:21:04 +11:00
Charles Dang
b97a20b059 Split SDL_Surface wrapper class and related helper struts into their own file
This (should) allow sdl/utils.hpp to be modified without a huge rebuild, since a number
of widely used headers included that file simply for the surface class type.
2016-12-10 22:36:31 +11:00
Charles Dang
4d48ed1319 Cleaned up util.hpp includes 2016-12-08 14:21:18 +11:00
Charles Dang
58fecf8b54 Bunch of include cleanups 2016-12-01 22:11:00 +11:00
Charles Dang
d8d986d734 Cleaned up a bunch of unnecessary Boost includes 2016-11-30 11:25:22 +11:00
Celtic Minstrel
67ea79d86f Rename some GUI2 files to match the contained class 2016-11-19 17:16:10 -05:00
Charles Dang
d5fab53976 Removed GUI1 mp dialog code
The code removed in connect_engine was used by and relied on code in multiplayer_ui.hpp, which is now removed.
2016-11-12 11:53:59 +11:00
Celtic Minstrel
10b6a34615 Rename all GUI2 dialogs to drop t- prefix
This also places them in a new dialogs namespace.
2016-11-09 01:27:30 -05:00
Celtic Minstrel
c09125096b Rename GUI2 widget classes to drop t- prefix 2016-11-09 01:27:30 -05:00
Celtic Minstrel
a1967ec16a Rename twml_exception -> wml_exception 2016-11-09 01:17:14 -05:00
Celtic Minstrel
b8467cc0c2 Improve handling of map generator errors 2016-10-26 18:49:23 -04:00
Chris Beck
5c86a1bd76 Merge branch 'master' of http://github.com/wesnoth/wesnoth 2016-10-16 21:10:23 -04:00
Chris Beck
202408f28e simplify font::manager object a bit, give better error messages for font initialization failure 2016-10-16 21:07:09 -04:00
Gregory A Lundberg
86adfc47f8 GCC complains about float/double and useless cast 2016-10-16 10:55:09 -05:00
Charles Dang
476027f239 Completely refactored internal handling of credits and enabled new dialog
This removes the ugly string markup and makes the dialog parse the config directly.

This also temporarily disables the display of credits in the help browser.
2016-09-15 03:09:14 +11:00
Celtic Minstrel
b44728c77e Fix crash when launching with --editor and no file 2016-09-13 18:39:47 -04:00
gfgtdf
dcd037e530 small load_game_exception refactor
* Moves load_game_exception to savegame.hpp and cleans some #includes
* Removes the load_game_exception statis members and replaces them with
a non-static load_game_metadata member.
* Adds loadgame::DIALOG_TYPE to remove the gui1 dependency.
* Fixes loading of replay saves.
* Adds soem mising override specifers in savegame.hpp
2016-09-10 20:33:18 +02:00
Celtic Minstrel
d0906ceac5 Refactor titlescreen loop so that it redraws properly behind other dialogs 2016-09-08 02:24:16 -04:00
Charles Dang
6aee108298 loadgame: replaced individual flag getters with data struct getter 2016-09-08 12:37:43 +11:00
Charles Dang
09a095b8b1 Preferences: refactored handling of initial page specification 2016-09-03 02:28:44 +11:00
Charles Dang
56e2a733e5 Merge pull request #674 from jyrkive/mute-in-background
Mute the music when the game loses focus
2016-07-30 16:49:21 +11:00
Charles Dang
a1f6884555 Refactor uses of boost::tuple to std::tuple or std::pair as appropriate 2016-07-25 17:26:24 +11:00
Jyrki Vesterinen
bf510e7886 Pause the music when the game loses focus 2016-06-30 12:58:18 +03:00
Charles Dang
fbc5d46b38 Cleaned up some unused thread.hpp stuff in the main binary files 2016-06-12 05:10:15 +11:00
Celtic Minstrel
d3cd314f46 Revert "Cleaned up cstdlib includes"
This reverts commit 7b21849487fb9ff1607a8ab6aca813bf1df05171.

The commit was ill-advised in the first place and appears to cause issues
with the XCode build.
2016-06-06 21:08:44 -04:00