Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10224: Don't fast forward after autosave if tab key is no longer pressed #10229

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/saveload/saveload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2920,7 +2920,10 @@ static inline void ClearSaveLoadState()
*/
static void SaveFileStart()
{
_sl.game_speed = _game_speed;
// If fast forward is via key, save normal game speed.
// If the key continues to be pressed, the graphics driver will continue to fast forward the game.
// If the key is released during autosave, the normal speed will be restored.
AaronKatzin marked this conversation as resolved.
Show resolved Hide resolved
_sl.game_speed = VideoDriver::GetInstance()->isFastForwardViaKey() ? 100 : _game_speed;
AaronKatzin marked this conversation as resolved.
Show resolved Hide resolved
_game_speed = 100;
SetMouseCursorBusy(true);

Expand Down
1 change: 1 addition & 0 deletions src/saveload/saveload.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <optional>
#include <string>
#include <vector>
#include "../video/video_driver.hpp"

/** SaveLoad versions
* Previous savegame versions, the trunk revision where they were
Expand Down
3 changes: 3 additions & 0 deletions src/video/video_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ class VideoDriver : public Driver {
bool unlock; ///< Stores if the lock did anything that has to be undone.
};

bool isFastForwardViaKey(){
return fast_forward_via_key;
}
AaronKatzin marked this conversation as resolved.
Show resolved Hide resolved
protected:
const uint ALLOWED_DRIFT = 5; ///< How many times videodriver can miss deadlines without it being overly compensated.

Expand Down