From 9d28967206f08a1c5a08d3f8d22acbda124c4e2e Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 15 Jan 2024 19:41:47 -0800 Subject: [PATCH] Battle UFO: fix spawn ordering logic If the mapthings went in reverse order, so mapthing #1 had a higher ID than mapthing #2, the spawn ordering logic would get stuck because it wanted mapthing #1 to have a lower ID than mapthing #2. The root of the bug is that the previously used spawners ID was not totally ignored. Now it is. --- src/objects/battle-ufo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects/battle-ufo.cpp b/src/objects/battle-ufo.cpp index 8b65c7d99..5abb0cf91 100644 --- a/src/objects/battle-ufo.cpp +++ b/src/objects/battle-ufo.cpp @@ -82,7 +82,7 @@ public: auto min = [&](auto cmp) { return std::min_element(list_.begin(), list_.end(), cmp); }; return *(it != list_.end() - ? min([order](T a, T b) { return order < a->id() && a->id() < b->id(); }) + ? min([order](T a, T b) { return order < a->id() && (b->id() <= order || a->id() < b->id()); }) : min([](T a, T b) { return a->id() < b->id(); })); }