Commit graph

105 commits

Author SHA1 Message Date
Charles Dang
e270a7c665 Formatting cleanup: > > to '>>`
Allowed since C++11. Might as well use it everywhere.
2018-02-21 12:11:21 +11:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Jyrki Vesterinen
2ad0715d7f Update --help text about FPS-related options 2017-11-18 22:09:22 +02: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
Ignacio R. Morelle
98883d0d0c Add new --report/-R switch to generate an info dump for bug reports
This is intended to be used instead of the Game Version dialog's
clipboard text report in the event that Wesnoth cannot reach the
titlescreen or the dialog for some reason.

Unlike the --version info dump, it performs various calls to the
filesystem API which have potential side-effects on the environment
(namely, creating a user data directory structure if none existed before
running the command). It seems highly improper for a program's --version
switch to perform any actions other than printing text to its parent
terminal, hence I thought it would be better to add a new switch with a
more active phrasing, also reflected in its accompanying documentation.

Ultimately, this and its UI counterpart should be used by 1.14 players
as part of the bug reporting process, preferably as a mandatory step
before submitting new reports on GH or the forums.
2017-05-22 00:05:11 -04:00
Charles Dang
57d825d114 Avoid some temporary tuples
[ci skip]
2017-05-22 14:06:05 +11:00
Charles Dang
2a6ca6cd9e Deployed more emplace_back (how do I keep missing these...)
Covers more cases of:

* push_back(std::pair
* push_back(std::make_pair
* push_back(std::make_tuple
* push_back(T) where T is an empty object of type T

Small thing I noticed: this does mean the numbers in font::subset_descriptor are no longer 'cast' to size_t before being
added to the vector, but that shouldn't matter (hopefully).
2017-04-28 17:15:13 +11:00
Charles Dang
323516d3d8 Avoid copy initialization of arrays (use direct instead) 2017-04-21 03:10:07 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Charles Dang
e22c8967ee Cleaned up global.hpp includes 2016-12-17 15:21:04 +11:00
Charles Dang
626d6c63cb Made use of the "new" lexical_cast implementation
Note the "old" implementation of lexical_cast_default is still used since the new code doesn't have
the equivalent functionality yet.
2016-12-07 19:23:39 +11:00
Charles Dang
daeaa47920 Convert cases of lexical_cast<int> to std::stoi
One case was removed in formula/callable_objects.hpp, since start_gold() already returns int
2016-11-06 22:17:24 +11:00
gfgtdf
7434533b46 remove all pre boost 1.48 workarounds
sicne 1.48 is now needed to build wesnoth (accoring to INSTALL) we can
assume BOOST_VERSION >= 104800 in the code.
2016-08-14 23:13:29 +02:00
Chris Beck
33b0ea50b9 give formatter an x-value conversion to std::string, use in some examples 2016-07-31 20:18:52 -04: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
Charles Dang
168313bed9 Cleaned out some SDL_net-related detritus
This allows the main executable to build without SDL_net as a dependency.
2016-06-06 05:56:24 +11:00
Celtic Minstrel
ca382018b7 BOOST_FOREACH -> range for 2016-04-02 09:38:29 -04:00
Celtic Minstrel
f5bfa4dff5 Update manpage
This does several things:
- Make the formatting consistent, using underline instead of <angle brackets> for all arguments
- Add many missing switches; some experimental/dev ones are still not listed though
- Ensure all switches are listed in alphabetical order
- Fix some inaccurate details
- Minor fixes to the output of --help

In addition, the following additional switches now force a console on Windows:
--nogui
--logdomains
--path
--render-image
--screenshot
--data-path
--userdata-path
--userconfig-path
--version
2016-03-26 16:39:43 -04:00
Celtic Minstrel
8e588972f4 Ensure logging objects are constructed on first used
This makes it safe to log messages during static initialization.
2016-03-19 21:12:11 -04:00
Chris Beck
ba51524f6e update copyright to year 2016
using this shell script:

find src -type f -print0 | xargs -0 sed -i "s|Copyright (C) \([[:digit:]]*\)\([ ]*\)-\([ ]*\)2015|Copyright (C) \1\2-\32016|g"
2016-01-02 23:59:31 -05:00
Charles Dang
c15e2403f7 Remove option to manually set bpp from command line
# Conflicts:
#	src/game_launcher.cpp
2015-12-30 19:09:40 +11:00
Ignacio R. Morelle
8d2609ff4c Add --wconsole for allocating a Windows console on startup
This is only recognized by the game client at the moment. The
implementation is a bit hacky but it seems to work. Thanks, SDLmain.

The cwesnoth.cmd Windows batch file passes --wconsole to Wesnoth in the
command line, along with any other arguments passed to it. This is
intended to be *the* use case for --wconsole, since otherwise the fact
that Windows won't allocate a console for us on process initialization
(due to Wesnoth being compiled with the GUI application flag) causes
issues with the Command Prompt shell -- namely, the shell returns
before Wesnoth allocates its console, allowing shell input to happen
concurrently with Wesnoth's output to console.

cwesnoth.cmd should be used in shortcuts and given Wesnoth's install
path as its initial working directory.
2015-04-25 04:49:30 -04:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Chris Beck
489074b0a4 add --mp-tests option and preproc defines, and mp unit tests folder
These tests are meant to be run in a networked context to check for
OOS and similar.
2014-12-19 19:47:27 -05:00
Chris Beck
f8f1979846 add --plugin option at command line (to replace script eventually)
This is still rough and will need to be cleaned up later.
2014-12-19 19:47:18 -05:00
Chris Beck
3193a67ce9 add option to allow "unsafe" lua scripts, with "package" package
This allows lua scripts to access the OS, the network, etc.
2014-11-09 20:47:27 -05:00
Chris Beck
4164a24a59 take cmdline arg for lua scripts to execute at application start
If a lua script is passed as an argument to wesnoth, wesnoth will
actually instantiate the application_lua_kernel defined in the
previous commits, initialize it, and run the script in that
environment.
2014-11-09 20:47:27 -05:00
Chris Beck
cd3e8cf333 add function to generate config from cmd line opts, for lua 2014-11-09 18:45:14 -05:00
Fabian Müller
c6e118f084 Add the "core" command line option.
This option specifies a [core]'s id which is to be loaded.
Not used yet.
2014-11-07 23:17:23 +01:00
Fabian Müller
ca0674d684 Add --noaddons command line option.
This option prevents any add-ons from being loaded.
2014-11-06 02:43:33 +01:00
gfgtdf
8a81fb526d Merge pull request #305 from gfgtdf/istream_fix
we now use boost::istreams instead of boost::filesystem::fstream because the later doesnt work with mingw.
we now use a custom codecvt instead of boost locale because we want to get better error messages for invalid utf8 strings using our _ERR streams
we now use unicode prgamm commandline args on windows..
2014-10-23 23:59:42 +02:00
gfgtdf
fa67d14571 use unicode programm args on windows 2014-10-23 14:49:18 +02:00
Chris Beck
ccc0ec67d9 add "render-image" CL option, to directly save output from IPF's
Example usage:
wesnoth --render-image "units/undead-skeletal/banebow-bow-attack-1.png~SCALE(144,144)" "banebow.bmp"
2014-10-22 18:11:55 -04:00
Ignacio R. Morelle
64af83f4f0 Simplify tuple command line arguments error handling
Reuse the boost::program_options::error class (which we already catch in
main()) instead of throwing a std::string, and simplify the throwing
logic accordingly.

There is no need to provide incredibly verbose error messages since the
user is expected to be able to read --help or the man page to get here
in the first place.
2014-07-07 20:34:31 -04:00
Ignacio R. Morelle
5490a55a3b Simplify --resolution error handling
Reuse the boost::program_options::error class (which we already catch in
main()) instead of throwing a std::string, and simplify the throwing
logic accordingly.

There is no need to provide incredibly verbose error messages since the
user is expected to be able to read --help or the man page to get here
in the first place.
2014-07-07 20:34:24 -04:00
Chris Beck
4230bfb17f give better error messages when we can't parse command line args 2014-07-06 12:50:53 -04:00
Chris Beck
cff404060b give an error message when we crash from bad command line args
This only fixes one case but when you are trying to set up a
headless multiplayer game it is pretty annoying when it crashes
with no explanation because of a bad controller string.
2014-07-06 12:20:54 -04:00
Chris Beck
198b89b61f fixup includes in commandline_options 2014-06-25 02:16:23 -04:00
Chris Beck
c8699e2f05 remove built-in wesnoth timeout
This was buggy and based on deprecated SDL features that will not
continue to be available. aquileia wrote us a very nice windows
port of the run_wml_tests bash script, so for windows mac and
linux we should now be able to run the unit tests as desired.

Maybe someday built-in timeouts can be supported using boost
process library, if that ever materializes.
2014-05-29 14:21:44 -04:00
Chris Beck
f7ce1845f3 add "strict" logging option, to treat e.g. wml warnings as errors
When the game is run using e.g. "--log-strict=warning", then
writing anything to a log channel of severity warning or higher
will result in a game::game_error exception being thrown.

This will only happen the first time that such a write is
attempted, subsequent attempts to get the logging object will
pass without exception and such messages will be reported.
2014-05-14 21:39:20 -04:00
Chris Beck
287f975737 fixup initialization list
(to address reorder warning)
2014-05-08 12:22:24 -04:00
Chris Beck
66c7fe1c0f reorganize command line options 2014-05-08 12:17:24 -04:00
Chris Beck
99c15db910 unit tests show a gui if --showgui option is given 2014-05-08 12:16:09 -04:00
Alexander van Gessel
45a4334a2f Magic number reduction 2014-05-03 02:40:46 +02:00
Alexander van Gessel
2da77a8ad0 Merge pull request #135 from cbeck88/wmltest
WML Unit Tests
2014-05-02 15:48:14 +02:00
gfgtdf
03721d9fe6 commandline option for precise timestamps 2014-04-27 20:01:49 +02:00
Chris Beck
4fb6cf5909 add replay validation to unit tests
after unit tests play, then unless --noreplaycheck flag is used,
they save a replay at the end of the scenario (using autosave
code path), without compression. then they try to load it and
play it to completion.
this is the initial attempt.
2014-04-08 18:11:41 -04:00
Chris Beck
e5b3951054 unit test timeouts: first attempt
use an SDL_Alarm to try to abort the process if it goes over time.
2014-04-08 18:10:46 -04:00
Chris Beck
42d4cbe9c8 add command line option --unit, -u, to run scenario as a unit test
This is the initial commit for --unit, -u, unit test option.
This option is a modified version of --test, -t. Scenarios will
run in the same context essentially, but will terminate on
scenario end.

The exit code of wesnoth is 0 (PASS) if the scenario ended with
LEVEL_RESULT VICTORY, or LEVEL_RESULT NONE.

The exit code of wesnoth is 1 (FAIL) otherwise.

Higher exit codes may reflect a failure for a reason other than
the scenario ending in defate.
2014-04-08 18:08:08 -04:00