Commit graph

70547 commits

Author SHA1 Message Date
gfgtdf
b49c843ff5 remove unneeded special case handling. 2017-10-29 01:13:48 +02:00
gfgtdf
e9c6dff56a Slider refactor
1) We now use a single function to set slider min/max value, this fixes #1641
   (sliders having a temporary invalid (min > max) state between set_min() and
   set_max() calls)
2) I split the sliders_base class from the scrollbar_base class to not
   accidently break the rather complicated scrollbar_base class while
   refactoring sliders.
3) We don't use floats in the slider code to make sure no rounding errors happen.
4) This fixes #1539 by removing slider::in_orthoginal (which made it impossible
   to pull a slider to its maximum/minimum) and intead clamping the mouse
   position in range.
5) This fixes #1656 and #1767 by refactoriung code (that bug happend mainly
   because the old code used variables that contained the position in 'steps'
   as pixel position and vice versa)
6) Sliders now 'snap' to the correct values just like the gui1 sliders did.
7) Slider positions are now poperly rounded to its neariest values
   instead of just beeing 'floored'
2017-10-29 01:13:48 +02:00
sigurdfdragon
7474c7f599 AToTB: Facing improvements 2017-10-28 15:12:59 -04:00
jostephd
0f5f8dccaf HttT S22: Grammar fix in Li'sar's dialog 2017-10-29 05:19:32 +11:00
Jyrki Vesterinen
32621bddf6 Fix up leader image paths for existing saves
As a bonus, this also makes the images show up when a save from Windows
is loaded on GNU/Linux or macOS.
It would be particularly useful if Steam Cloud was supported.
2017-10-28 20:05:29 +03:00
Jyrki Vesterinen
a6df1750d1 Save leader image paths with forward slashes
Backslashes in file paths aren't supported after commit 1b9c07e, and
saving them with backslashes prevents leader images from showing.
2017-10-28 20:02:04 +03:00
Jyrki Vesterinen
c57b9a8f90 Revert "Revert "Disallow specifying file paths with backslashes""
This reverts commit 02de08338c.

Mainline does *not* contain paths with backslashes. If it did, the game
would be broken on GNU/Linux and macOS (and we'd need to fix it anyway).
Instead, it's more likely that we have code somewhere that generates
paths dynamically using backslashes on Windows, and the correct fix is
to change that code to use forward slashes instead.
2017-10-28 19:25:30 +03:00
jostephd
e4412d2646 HttT: fix grammar in Moremirmu's farewell 2017-10-28 11:24:34 +11:00
sigurdfdragon
ca853a0607 Campaigns: Deploy Cutscene_Minimal theme for dialog only scenarios
Used for scenarios that are dialog only and use [endlevel] linger=no.
Two scenarios in NR had linger=no added for Cutscene_Minimal use.
2017-10-28 08:52:15 +11:00
Jyrki Vesterinen
2452007c15 Use unsynced RNG for Monte Carlo combat simulation
We don't exactly want combat simulation to cause OOS.
2017-10-27 21:40:19 +03:00
Jyrki Vesterinen
0c137c79cf Globally suppress -Wmaybe-uninitialized
We have needed to suppress it in a bunch of places because GCC has kept
giving false positives depending on optimization settings. When I noticed
yet another false positive when I attempted to build the game with PGO
profiling data using CMake, it was the last straw.

Let's just suppress the warning globally and move on with our lives.
2017-10-27 21:28:06 +03:00
pentarctagon
e594815cfb Add pgo_data to .gitignore. 2017-10-27 20:43:36 +03:00
pentarctagon
757762b1e6 Add support for PGO builds. 2017-10-27 20:43:36 +03:00
galegosimpatico
d98d7aa80c Fix visual bug in the announces system.
Follow up 'ceba081542a4'. It is nice to remove the previously
announced message when announces are being delivered very quickly, but
maybe movement feedback announces should be exempt of that. Before
this rev, Whenever an 'Enemy unit sighted' message was being ordered
coupled with a subsequent 'press $HOTKEY to keep moving', the 'Enemy
unit sighted' message was getting discarded.

src/actions/move.cpp: Movement feedback is important, do not remove
previous messaging when announcing.

src/display.cpp: Do not remove previously announced label when so
requested.

src/display.hpp: Add a `struct` device meant to pass optional
arguments to `void announce(const std::string&, const color_t&, ...)`
instead of primitive typed optional arguments (one, `int`, was being
in use, I would have needed to add a second one, `bool`, but when
trying to do that, the `bool` value would be received by the function
as the `int` argument when not providing an explicit value for the
`int` argument (see `src/actions/move.cpp`). Given C++11, for optional
arguments, does not (to the extent of my understanding) allow
specifying the argument name on the calling place, I was forced into
adding this struct in order to jail all primitive typed optional
arguments.

src/synced_commands.cpp: Adapt to new public API in `class display`.
2017-10-27 19:39:26 +11:00
Charles Dang
78ffabd254 Addon List: some minor code cleanup and formatting 2017-10-27 15:26:18 +11:00
Charles Dang
5ac959e783 Addon Manager: don't reload addon list after Update All if nothing changed
Can happen, for example, if the op was canceled. This also properly flags need_wml_cache_refresh_
on a per-addon basis when updating.
2017-10-27 15:26:17 +11:00
Charles Dang
ea0f4ab6dd Addon List: catch user_exit exceptions when performing addon ops
This fixes an issue where the manager would close if canceling operations invoked by the
inline addon list buttons.
2017-10-27 15:26:16 +11:00
galegosimpatico
48ec4cd6f7 Reconfigure 'select all' for texts in macOS.
Use the idiomatic combination.

Update reference to particular comment line of
'src/widgets/textbox.cpp' in comment with the current line where the
comment is now.

Remove `unsigned` as the type for `copypaste_modifier`, because it was
a little bit less future proof that way, it is better as an
`SDL_Keycode`, which at the moment is `Sint32`, which in turn is
`int32_t` ultimately. Reuse the constant for 'select all' so renaming
it to `modifier_key`.
2017-10-27 15:15:04 +11:00
Gregory A Lundberg
0cb203e9c0 Suppress unchecked return warning
Coverity has been complaining that a few uses of show_message do not have their return value checked.

Casting to void supresses these warning be documenting the value is intentionally not  checked.

This closes

CID 1380185
CID 1380186
CID 1380258
2017-10-27 12:50:43 +11:00
Gregory A Lundberg
2d0b2464d8 Suppress warning about const variable
Supress CID 1134314 about 'code' being constant. Removed the TODO and dead code.
2017-10-27 11:58:20 +11:00
Sofartin
9ea059529c ignore Xcode 9 Index storage
New Xcode 9 creates Index storage inside project dir. This commit makes this index ignored by GIT
2017-10-27 09:43:05 +11:00
Charles Dang
f6ec9658dd Fix command line arguments with spaces being broken on Windows
This was a regression from 8d2ae80b32. Since quotes got stripped from cl arguments when they were parsed,
and since the utils::join call expected a space as a delimiter, the arguments would get put together incorrectly.

One possible fix would have been to wrap every argument in quotes, but that could potentially some issues for
certain non-quoted arguments. Instead, we just take the original command line output from the console.
2017-10-27 08:51:03 +11:00
Rikard Falkeborn
a8f6df50e8 Add const to member functions 2017-10-26 21:09:47 +03:00
Charles Dang
1bfa170856 Backend changes to allow uses of proper display names for missing content in MP Lobby
For Campaigns, I needed to store the campaign name in the classification info.

For Eras, I repurposed the mp_era_addon_id key I added a year ago in d88f591eb5. It wasn't used anywhere
else, and having a better name for missing eras was the original reason to add it. I'm not sure why I
didn't think to use the name directly at the time; I do seem to have used addon_id for mod names too, but
that was changed in 5a55899b83 and again now (see below).

For Modifications, I added the relevant mod name to the server data. Why only this type of content
required a server change I'm not entirely sure. :/ This also finally properly fixes #1794.
2017-10-27 02:00:15 +11:00
Charles Dang
e2a6979f60 Game Classification: formatting cleanup 2017-10-27 01:49:51 +11:00
Charles Dang
dbf2847a44 Fixup ff5d68f (fixes #2125)
Also contains a minor fixup of db8891fa3c (sign type mismatch warning fix).

For some reason, the use of the side-1 fallback in the to_unsigned() calls was making every
side get assigned the color red... Sadly, this means an saved games created in the past 12
hours or so have broken color data. Oh well.
2017-10-26 21:30:12 +11:00
Charles Dang
db8891fa3c Fixup f878433
Issue pointed out by @jyrkive. The new loop would skip any character identical to the first
one instead of only skipping the first one.
2017-10-26 20:35:47 +11:00
Charles Dang
c49c7263ba DiD: fixed door event SLFs
[ci skip]

The door terrain codes changed when the original terrain was split into directional variants
and it seems we forgot to update this.
2017-10-26 12:40:45 +11:00
Charles Dang
b0f9086524 Removed a debugging aid accidentally committed in ff5d68f
[ci skip]
2017-10-26 10:14:33 +11:00
Gregory A Lundberg
f7bea59fe9 Finish switch to MT19937 for randomness
Coverity has been complaining about using rand() as an insecure function. As we're using it, this function is not insecure; but is also not a very good RNG. We're using MT19937 in a system-independant manner. But some uses of rand() were never converted. This converts them.

This closes the following Coverity issues:

CID 1356297
CID 1356299
CID 1356303
CID 1356304
CID 1356306
CID 1356312
CID 1356314
CID 1380163
CID 1380173
CID 1380179
CID 1380191
CID 1380198
CID 1380201
CID 1380210
CID 1380214
CID 1380215
CID 1380219
CID 1380230
CID 1380241
2017-10-26 09:28:24 +11:00
Charles Dang
ff5d68f9f5 Some refactoring of team color data handling
These changes cover areas from PR #2101, excluding the removal of the numeric ID color ranges.
That can't be done yet (it breaks things).

This also excludes any changes to the connect_engine color handling. That needs to be refactored
separately. Despite the fact that it's done very similar to the new get_side_color_id function,
I need to deal with the fact that every side_engine member in the connect engine keeps a copy of
the default color options.

* Added a general-purpose function to extract color data from a config.
* Refactored the team class's general get-side's-color-data function so it always returns a color
  ID instead of falling back on a number.
* Deployed this change for the leader image coloring in the save_index; said coloring is now always
  done by ID.
* Save color data by ID in team_info instead of using the side number if no color was provided.
* Renamed get_side_color_index to get_side_color_id to better reflect its purpose.
2017-10-26 09:27:50 +11:00
Charles Dang
02de08338c Revert "Disallow specifying file paths with backslashes"
This reverts commit 1b9c07eb40.

I'm reverting this (at least temporarily) since it seems mainline contains *numerous* paths with
backslashes. This change basically spams console with warnings just from mainline/core content,
in addition to having other negative side effects such as leader image generation failing when
populating a save_index file. Plus, if backslashes really broke things on Linux, I think we'd have
had a multitude of people complaining about half their images not showing up on that platform, which
(AFAIK) has not been the case.
2017-10-26 09:15:19 +11:00
Charles Dang
f878433847 Team: range-for 2017-10-26 04:40:04 +11:00
Charles Dang
d587ad36ec Team: formatting cleanup 2017-10-26 04:40:03 +11:00
Jyrki Vesterinen
8bfc5eb1da Fix #2117: crash if either combatant was guaranteed to die
Regression from commit f6c4f3d214.

The code divided by zero and the probability to stay unscathed ended up as
NaN, which triggered an assertion failure if the AI simulated one more
fight for either combatant.
2017-10-25 20:06:12 +03:00
Wedge009
73fa6bc508 Minor VC project updates
* Remove dependencies on SDL2_net.lib (hasn't been required since at least 8b341411)
* Remove unnecessary backslashes introduced in dccd73d1
* Sort associated filter.

[ci skip]
2017-10-25 16:33:32 +11:00
mattsc
5d7f00b3c0 Update Xcode project 2017-10-24 20:25:11 -07:00
Ignacio R. Morelle
c32eded71e campaignd: Blacklist standard reserved DOS Device Names
Windows XP and later define DOS device names for several system devices
that will be handled as if they had directory entries everywhere. Their
names may not be used on the left side of a file name if a dot is
present, otherwise the read or write operation in progress (if
applicable) is redirected to the device in question, with unexpected
results (e.g. writing to CON writes to a console that may or may not be
attached, writing to COM1 will send data through the first enumerated
serial port, and so on).

Thus, we really don't want add-on authors to either intentionally or
accidentally use them on non-Windows platforms and cause Windows-based
clients to do unexpected things.

Emitting special messages for the UI in this case seems unnecessary and
it'll be a waste of space most of the time since these names should crop
up extremely rarely. Better just tell people what's up on a case-by-case
basis if they decide to post in the forums about it.
2017-10-24 18:39:55 -03:00
sigurdfdragon
bc8eb4900a SotA S04: Set facings for sailors 2017-10-24 17:35:59 -04:00
Jyrki Vesterinen
b34fac184e filesystem::base_name(): use boost::filesystem::path::stem()
No need to reinvent the wheel.
2017-10-24 19:22:39 +03:00
Ignacio R. Morelle
4f225f56e0 campaignd: Allow exempting hostmasks from download count bumps 2017-10-24 02:53:35 -03:00
Charles Dang
ae6ed8e713 MP Create Game: tweak game type labels 2017-10-24 10:45:51 +11:00
Charles Dang
aeb33fb762 MP Create Game: remove debug mode requirement to access SP campaigns
The option to play SP campaigns in MP had been locked since support was shaky. I'm not entirely sure
how good it is currently, but games at least seem startable. This will also allow us to get more bug
reports if issues do arise, too.
2017-10-24 10:44:16 +11:00
Charles Dang
3f7951fe00 Connect Engine: removed "--give--" entry from controller options
This was basically used to separate players from the general controller options. In the GUI1 dialog it
was unselectable. I never got around to implementing that in the GUI2 dialog, but regardless, it doesn't
look great in the menu so I'm removing it. Plus, since the dropdowns are GUI2, we could apply different
text formatting to denote players if we wanted.
2017-10-24 10:27:13 +11:00
Charles Dang
63cbb8db73 Connect Engine: cleaned up color handling a bit
* Got rid of custom color class member variable. It was no longer used except in the ctor, so it could
  be demoted to a local value.
* Use color id instead of color index for coloring unknown unit image in MP Staging.
2017-10-24 10:15:19 +11:00
Jyrki Vesterinen
939ec05ab1 Travis CI: globally disable C++ unit tests
The tests haven't been run for a couple of months.
The test executable crashes on startup with the error message

Xlib: extension "RANDR" missing on display ":99.0".

After ten attempts, the test wrapper just gives up and returns success.

So, let's not even pretend that we have C++ unit tests running in Travis.
We just don't. Explicitly disabling the tests makes it more clear.
2017-10-23 21:03:57 +03:00
Jyrki Vesterinen
bd705671df FLG manager: initially select the default faction
Turns out that this is enforced by C++ unit tests (which haven't run
successfully in Travis for a couple of months).

The tests started to fail in commit d864a89a15 when random factions
were set to always be the first in the list
(and therefore always initially selected).
2017-10-23 21:00:33 +03:00
Jyrki Vesterinen
de5a622626 Revert config unit tests to compare attributes to empty strings again
Reverts a change in commit 2eacb4e1c3.

The comparison in this unit test compared an *attribute* to an empty
string, not a *string*. Furthermore, the entire point of the test was
to verify that an empty attribute doesn't compare equal to the empty
string. In its old form, the test was just wrong (and failing).
2017-10-23 20:04:21 +03:00
Charles Dang
af9862cb73 DiD S7: used clean walls and new sconce terrains for the mansion
[ci skip]

The S8 map should get this change too, but I'm working on a new map for that scenario.
2017-10-23 17:37:31 +11:00
Charles Dang
c74f1b356f Updated changelog for 5c7f58c
[ci skip]
2017-10-23 17:35:07 +11:00