From 360f8d71adf100ebbf0c535339ea0190240b1f7e Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Thu, 7 May 2020 02:56:43 +0200 Subject: [PATCH] Fix: check starting_age <= age, instead of starting_age < age. Otherwise we can get into an infinite loop. --- src/script/script_manager.cpp | 2 +- src/util/age.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/script/script_manager.cpp b/src/script/script_manager.cpp index 259de775..dbd1d9c4 100644 --- a/src/script/script_manager.cpp +++ b/src/script/script_manager.cpp @@ -321,7 +321,7 @@ void SetScriptManager::updateRecursive(deque& to_update, Age starting_ void SetScriptManager::updateToUpdate(const ToUpdate& u, deque& to_update, Age starting_age) { Age age = u.value->last_script_update; - if (starting_age < age) return; // this value was already updated + if (starting_age <= age) return; // this value was already updated Context& ctx = getContext(u.card); bool changes = false; try { diff --git a/src/util/age.hpp b/src/util/age.hpp index b3a6c24b..2c187da2 100644 --- a/src/util/age.hpp +++ b/src/util/age.hpp @@ -40,6 +40,8 @@ public: /// Compare two ages, smaller means earlier inline bool operator < (Age a) const { return age < a.age; } /// Compare two ages + inline bool operator <= (Age a) const { return age <= a.age; } + /// Compare two ages inline bool operator == (Age a) const { return age == a.age; } /// A number corresponding to the age