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.
This commit is contained in:
James R 2024-01-15 19:41:47 -08:00
parent bea26879ea
commit 9d28967206

View file

@ -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(); }));
}