fix game freezes on droiding when using dsu #3453
This commit is contained in:
parent
7e2dc296ba
commit
1646a7b906
2 changed files with 7 additions and 1 deletions
|
@ -381,6 +381,11 @@ void undo_list::undo()
|
|||
resources::recorder->redo(replay_data);
|
||||
undos_.emplace_back(std::move(action));
|
||||
}
|
||||
if(std::all_of(undos_.begin(), undos_.begin(), [](const action_ptr_t& action){ return dynamic_cast<undo_action*>(action.get()) == nullptr; }))
|
||||
{
|
||||
//clear the undo stack if it only contains dsu related actions, this in particular makes sure loops like `while(can_undo()) { undo(); }`always stop.
|
||||
undos_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ namespace actions {
|
|||
/// Class to store the actions that a player can undo and redo.
|
||||
class undo_list {
|
||||
|
||||
typedef std::vector<std::unique_ptr<undo_action_base>> action_list;
|
||||
typedef std::unique_ptr<undo_action_base> action_ptr_t;
|
||||
typedef std::vector<action_ptr_t> action_list;
|
||||
typedef std::vector<std::unique_ptr<config>> redos_list;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Reference in a new issue