Prior to this, if you saved a game with a campaign-specific leader sprite and exited the game
or reloaded the cache *without* opening the Load Game dialog, the leader image would appear as
Unknown. This is because the save_index entry (and the accompanying path expansion) only occurred
when the save was selected in the dialog.
This change ensures all saves' leaders' images from here on out will always appear in the Load Game
dialog (unless, of course, the save_index file is deleted).
I kinda assumed this should never happen due to the cleanup stage, but it seems there are
still cases where it does. Since the code already checks that the lock is valid before
returning, this isn't apparently needed and just breaks things.
This ensures all names are always valid to use in by-name lookup and are stored consistently.
Also fixes a potential issue in 2c12d1328ba6. I should have called standardize_name on each
name entry in the cleanup phase like when done in the registration phase, but this commit
ensures that's not needed anymore.
* Fixed assertion failure when removing single-use custom events. Not actually something
broken, I just forgot to add a "not already disabled" check when doing so since I added
that assertion in event_handler::disable.
* Added a message to the aforementioned assertion.
* Ensure handler cleanup actually happens when removing custom events.
* Account for events with multiple names in cleanup.
1. Undo now works again in the scenario.
2. Lava now works again.
3. Triggering on a moveto event was not good, as several shorter moves
would make rate of lava grow much faster than fewer longer moves.
This code ended up ignoring *all* MP test failures, in particular the one
fixed in commit 11d7b9f0cfe29ab6d6b5829c8e337b7cb67eeb18.
I'd test the code and fix it if I could, but unfortunately I can no longer
develop on GNU/Linux because of PC issues (which I mentioned in Discord).
Therefore I'm just reverting the entire change.
We only use it in once place. At that point we can guarantee we stay in-bounds. So there is no need to use at() to check we remain in-bounds.
This eliminates a warning when building Debug for Windows (quieting Appveyor).
AI0886 had a similar issue building using GCC 6.3 on Boost 1.62
Reverting ca03818fa897a558d9ad5d9c3729404f5959029f and 0cbab6eeedff676a57191440c0b2b89b923bfaad since this changeset should correct both issues.
This throws out the custom smart_list class in favor of a plain std::list. It also greatly simplifies
a few things. First, event handlers no longer remove themselves from the main list in event_handlers.
Now they just flag themselves as disabled (which means they will never execute once marked) and cleaned
up later in a newly added cleanup stage. This means a handler no longer needs to keep its index in the
active handler vector.
This removal of reliance on indices also means I could add the aforementioned cleanup stage. With the
smart_list code, event handlers were never actually removed from the active vector, nor any weak_ptrs
pointing to them removed either. This wasn't exactly a problem, since the handlers were stored via
shared_ptrs which would then simply be null after one deleted itself. Still, it's cleaner to drop any
invalid ones (and unlockable weak_ptrs) from any relevant containers. I've opted to do this in
manager::execute_on_events. Seems a good enough place as any.
The net result of this is the code is much cleaner. We're able to get rid of a bunch of unnecessary
feelers into various classes. This also makes the manager::iteration dereference code a lot easier
to understand. There certainly could be further refactoring, but I think this is a good start.
This is a small subset of a change made on accelerated_rendering. Essentially, since drawing
doesn't happen until events::pump is called, and that function also drops all but one DRAW
event from the queue, sending a DRAW event every 20 ms is just useless noise and excessive
CPU use.
There should be no change in the actual rate GUI2 dialogs are redrawn with this change.
After testing, it seems these calls to raise_draw_event and display/game_display::draw()
were unnecessary - or at least, became unnecessary at some point. One or two are definitely
still needed, but removing these doesn't seem to cause anything to to glitch out. Likely
explanation is anything that needs updating just gets updated either immediately or on the
next play_slice loop.
Sceptre (15x4) is now stronger than the uncut ruby of fire (14x4) for
regular mainline users Thursagan and Konard II. Level 3 Konrad & Li'sar
in HttT are still exceptional users of the sceptre (18x4 & 16x4).
From discussions with zookeeper in irc.
Copying the blit_helper objects when adding them to the drawing buffer was expensive since
blit_helper contains a vector of surfaces. We definitely want to copy that as little as
possible.
Also used std::move when fetching fog/shroud images. This function apparently has little
overhead, but still nice to not make copies here.
Also made get_terrain_images return void (this is just minor cleanup, not an optimization).
No need for it to return a reference to a class member.
Also removed CVideo reference passed to make_screenshot() and its argument function, since the
reference is only used in the one specific screenshot() function anyway.
These were emptied out when SDL 1.2 was removed (358bd1235f07d8d577). I seem to recall
someone saying it might be worth keeping them around in case something needed to be put
back, but it's been a year and a half. Not much worth in keeping empty files.