Commit graph

58 commits

Author SHA1 Message Date
Martin Hrubý (hrubymar10)
bc4d22dc72 Migrate links to https if available - Fwd c18537edc0 2018-07-16 19:07:08 +11:00
Charles Dang
74f86aea1d Mark wml_exception::show const and formula_ai::handle_exception's argument const 2018-05-13 15:46:31 +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
8120843b2e Used constexpr and noexcept keywords directly
We can do this now since were bumping min compiler support.
2018-03-19 00:24:57 +11:00
Celtic Minstrel
5fc9d8d173 Use new deprecated_message() function wherever possible (C++)
This also covers handling of legacy DescriptionWML for [set_menu_item],
and tweaks its handling in the other cases (mainly [multiplayer_side]).

I added the next_dev_version constant intending to use it, but then
decided not to do so; however I left it in in case someone finds it useful.
2018-03-04 21:21:33 -05:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Gregory A Lundberg
05cc5e6b88 Autodoc cleanup for CVideo mess 2017-11-20 11:39:34 -06: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
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
Charles Dang
2101353d36 Convert include guards to the shorter #pragma once
Turns out I mistook @celticminstrel's opinion that we should use include guards over pragma (737916e).
Since all major compilers support `#pragma once`, there's no reason not to use it.

For future mergability reasons, this excludes src/spirit_po and src/xBRZ. It also excludes src/boost-patched.
2017-05-09 19:41:37 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Charles Dang
c5aa4f2086 Replaced cases of throw() with NOEXCEPT 2016-12-17 21:51:16 +11:00
Celtic Minstrel
a1967ec16a Rename twml_exception -> wml_exception 2016-11-09 01:17:14 -05:00
Celtic Minstrel
e0614251c4 Rename exception classes to avoid t- prefix 2016-11-09 01:13:17 -05:00
Celtic Minstrel
1816e1147f Remove asserts.hpp
This file seemed to be some sort of reimplementation of <cassert> except
with some "feature" of trying to force the debugger to hit a breakpoint.
However, any decent debugger already hits a breakpoint with a standard
assert(), and this file really only served to make it harder to see the
actual error when using a Windows console.

Some instances of these macros were replaced with assert(), others with
VALIDATE() which instead throws an exception (and possibly puts up a
dialog, if the exception is caught before main()).

A few other related changes that got mixed in:
- Several error conditions now have a better error message (or indeed
  any error message at all)
- Removed an unnecessary use of std::distance on a Boost iterator range.
- Removed a large chunk of code which did nothing but construct a widget
  builder and then crash; the code was unreachable since an earlier loop
  did the same thing (without crashing), and the comment seems to suggest
  that it was a (seemingly no longer necessary) workaround for some buggy
  compilers / linkers.
- noreturn added to the list of compatibilty C++11 features in global.hpp
  (Of supported compilers, only VC12 lacks the new [[attribute]] syntax.)
- Fix detection of GCC in global.hpp

# Conflicts:
#	src/gui/widgets/settings.cpp
2016-09-18 15:57:47 -04:00
Charles Dang
b5cf79424f Removed compatibility code for pre-VS2013 (MSVC12) compilers 2016-07-27 18:39:41 +11:00
Celtic Minstrel
3ac7f8d970 NULL -> nullptr
A few cases of NULL were missed, since changing them led to errors
(Mainly instances where it was passed to a boost::function)
2016-03-31 00:42:38 -04:00
Ignacio R. Morelle
c04bb94149 Fix cases of people not updating the documentation when refactoring 2016-02-20 20:47:40 -03:00
gfgtdf
8efc1da970 cleanup some includes 2016-01-16 20:50:09 +01: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
gfgtdf
b4a34b282b twml_exception::show only needs CVideo 2015-12-30 21:17:10 +01:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
fendrin
fa86e2e350 Fix some wrong spelling, mostly in comments. 2013-06-23 17:18:49 +02:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
Mark de Wever
cefb8ee330 Add hint for the compiler that FAIL is a failure.
In some contexts the compiler may warn since the wml_exception has no
attribute indicating it will never return. The answer is throwing a
dummy exception.
2012-05-20 09:56:05 +00:00
Mark de Wever
cd5bc7f11a Added FAIL and FAIL_WITH_DEV_MESSAGE macros.
These macros allow to throw an wml_exception without any condition. This
can be used when a code path is reached that should be unreachable with
valid WML.
2012-05-19 19:35:44 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Mark de Wever
34c228a080 Fix the showing of the VALIDATE message.
Fixes bug #17405 again.
2011-02-19 14:20:27 +00:00
Mark de Wever
ec0eb48ead Let twml_exception no longer derive from a base.
This how I originally designed the class and how it should behave. This

reverts 2011-01-26T07:30:35Z!guillaume.melquiond@gmail.com and reintroduces bug #17577. There are two
issues when used in combination with Lua:

 - Our Lua wrapper crashes when catching this exception (to be fixed in my next
   commit.)

 - When our Lua wrapper no longer crashes the error message is lost. (I have an
   idea how to fix it, but it is much easier to test when this change is
   committed.)
2011-02-16 18:59:46 +00:00
Mark de Wever
43ec60a6ac Make brackets to sections preferred.
Also does:
- Add brackets to sections when not send.
- Some code reformatting.
2011-02-13 18:41:50 +00:00
Guillaume Melquiond
f6e5953933 Reverted 2011-01-08T20:40:28Z!koraq@xs4all.nl. (Fix for bug #17577.) 2011-01-26 07:30:35 +00:00
Mark de Wever
b1069876a8 Add some helper functions for deprecated WML.
Added the code here instead of in the config object, to avoid dragging
more stuff in the core libraries. The deprectated warnings are only used
for the game stuff, so no need to put it in the server as well.
2011-01-10 20:38:34 +00:00
Mark de Wever
3ca34572c1 Allow an extra developer message to wml_exception.
Also adds an extra macro VALIDATE_WITH_DEV_MESSAGE to add the message.
This macro can be used instead of the normal VALIDATE macro.
2011-01-08 20:40:31 +00:00
Mark de Wever
acba693447 Fix a bug not showing the twml_exception dialog.
When called from lua the dialog was no longer show, but only the user
part of the message. (Fixes bug #17405.)
2011-01-08 20:40:28 +00:00
Mark de Wever
96d9e2e129 Make use of the VALIDATE macro safe. 2011-01-08 20:40:20 +00:00
Mark de Wever
ecbabea838 New year copyright update. 2011-01-01 15:57:50 +00:00
Ignacio R. Morelle
d6a3de1938 Apply patch #2213 by stikonas, using file #11274 2010-11-21 01:56:29 +00:00
Guillaume Melquiond
eeb047de55 Fixed file headers so that they match the content of the COPYING file. 2010-09-01 21:12:38 +00:00
Guillaume Melquiond
0ee3b0a6db Factored the whole exception handling.
Implemented sticky exceptions that can be rethrown at will.

Used them to ensure that quitting the game, loading a new game, and
leaving to title screen, work correctly when WML is being executed.
2010-07-31 10:52:26 +00:00
Guillaume Melquiond
d628621cfd Removed the heavyweight tstring argument,
...since in most cases, if not all, the string had already been
translated at that point.
2010-07-30 06:41:01 +00:00
Guillaume Melquiond
8dfe3b6d8b Inherited from standard exception. 2010-07-30 06:40:56 +00:00
Mark de Wever
a99c78e0d8 Update doxygen comment.
The filename after the @file comment is optional (spotted by alink).
2010-07-26 21:32:18 +00:00
Mark de Wever
92f5f92ce5 New year copyright update. 2010-01-01 13:16:49 +00:00
Mark de Wever
973a0a7d5c Remove trailing whitespace. 2009-01-01 10:28:26 +00:00
Mark de Wever
a5d1d2e969 New year copyright update. 2009-01-01 10:27:41 +00:00
Tomasz Śniatowski
121606bde9 define __func__ as __FUNCTION__...
...if the former isn't found and the latter is. This also allows
removing the sunos special VALIDATE version
2008-12-22 19:58:50 +01:00
Ignacio R. Morelle
e599d5dc23 Doxygen comment fix 2008-05-29 21:41:39 +00:00
Mark de Wever
f7dce21b55 Update doxygen comment style. 2008-05-18 13:47:04 +00:00