Rationale:
- The at() emulation is only used in one file and will become redundant once we move to C++11 soon
- The map_get_value_default function is also only used in one file, and removing it actually makes the logic clearer
- It was moved to map/utils.hpp despite having nothing to do with game maps; removing it is slightly easier than moving it again
Groups are handled on a per-dialog basis, and are currently specialized for tselectable_
inheritors. They provide a convenient vector-of-pairs interface that ensure only one
widget is selected at one time and allows binding of values to widgets which can be
fetched at a later point.
This makes it so we no longer try to steal the console back to a log
file when using --wconsole with the new redirection code. Now the
--wconsole switch triggers a special mode of the log file manager that
uses a native console instead of log files.
As a necessary bonus to appease compilers, the GUI2 version info dialog
now uses the correct log file path when not started with the --wconsole
switch. Yay!
This replaces SDL 1.2's built-in stdout/stderr redirection, which writes
the log file to the process working directory (usually an
admin-restricted location) instead of a more accessible user-writable
location.
My approach combines stdout and stderr into a single log file which
includes the process id and timestamp in its filename in order to
accomodate multiple instances and (coming later) log rotation. The log
file is created in the user's temporary directory defined by Windows,
and then relocated to the game user data dir as soon as it is set-up the
first time, placed in the Windows-specific logs/ subdir.
The most pressing issues this solves are the lack of built-in
stdout/stderr redirection in SDL 2's SDL2main.lib entry point, and
Unicode path issues with SDL 1.2 (bug #22897). Additionally, it allows
us to not have to rely on UAC virtualization anymore; this is arguably
far more important because it has been known to break on occasion (e.g.
<http://r.wesnoth.org/t42970>), and starting with version 1.13.2 we want
to declare Windows Vista - 10 compatibility in our side-by-side manifest
(see commit e119f4071f047c6d740ebec4636985fdf39349bc).
Currently missing features coming later:
* Log rotation (otherwise the logs/ dir may grow forever)
* wesnothd support (although the code is already required to be linked
into wesnothd due to it being required by the FS API)
* Integration with the version info dialog
Highly unreliable and generally useless, see the Doxygen documentation.
Also missing the actual Windows implementation for the moment. Also,
since uname() is highly useless on most platforms, I'll need to think up
a better OS X implementation later down the road.
Registers library versions in a single structure that can be queried
later as many times as necessary (say, from the game UI) instead of
relying on recording this information in different object files in an
inconsistent fashion. Also, it provides a pretty formatter for console
usage (e.g., in --version).
libpng also gets to join in the fun.
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.