[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.
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.
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).
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
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
* 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.
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.
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.
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.
* 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.
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).
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.
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.