Commit graph

70547 commits

Author SHA1 Message Date
Gregory A Lundberg
07b04775ff Quell divide-by-zero warning
Coverity has been noting that `avg` might be zero when dividing. This is impossible.

Use assert() to quell the Coverity warning.

Closes CID 13801515
2017-10-31 19:52:51 -05:00
Charles Dang
fa14cf65e1 MP Lobby: right-align status text
[ci skip]

This prevents status text from sometimes floating off to the left if the status label shrinks but
a relayout hasn't occurred. In that case, the label widget's area would be larger than needed for
the text, and since left-align is the default setting, the next text gets stuck weirdly aligned.
2017-11-01 11:18:40 +11:00
Charles Dang
ba9274ea7b Lobby Data: use proper names for Missing Content prompt
Turns out the data we need is already in the config to begin with, so we don't need to query the
addon server for anything! I kept the fallback to addon id in the case a name wasn't provided for
some reason, though.
2017-11-01 11:09:19 +11:00
Gregory A Lundberg
d4d4201d75 Remove unused parameter 2017-10-31 16:37:53 -05:00
Jyrki Vesterinen
c6d8692ac6 Stop paranoid redraws of entire GUI2 windows
Partial revert of commit 010edbe1b9.

The commit caused every GUI2 window to be fully invalidated and redrawn 50
times per second, with massive CPU usage cost. No wonder that some players
have been complaining about too high CPU usage while idling in fullscreen
GUI dialogs.

I couldn't find any obvious regressions with this change. It looks like the
underlying issue has disappeared at some point.

In my tests, CPU usage while idling in the addon manager dropped from 17 %
to 2.5 % (across all cores).
2017-10-31 22:48:52 +02:00
Gregory A Lundberg
37ac4414b9 Quell CID 1380157
Coverity is complaining that the index(x,y) function might return a negative value, indicating that x and/or y were not on the map.

This is impossible.

To quell the warning, use an assert().

Closes CID 1380157
2017-10-31 15:05:13 -05:00
Gregory A Lundberg
520e617d8a Clarify by-hand rounded %0.1f formatting
Coverity is rightly pointing out that it is not clear that `double` math is wanted, where the conversion from `long long` to `double` should occur, and where integer remainders are discarded.

Most compilers will get it right, but humans may find it confusing or unexpected.

* Did some algebra to reduce half-bit errors.

* Added a cast to make the conversion explicit.

* Aligned turn expected damage with running expected damage so both are the same representation.

Closes CID 1380164
2017-10-31 14:39:08 -05:00
josteph
28cfa72de0 When movement points > vision points, don't reveal in the minimap hexes that can be moved to but aren't yet visible.
Fixes #1645.
2017-11-01 03:20:09 +11:00
gfgtdf
02ebe5227d
fix map viewport sometimes beeing reset when reloading.
fixes #2149
2017-10-31 15:56:31 +01:00
Charles Dang
203698df5d Lobby Info: cleanup and optimization
* Deployed auto for iterators.
* Reserve container space when appropriate to reduce unnecessary copying. This is especially
  useful since the game_info class has a rather lot of stuff in it.
* Don't recreate sorted users vector every time said vector is sorted. The only time the actual
  contents would change are when the source (users) change, so just populate it at that point.
* Remove the games_filtered vector. This was essentially just used to get the number of visible
  games with a filter active, but boost::dynamic_bitset (games_visibility) already provides
  appropriate functionality, rendering it useless.
* Removed an unnecessary inline overload. Default arguments suffice instead.
2017-10-31 20:49:36 +11:00
Charles Dang
0efd41ade1 Lobby Info: formatting and doc update
Also deployed some std::endl in place of "\n".
2017-10-31 12:24:54 +11:00
gfgtdf
cadbe4a2a3
add debug output
to investigate #2149
2017-10-31 01:20:42 +01:00
Charles Dang
eb3ed6f3f9 Updated changelog
[ci skip]
2017-10-31 10:02:48 +11:00
Charles Dang
37b52b2fea AToTB: tweak positioning of campaign icon
[ci skip]

Centers it more with respect to the others.
2017-10-31 09:56:47 +11:00
Charles Dang
330bbcee78 Merge branch 'master' of github.com:wesnoth/wesnoth 2017-10-31 09:36:25 +11:00
Charles Dang
5f0bdb4c28 Made Hornshark Island Lua file an actual Lua file
[ci skip]

Also simplified the Lua contained within. No need to create a local function just to immediately invoke it.
2017-10-31 09:35:27 +11:00
Alexander van Gessel
cf4788cc3a Fix compatibility with boost 1.50
boost::optional.value was added later, so use the get method instead.
2017-10-30 23:34:10 +01:00
Charles Dang
4ca25f11ca Lobby Info: store game_info objects directly in ID map
I dunno why they were stored using pointers in the first place. Probably to avoid excessive copying
before we had std::move. When I changed the code to use unique_ptrs I didn't consider that the data
could be stored directly.
2017-10-31 09:14:03 +11:00
josteph
bfde6993bf Fix highlighting reachable hexes when deselecting a moved unit.
If reach_map_ had been empty to begin with, reach_map_changed_ would
have been reset to false before display::process_reachmap_changes()
acted on it.

Fixes #2132.
2017-10-31 09:12:33 +11:00
Alexander van Gessel
0ca1ae27c1 Merge branch 'master' of github.com:wesnoth/wesnoth 2017-10-30 21:18:07 +01:00
Alexander van Gessel
749646a75b Make get_current_track_index safer to use
This prevents problems like issue #1861.
2017-10-30 21:17:05 +01:00
Jyrki Vesterinen
8d397aa356 Changelog entry for commit b43194ba2e 2017-10-30 19:51:22 +02:00
josteph
7fbbef791e Restore range check. 2017-10-30 19:47:56 +02:00
josteph
b43194ba2e Fix #2135: Honour the show_all_units_in_help preference during scenarios
Adding this overload removes a silent type conversion from 'enum scope'
to 'hk_scopes' (std::bitset<3>) in the src/help/help_impl.cpp callsite.
2017-10-30 19:47:56 +02:00
jostephd
e0efa082d7 HttT S14: Tweak dialog to be more archaic
Also add myself to contributors at @Vultraz's invitation.
2017-10-30 04:41:36 +11:00
sigurdfdragon
38be1b600d T S02: Add a message about the status table 2017-10-30 04:40:59 +11:00
Gregory A Lundberg
48afb6e822 Remove unused parameter from MP lobby.cpp 2017-10-29 12:19:36 -05:00
Gregory A Lundberg
d67891274e
Merge pull request #2144 from GregoryLundberg/GL_lobby_autodoc
Add missing autodoc comment
2017-10-29 12:02:04 -05:00
Gregory A Lundberg
50a5c9da91 Add missing autodoc comment
[ci skip]
2017-10-29 11:59:54 -05:00
Celtic Minstrel
aa25d750fd
fixup 2c7a64143a 2017-10-29 12:47:29 -04:00
Gregory A Lundberg
3abc0929dc
Merge pull request #2143 from GregoryLundberg/GL_Editor_Help
Fix editor help incomplete sentence.
2017-10-29 11:45:14 -05:00
Gregory A Lundberg
761f323f43 Fix editor help incomplete sentence.
Replace the sentence to make it clear the Starting Tool marks both the team leader, and named special, locations.

Closes #2085.

[ci skip]
2017-10-29 11:43:05 -05:00
Charles Dang
7da37fd84a MP Lobby: refactored game entry code
This fixes #2121.

This code was an absolute mess. It relied entirely on finding games by-index, despite there also
being a simple function in lobby_data to get a game by id. I had even written code to take an id,
find a game_info ptr, then search the games vector for a match, get an index, and then use that
index to access the games vector later :| *facepalm*

Binding indices with callbacks meant  certain callbacks such as the list double click handler needed
to be constantly re-added. We also had no bounds checking in said callback. And for some reason, the
inline join/observe buttons were  handled by the same code as their global counterparts (#2121).

Just... a mess. Now we can directly handle joining by either index or game id directly. The former
is now only used for the global join/observe buttons' callback, but it could potentially be used
with the plugin context code, if applicable. It depends on whether the plugin data has an index key.
2017-10-30 03:28:41 +11:00
Charles Dang
2c7a64143a Lobby Data: minor cleanup, fixup
* Wrap spaced_em_dash in a function since we can't guarantee font::unicode_em_dash will be initialized
  before this is, and Travis is crashing.
* Remove an unnecessary std::string::find_first_of result check. If no character match is found, that
  returns std::string::npos, which substr takes to mean the entire string.
2017-10-30 03:28:37 +11:00
pentarctagon
699407d7f0 Replace base build with use_srcdir option. 2017-10-29 14:50:27 +02:00
gfgtdf
3763f5a759 use unsynced rng for unit traits
this has 2 reasons:
1) In the 'unit::unit(const unit_type& u_type ..' ctor the facting is
usually overwritten after the unit is constructed (at least the normal
unit recruit code does that) so calling the synced rng there has no
other effect than blocking undoing (in case that the unit has no traits,
otherwise undoing would already be imposible because of trait
generation)

2) in the 'unit::unit(const config& cfg ...' ctor it might make sense to
use the synced rng, but since iirc the facing attribute is already
unsynced since it changed by the drawing code (which might be skipped if
animations are disabled) we also use the unsyced rng here to not block
undoing (in that rare case).
2017-10-29 13:13:23 +01:00
gfgtdf
4e79aedb8d use unsyced rng for animation&sound stuff 2017-10-29 13:03:45 +01:00
gfgtdf
07c0af34f6 small slider cleanup 2017-10-29 12:03:44 +01:00
Charles Dang
b1ad293ccd GUI2: removed unused MP Command Wrapper dialog
This was the equivalent of the Player Info dialog for the old GUI1 MP Lobby, and is now unused.
The new GUI2 lobby uses the aforementioned Player Info dialog. The functionality is basically
the same, though, except the send-private-message interface is more streamlined in the new lobby.
2017-10-29 16:56:16 +11:00
Charles Dang
0737736d3c MP Lobby: completely redesigned game entry layout
I did one of these about a year ago, but in the time since I realize it was honestly really crowded
and had some fundamental problems (for example, the listbox would get a horizontal scrollbar if a game
with a lot of mods was started).

This time around, I've focused on simplicity. The main changes:
* The minimap has been made 10 px larger. This was to accommodate the 5 px borders, so now the actual
  map image is 72x72.
* Game name and scenario name have swapped places, and the latter is now larger.
* Game names are no longer colorized based on the number of vacant slots or whether you can observe
  the game or not.
* The Turns/Slots label coloring has been toned down and been made larger. It is now either white
  (game has started), green (vacant slots available), or yellow (vacant slots available for reloaded game).
* The Turns limit  no longer displays "/-" for games with unlimited turns. Now you just get "Turn n".
* Due to 1bfa170856, proper names of all missing content is displayed. I also got rid of those
  "Unknown Scenario"/"Unknown Campaign" labels in favor of a simple red-color game type token (S or C),
  respectively.
* All game setting icons have been moved to a tooltip attached to an info icon, except those for
  Password Required and Observes Allowed.
* The info icon will also change color (and its tooltip display a message) if the player need to download
  additional content to join that game.
2017-10-29 16:55:42 +11:00
Charles Dang
d78ed1c36d Fixup 7ee39bfc1a (include was added to the wrong file) 2017-10-29 13:56:28 +11:00
Charles Dang
3e16df795e GUI2/Slider Base: formatting cleanup 2017-10-29 13:54:48 +11:00
Gregory A Lundberg
5a2162564f Fix syntax and autodoc errors 2017-10-29 13:12:28 +11:00
Charles Dang
e6830faab4 Proper (I think) VC projectfile update for e9c6dff56a
[ci skip]
2017-10-29 11:23:10 +11:00
gfgtdf
7ee39bfc1a
attempt to fix apple clang build
our apple travis build complains about std::div
2017-10-29 02:20:09 +02:00
Charles Dang
8e5e911f67 Revert accidental change from 1bfa170856 causing serious problems
This essentially somehow was making it so game mods couldn't be deselected.
2017-10-29 10:52:30 +11:00
sigurdfdragon
e2b7b77adf AToTB: Add a hint on easy difficulty for each objective in the campaign
Also replaces previous hint for S01 with a more direct hint
2017-10-28 19:50:39 -04:00
sigurdfdragon
45ae47e5ca AToTB: Add hint macro
An expanded version of the one in AOI
2017-10-28 19:50:39 -04:00
gfgtdf
e3e2747009 use step_size for exp modifer slider 2017-10-29 01:35:50 +02:00
gfgtdf
496b234826 fix slider::set_value() 2017-10-29 01:35:38 +02:00