70814 Commits

Author SHA1 Message Date
Severin Glöckner
3777a5b307 add an appdata file for appstream software centers
(closes #1831 & #2160)
2018-02-02 23:46:59 +01:00
Sofartin
4d7df5fffe Update Copyright year 2018-02-02 13:50:48 +02:00
pentarctagon
44f567c6a3 Enable LTO by default.
LTO for Windows is disabled for now, as TDM-GCC does not work well with it.
LTO for Travis is also disabled, due to the extra time linking with LTO takes.
2018-02-02 17:56:07 +11:00
Charles Dang
69f5d9c260 Made more use of std::isalnum and std::isalpha (std::locale versions)
I didn't also deploy std::isdigit since @jyrkive said he feels digit comparison is fast
and simple enough.
2018-02-02 17:42:06 +11:00
ancestral
2598497c74 Changed text in tutorial to make it easier to understand how the tutorial works and better understand game topics
[ci skip]

* Expanded the text to explain how to read '5×4' and what it means
* Changed the wording slightly to emphasize the order of damage times attacks
* Added a message explaining the format of the tutorial
* Separated some long messages into multiple messages instead
* Removed some unnecessary wording to keep things simpler
* Changed some spelled numbers to regular numerals when referring to game currencies (such as gold and income)
* Minor changes to grammar
2018-02-02 16:14:52 +11:00
Charles Dang
c8abb8d5d9 Add formula= option to [set_variable] (change by @celticminstrel)
[ci skip]
2018-02-02 15:40:44 +11:00
Charles Dang
c916a85d1e Game Events: some safeguards
* Don't register an empty event
* Raise a WML error if a event is missing a name= key (the wiki declares it mandatory)
2018-02-02 08:34:15 +11:00
Charles Dang
b888713918 Create Engine: added is_campaign helper to simplify logic 2018-02-02 07:58:50 +11:00
Charles Dang
30172c8ebe Fixed SP option selections not being saved
Had forgotten to call prefrences::set_options. Instead of adding an extra call in the
SP Options Manager, I just moved the call to configure_engine::set_options, which is
called by both SP and MP codepaths.
2018-02-02 07:14:34 +11:00
Charles Dang
9de2783200 Fixed SP option variables never being set (fixes #2401)
Was just missing a check for the SP_CAMPAIGN type.
2018-02-02 07:09:58 +11:00
Charles Dang
eee4b4e147 NR S2: change victory condition to prevent unwinnable scenario (fixes #2352)
[ci skip]

Previously, the scenario only ended if you triggered the sighted Hamel event with Tallin.
If you triggered it with any other unit, you wouldn't progress since you can't fire a
sighted event on a unit already visible.

I've changed the condition to move within five hexes of Hamel with Tallin. Still possible
this might result in an unwinnable scenario, but that's much less likely than with what
was there before.
2018-02-02 06:49:31 +11:00
sigurdfdragon
5bc09da48d Units: A more positive description for the Naffat 2018-01-31 14:05:10 -05:00
sigurdfdragon
57f06ab443 Units: Remove unnecessary religious references from Dunefolk units 2018-01-31 14:03:55 -05:00
sigurdfdragon
b0e0a75138 Units: Generalize Falcon description by removing faction reference 2018-01-31 14:01:21 -05:00
Jyrki Vesterinen
4685aed6a5 Fix #2339: iterating wesnoth.unit_types is extremely slow
The problem was that the code copied the entire list of unit types every
time Lua moved to the next unit type. Fixed by taking a reference to it
instead.

Thanks to @ilyapopov for identifying the problem.
2018-01-31 19:50:10 +02:00
sigurdfdragon
7a6c39380e SotA S04: Update files to match faction renaming 2018-01-29 19:33:07 -05:00
sigurdfdragon
e288be9302 MP: Simplify Dunefolk faction and era description
Other factions lack magic users, so mentioning here it is superfluous
information. Also associated with the previous identity of the faction.
2018-01-30 10:16:27 +11:00
newfrenchy83
e20c55f57d Update Code::Blocks project files to C++14 (#2416) 2018-01-29 12:13:24 +02:00
Charles Dang
d6bbdc3134 Game Display: added another missing override specifier 2018-01-29 17:36:22 +11:00
Charles Dang
654a688616 Game Display: added more virtual/override specifiers and removed duplicate function
set_playing_team was implemented the same as in the base class.
2018-01-29 15:54:02 +11:00
Charles Dang
16ce2af32e Made display class no longer inherit from filter_context
The only function that display meaningfully implemented was get_disp_context. It did implement
get_tod_man, but only meaningfully in its two derived classes (it returned the result of
resources::tod_manager in display). Additionally, the long-ass comment in the header stated the
display class should *not* inherit from filter_context. Do note that get_disp_context was retained
as a display member function.

Upon further investigation, I found that there were only two places where the display class was
passed to unit_filter. All others passed resources::filter_con. The editor_display class was also
assigned to resources::filter_con in editor::context_manager. So, I removed the second filter_context
argument from unit_filter and initialized it from resources::filter_con in all cases.

unit_filter only used the filter_context to get its display_context and the unit_map within anyway.
When using display::get_disp_context in-game, that would return a game_board object. Using
resources::filter_con in the same context would return the game_state object that owned the
aforementioned game_board, and calling get_disp_context on that game_state would return the board
as well. So we end up in the same place.

To be complete, I also made editor::context_manager inherit from filter_context. It makes much more
sense, since it can nicely implement 2/4 of the fc functions. It also ensures resources::filter_con
is valid in the editor, in case it's needed. I'm not 100% sure it is, but since it was assigned
before (to editor_display), it's very likely.

Another side effect of the above is that get_tod_man is now implemented in a more apropos class
in the editor. Essentially, editor_display (where it was implemented before by reaching into the
context_manager) holds an editor_controller which holds a context_manager (where it's now implemented).
It wasn't even really needed in editor_display and was only called once.

Similarly, get_tod_man has been removed from game_display. Again, it was only present to "properly"
implement the function in display, which only existed because display inherited from filter_context.
And get_tod_man wasn't even needed in display, game_display, or editor_display (save for the one
aforementioned call)!!! AND in game_display, it simply dereferenced a pointer to the *actual* ToD
manager in the game_state class, WHICH IN AND OF ITSELF INHERITS FROM FILTER_CONTEXT!!!

I have removed the tod_manager pointer in game_display and replaced its use with resources::tod_manager,
which in the context of the game (where game_display) would be use, point to the same thing the class
pointer did. I suppose I could have left it, since I'm trying to remove/improve the use of the
resources pointers, but I felt it better to decouple the two classes (game_display and game_state)
slightly, especially since its main purpose for existing (overriding display::get_tod_man) no longer
exists.

Finally, some of the instances where a unit_filter object is created had to be changed to use brace
initialization or else the build failed. @celticminstrel tells me this might be because of some "most
vexing parse" issue.

Some formatting and virtual/override specifiers were also applied/added.

*huffs*
2018-01-29 15:54:01 +11:00
Galen Brooks
16c3fdae75 Fix bug introduced in code cleanup commit 5e0c3056d
The previous cleanup didn't handle the case when w or h is zero,
but resize_mode is not stretch.
2018-01-28 22:45:52 -06:00
Alexander van Gessel
d82fc9c4ad Remove unused structs 2018-01-28 21:33:59 +01:00
pentarctagon
ce628e028b Remove checking for a different SDL2 minimum version.
I removed this from scons a while ago, though it looks like I forgot or didn't notice that cmake does the same.
2018-01-28 12:53:26 -06:00
Gregory A Lundberg
73be496708
Revert "cppcheck is confused by an initializer list"
This reverts commit 2e1dbfc235334117c61c7a4bbb4ff1d1f76e2a2d.
2018-01-28 09:27:03 -06:00
Charles Dang
1d93797d34 Added override specifiers for display_context overrides
Also did some formatting cleanup in game_board. Didn't really care to touch the others.

Removed virtual specifier from non-const game_board::teams. It didn't override anything
in the base class (display_context, which has the const version) and nothing inherits
from game_board to override it (the non-const version) later.
2018-01-29 02:10:59 +11:00
Gregory A Lundberg
c0689b7924
prefer prefix ++
cppcheck (via Codacy) points out it's better to use prefix ++ on iterators in a for statement.
2018-01-28 09:07:28 -06:00
Gregory A Lundberg
8f22144e8e
clarify ^ vs ?:
cppcheck (via Codacy) points out the operator precidence is unclearn. Added parentheses to fix that.
2018-01-28 09:07:27 -06:00
Gregory A Lundberg
45eae14999
fix poor rethrows
cppcheck (via Codacy) points out that it is better to rethrow the current event than to throw a new copy of it.
2018-01-28 09:07:27 -06:00
Gregory A Lundberg
b74df558e0
clearly check itor at end
cppcheck (via Codacy) notes that it's not clear that the iterator (j) cannot exceed end() because most don't expect pointer math.

Rewrote to make it more clear what is going on.
2018-01-28 09:07:27 -06:00
Gregory A Lundberg
59554ca0cd
cppcheck has a problem
cppcheck (via Codacy) had a problem with the form `T & T` so used `auto & T`

This is probably a bug in cppcheck but reported to Codacy in case it's their fault since the message form was for && and this was just &.
2018-01-28 09:07:27 -06:00
Gregory A Lundberg
45d101e8ca
variable not assigned in operator=
cppcheck (via Codacy) points out that one member vairable was not assigned.
2018-01-28 09:07:26 -06:00
Gregory A Lundberg
84194f76ef
perform initialization in the initializer
cppcheck (via Codacy) pointed out it's sorta silly to default initialize then immediately assign a non-default value.
2018-01-28 09:07:26 -06:00
Gregory A Lundberg
2e1dbfc235
cppcheck is confused by an initializer list 2018-01-28 09:07:26 -06:00
Gregory A Lundberg
e12a2a19ca
fix reassign before first use
cppcheck (via Codacy) pointed out that a variable was initialized, then reassigned, before the initialed value was used.

Moved the variable declaration to the point the actually-used value was assigned.
2018-01-28 09:07:26 -06:00
Gregory A Lundberg
5e0c3056dc
clarify resize and stretch logic
cppcheck (via Codacy) rightly noted that the construct ((!!w ^ !!h)) was confusing.

Rearrange the code a bit, note some things must be true without testing them, and we can eliminate two variables, make the code faster than the "cute optimization" and make it FAR easier to read.
2018-01-28 09:07:25 -06:00
Gregory A Lundberg
36e92900c3
pass const struct by ref instead of by value
cppcheck (via Codacy) reports the lowest-quality C++ is src/sever/game.hpp with 41 warnings.

There is no need to copy the const socket_ptr struct all over place to pass-by-value. It's const, so we can pass-by-reference and save time and memory.
2018-01-28 09:06:26 -06:00
Charles Dang
99051100a4 Revert 229b9be7eb59 and re-add with comment 2018-01-29 01:43:50 +11:00
Charles Dang
69cd6640d0 Editor: cleaned up a bunch of accessors
Map Context:
* Removed get_team() in favor of non-const local team() overload.
* Removeded get_map() (both overloads) in favor of map() and a local non-const overload of the same.
* Made both overloads of map() return editor_map instead of gamemap (former inherits from the latter).

Context Manager:
* Removed team, unit, and label accessors that only fetched the same info from the current map_context.
  Having more functions of this name only made things a lot more confusing.

Editor Controller:
* Change all instances of the three intermediate accessors mentioned above to data queries directly
  from the current map context via editor_controller::get_current_map_context. The result is the same,
  we just no longer have three levels of indirection.
2018-01-29 01:41:43 +11:00
Charles Dang
b0bb9d94f0 MP Join Game: proceed to game anyway if faction select dialog was dismissed
This makes more sense. The previous behavior seemed unintuitive. If a player then wants
to leave, they can subsequently.
2018-01-28 22:19:34 +11:00
Charles Dang
e52bd6eba7 Faction Select: allow dialog to be closed with ESC (fixes #2404)
I had probably added this before since I wanted a player joining a game to always choose
a leader, but that's rather mitigated by the fact that there's a cancel button.
2018-01-28 22:15:09 +11:00
Charles Dang
626d413798 Editor/Context Manager: cleaned up context refresh code
This used to need to be a class of its own in order to store some info prior to switching
the context, but that's not the case anymore. Moved map_context_refresher::refresh into
context_manager. Also moved the set_window_title call into the function as well, since it
was called in all three places the context refresher was used.
2018-01-28 22:07:51 +11:00
Charles Dang
e19b19bf42 Made more use of get_team() and its bounds checking 2018-01-28 16:48:38 +11:00
Charles Dang
229b9be7eb Play Controller: removed useless optimization 2018-01-28 16:34:29 +11:00
Charles Dang
b779c91df7 Display Context: enable bounds checking for get_team()
Also enabled it for the non-const version in game_board.
2018-01-28 00:20:31 +11:00
Charles Dang
24e40cc0b1 Editor/Map Context: made non-const units accessor local to this class
Since having a non-const pure virtual member of display_context was causing crashes, and
it was only needed here, I've made it a local class member.
2018-01-27 02:27:21 +11:00
Charles Dang
ab4580c6ea Revert "Display Context: added write-access units() overload (pure virtual)"
This reverts commit 0f8e25f970ee9b8fba010c5ffa528aa6238d8900. For some damn reason
this was causing invalid access crashes for me on VS 2017 release builds, but no one
else could repro. Since I can implement a non-const accessor in the map_context class
anyway, I'm reverting.
2018-01-27 00:43:34 +11:00
Charles Dang
88b31f2609 Attempt to fix tests (fixup b98cbe31cc86)
Includes sorting of include list.
2018-01-26 16:27:39 +11:00
Wedge009
0925aa7e0c Align default quit hot-key with conventions (fixes #2397)
Switch quit to title-screen from Ctrl+Q to Ctrl+W (OSX already uses Cmd+W) and quit-to-desktop from Ctrl+Shift+Q to Ctrl+Q.
2018-01-26 14:12:03 +11:00
Charles Dang
b98cbe31cc Moved dummy display context class to tests, since it's only used there now. 2018-01-26 14:11:42 +11:00