Commit f6d55d74 authored by DailyShana's avatar DailyShana

fix EVENT_DISCARD

parent cc50da86
...@@ -3611,7 +3611,7 @@ int32 field::send_to(uint16 step, group * targets, card * target) { ...@@ -3611,7 +3611,7 @@ int32 field::send_to(uint16 step, group * targets, card * target) {
int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) { int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
struct exargs { struct exargs {
group* targets; group* targets;
card_set leave, discard, detach; card_set leave, detach;
bool show_decktop[2]; bool show_decktop[2];
card_vector cv; card_vector cv;
card_vector::iterator cvit; card_vector::iterator cvit;
...@@ -3897,8 +3897,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3897,8 +3897,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_LEAVE, RESET_EVENT); pcard->reset(RESET_LEAVE, RESET_EVENT);
param->leave.insert(pcard); param->leave.insert(pcard);
} }
if(pcard->current.reason & REASON_DISCARD)
param->discard.insert(pcard);
++param->cvit; ++param->cvit;
core.units.begin()->step = 4; core.units.begin()->step = 4;
return FALSE; return FALSE;
...@@ -3941,8 +3939,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3941,8 +3939,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_LEAVE + RESET_MSCHANGE, RESET_EVENT); pcard->reset(RESET_LEAVE + RESET_MSCHANGE, RESET_EVENT);
param->leave.insert(pcard); param->leave.insert(pcard);
} }
if(pcard->current.reason & REASON_DISCARD)
param->discard.insert(pcard);
if(param->predirect->operation) { if(param->predirect->operation) {
tevent e; tevent e;
e.event_cards = targets; e.event_cards = targets;
...@@ -3984,8 +3980,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3984,8 +3980,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
} }
for(auto iter = param->leave.begin(); iter != param->leave.end(); ++iter) for(auto iter = param->leave.begin(); iter != param->leave.end(); ++iter)
raise_single_event(*iter, 0, EVENT_LEAVE_FIELD, (*iter)->current.reason_effect, (*iter)->current.reason, (*iter)->current.reason_player, 0, 0); raise_single_event(*iter, 0, EVENT_LEAVE_FIELD, (*iter)->current.reason_effect, (*iter)->current.reason, (*iter)->current.reason_player, 0, 0);
for(auto iter = param->discard.begin(); iter != param->discard.end(); ++iter)
raise_single_event(*iter, 0, EVENT_DISCARD, (*iter)->current.reason_effect, (*iter)->current.reason, (*iter)->current.reason_player, 0, 0);
if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) { if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) {
for(auto iter = param->detach.begin(); iter != param->detach.end(); ++iter) { for(auto iter = param->detach.begin(); iter != param->detach.end(); ++iter) {
if((*iter)->current.location & LOCATION_MZONE) if((*iter)->current.location & LOCATION_MZONE)
...@@ -3995,8 +3989,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3995,8 +3989,6 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
process_single_event(); process_single_event();
if(param->leave.size()) if(param->leave.size())
raise_event(&param->leave, EVENT_LEAVE_FIELD, reason_effect, reason, reason_player, 0, 0); raise_event(&param->leave, EVENT_LEAVE_FIELD, reason_effect, reason, reason_player, 0, 0);
if(param->discard.size())
raise_event(&param->discard, EVENT_DISCARD, reason_effect, reason, reason_player, 0, 0);
if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size())
raise_event(&param->detach, EVENT_DETACH_MATERIAL, reason_effect, reason, reason_player, 0, 0); raise_event(&param->detach, EVENT_DETACH_MATERIAL, reason_effect, reason, reason_player, 0, 0);
process_instant_event(); process_instant_event();
...@@ -4008,12 +4000,11 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4008,12 +4000,11 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
core.units.begin()->ptarget = param->targets; core.units.begin()->ptarget = param->targets;
targets = param->targets; targets = param->targets;
delete param; delete param;
uint8 nloc; card_set tohand, todeck, tograve, remove, discard, released, destroyed, retgrave;
card_set tohand, todeck, tograve, remove, released, destroyed, retgrave;
card_set equipings, overlays; card_set equipings, overlays;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) { for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
card* pcard = *cit; card* pcard = *cit;
nloc = pcard->current.location; uint8 nloc = pcard->current.location;
if(pcard->equiping_target) if(pcard->equiping_target)
pcard->unequip(); pcard->unequip();
if(pcard->equiping_cards.size()) { if(pcard->equiping_cards.size()) {
...@@ -4053,6 +4044,10 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4053,6 +4044,10 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->reset(RESET_REMOVE, RESET_EVENT); pcard->reset(RESET_REMOVE, RESET_EVENT);
raise_single_event(pcard, 0, EVENT_REMOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_REMOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
} }
if(pcard->current.reason & REASON_DISCARD) {
discard.insert(pcard);
raise_single_event(pcard, 0, EVENT_DISCARD, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(pcard->current.reason & REASON_RELEASE) { if(pcard->current.reason & REASON_RELEASE) {
released.insert(pcard); released.insert(pcard);
raise_single_event(pcard, 0, EVENT_RELEASE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_RELEASE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
...@@ -4076,6 +4071,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4076,6 +4071,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
raise_event(&tograve, EVENT_TO_GRAVE, reason_effect, reason, reason_player, 0, 0); raise_event(&tograve, EVENT_TO_GRAVE, reason_effect, reason, reason_player, 0, 0);
if(remove.size()) if(remove.size())
raise_event(&remove, EVENT_REMOVE, reason_effect, reason, reason_player, 0, 0); raise_event(&remove, EVENT_REMOVE, reason_effect, reason, reason_player, 0, 0);
if(discard.size())
raise_event(&discard, EVENT_DISCARD, reason_effect, reason, reason_player, 0, 0);
if(released.size()) if(released.size())
raise_event(&released, EVENT_RELEASE, reason_effect, reason, reason_player, 0, 0); raise_event(&released, EVENT_RELEASE, reason_effect, reason, reason_player, 0, 0);
if(destroyed.size()) if(destroyed.size())
......
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