Commit 6fed992e authored by salix5's avatar salix5

update std container erase

parent 01651763
...@@ -1950,9 +1950,10 @@ void card::reset(uint32 id, uint32 reset_type) { ...@@ -1950,9 +1950,10 @@ void card::reset(uint32 id, uint32 reset_type) {
return; return;
if (reset_type == RESET_EVENT) { if (reset_type == RESET_EVENT) {
for (auto rit = relations.begin(); rit != relations.end();) { for (auto rit = relations.begin(); rit != relations.end();) {
auto rrm = rit++; if (rit->second & 0xffff0000 & id)
if (rrm->second & 0xffff0000 & id) rit = relations.erase(rit);
relations.erase(rrm); else
++rit;
} }
if(id & (RESET_TODECK | RESET_TOHAND | RESET_TOGRAVE | RESET_REMOVE | RESET_TEMP_REMOVE if(id & (RESET_TODECK | RESET_TOHAND | RESET_TOGRAVE | RESET_REMOVE | RESET_TEMP_REMOVE
| RESET_OVERLAY | RESET_MSCHANGE)) | RESET_OVERLAY | RESET_MSCHANGE))
......
...@@ -3404,10 +3404,10 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3404,10 +3404,10 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
card_set indestructable_set; card_set indestructable_set;
std::set<effect*> indestructable_effect_set; std::set<effect*> indestructable_effect_set;
for (auto cit = targets->container.begin(); cit != targets->container.end();) { for (auto cit = targets->container.begin(); cit != targets->container.end();) {
auto rm = cit++; card* pcard = *cit;
card* pcard = *rm;
if(!pcard->is_destructable()) { if(!pcard->is_destructable()) {
indestructable_set.insert(pcard); indestructable_set.insert(pcard);
++cit;
continue; continue;
} }
if (!(pcard->current.reason & (REASON_RULE | REASON_COST))) { if (!(pcard->current.reason & (REASON_RULE | REASON_COST))) {
...@@ -3423,6 +3423,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3423,6 +3423,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
is_destructable = false; is_destructable = false;
if (!is_destructable) { if (!is_destructable) {
indestructable_set.insert(pcard); indestructable_set.insert(pcard);
++cit;
continue; continue;
} }
} }
...@@ -3443,6 +3444,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3443,6 +3444,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
} }
if(!is_destructable) { if(!is_destructable) {
indestructable_set.insert(pcard); indestructable_set.insert(pcard);
++cit;
continue; continue;
} }
} }
...@@ -3478,6 +3480,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3478,6 +3480,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
} }
if(!is_destructable) { if(!is_destructable) {
core.indestructable_count_set.insert(pcard); core.indestructable_count_set.insert(pcard);
++cit;
continue; continue;
} }
} }
...@@ -3499,9 +3502,11 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3499,9 +3502,11 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
pcard->current.reason_effect = pcard->temp.reason_effect; pcard->current.reason_effect = pcard->temp.reason_effect;
pcard->current.reason_player = pcard->temp.reason_player; pcard->current.reason_player = pcard->temp.reason_player;
core.destroy_canceled.insert(pcard); core.destroy_canceled.insert(pcard);
targets->container.erase(pcard); cit = targets->container.erase(cit);
continue;
} }
} }
++cit;
} }
for (auto& pcard : indestructable_set) { for (auto& pcard : indestructable_set) {
pcard->current.reason = pcard->temp.reason; pcard->current.reason = pcard->temp.reason;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment