Skip to content

Commit

Permalink
Fix indestructable effects not being sorted in a deterministic way
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Mar 31, 2024
1 parent ae4f284 commit bde406b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions containers_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ using effect_set = std::vector<effect*>;
using effect_set_v = effect_set;

bool effect_sort_id(const effect* e1, const effect* e2);
struct effect_sort_by_id {
bool operator()(effect* e1, effect* e2) const;
};

struct chain;
using chain_array = std::vector<chain>;
Expand Down
3 changes: 3 additions & 0 deletions effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
bool effect_sort_id(const effect* e1, const effect* e2) {
return e1->id < e2->id;
}
bool effect_sort_by_id::operator()(effect* e1, effect* e2) const {
return effect_sort_id(e1, e2);
}
bool field_effect::grant_effect_container::effect_sort_by_ref::operator()(effect* e1, effect* e2) const {
return e1->ref_handle < e2->ref_handle;
}
Expand Down
2 changes: 1 addition & 1 deletion operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3803,7 +3803,7 @@ bool field::process(Processors::Destroy& arg) {
card_set extra;
effect_set eset;
card_set indestructable_set;
std::set<effect*> indestructable_effect_set;
std::set<effect*, effect_sort_by_id> indestructable_effect_set;
for(auto cit = targets->container.begin(); cit != targets->container.end();) {
auto rm = cit++;
card* pcard = *rm;
Expand Down

0 comments on commit bde406b

Please sign in to comment.