Commit f9979a9f authored by VanillaSalt's avatar VanillaSalt

fix

parent ac779bf0
...@@ -113,7 +113,7 @@ int32 effect::is_available() { ...@@ -113,7 +113,7 @@ int32 effect::is_available() {
status &= ~EFFECT_STATUS_AVAILABLE; status &= ~EFFECT_STATUS_AVAILABLE;
return res; return res;
} }
int32 effect::is_activateable(uint8 playerid, tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) { int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) {
if(!(type & EFFECT_TYPE_ACTIONS)) if(!(type & EFFECT_TYPE_ACTIONS))
return FALSE; return FALSE;
if((flag & EFFECT_FLAG_COUNT_LIMIT) && (reset_count & 0xf00) == 0) if((flag & EFFECT_FLAG_COUNT_LIMIT) && (reset_count & 0xf00) == 0)
...@@ -226,7 +226,7 @@ int32 effect::is_action_check(uint8 playerid) { ...@@ -226,7 +226,7 @@ int32 effect::is_action_check(uint8 playerid) {
} }
return TRUE; return TRUE;
} }
int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) { int32 effect::is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) {
if (!neglect_cond && condition) { if (!neglect_cond && condition) {
pduel->lua->add_param(this, PARAM_TYPE_EFFECT); pduel->lua->add_param(this, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
...@@ -270,7 +270,7 @@ int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, i ...@@ -270,7 +270,7 @@ int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, i
} }
return TRUE; return TRUE;
} }
int32 effect::is_condition_check(uint8 playerid, tevent& e) { int32 effect::is_condition_check(uint8 playerid, const tevent& e) {
if(!(type & EFFECT_TYPE_ACTIVATE) && (handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED)) && (!handler->is_position(POS_FACEUP))) if(!(type & EFFECT_TYPE_ACTIVATE) && (handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED)) && (!handler->is_position(POS_FACEUP)))
return FALSE; return FALSE;
if(!condition) if(!condition)
...@@ -299,7 +299,7 @@ int32 effect::is_condition_check(uint8 playerid, tevent& e) { ...@@ -299,7 +299,7 @@ int32 effect::is_condition_check(uint8 playerid, tevent& e) {
pduel->game_field->core.reason_player = op; pduel->game_field->core.reason_player = op;
return TRUE; return TRUE;
} }
int32 effect::is_activate_check(uint8 playerid, tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) { int32 effect::is_activate_check(uint8 playerid, const tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) {
pduel->game_field->save_lp_cost(); pduel->game_field->save_lp_cost();
effect* oreason = pduel->game_field->core.reason_effect; effect* oreason = pduel->game_field->core.reason_effect;
uint8 op = pduel->game_field->core.reason_player; uint8 op = pduel->game_field->core.reason_player;
......
...@@ -62,11 +62,11 @@ public: ...@@ -62,11 +62,11 @@ public:
int32 is_disable_related(); int32 is_disable_related();
int32 is_available(); int32 is_available();
int32 is_activateable(uint8 playerid, tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE); int32 is_activateable(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_action_check(uint8 playerid); int32 is_action_check(uint8 playerid);
int32 is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE); int32 is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_condition_check(uint8 playerid, tevent& e); int32 is_condition_check(uint8 playerid, const tevent& e);
int32 is_activate_check(uint8 playerid, tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE); int32 is_activate_check(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_target(card* pcard); int32 is_target(card* pcard);
int32 is_target_player(uint8 playerid); int32 is_target_player(uint8 playerid);
int32 is_player_effect_target(card* pcard); int32 is_player_effect_target(card* pcard);
......
...@@ -512,8 +512,8 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -512,8 +512,8 @@ void field::shuffle(uint8 playerid, uint8 location) {
pduel->write_buffer8(MSG_SHUFFLE_DECK); pduel->write_buffer8(MSG_SHUFFLE_DECK);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
core.shuffle_deck_check[playerid] = FALSE; core.shuffle_deck_check[playerid] = FALSE;
card* ptop = *svector.rbegin();
if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) { if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) {
card* ptop = svector.back();
if(core.deck_reversed || (ptop->current.position == POS_FACEUP_DEFENCE)) { if(core.deck_reversed || (ptop->current.position == POS_FACEUP_DEFENCE)) {
pduel->write_buffer8(MSG_DECK_TOP); pduel->write_buffer8(MSG_DECK_TOP);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
...@@ -642,7 +642,7 @@ void field::tag_swap(uint8 playerid) { ...@@ -642,7 +642,7 @@ void field::tag_swap(uint8 playerid) {
pduel->write_buffer8(player[playerid].list_extra.size()); pduel->write_buffer8(player[playerid].list_extra.size());
pduel->write_buffer8(player[playerid].list_hand.size()); pduel->write_buffer8(player[playerid].list_hand.size());
if(core.deck_reversed && player[playerid].list_main.size()) if(core.deck_reversed && player[playerid].list_main.size())
pduel->write_buffer32((*player[playerid].list_main.rbegin())->data.code); pduel->write_buffer32(player[playerid].list_main.back()->data.code);
else else
pduel->write_buffer32(0); pduel->write_buffer32(0);
for(auto cit = player[playerid].list_hand.begin(); cit != player[playerid].list_hand.end(); ++cit) for(auto cit = player[playerid].list_hand.begin(); cit != player[playerid].list_hand.end(); ++cit)
...@@ -1022,32 +1022,27 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g ...@@ -1022,32 +1022,27 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g
} }
if(location & LOCATION_HAND) { if(location & LOCATION_HAND) {
if(pgroup) if(pgroup)
for(auto cit = player[self].list_hand.begin(); cit != player[self].list_hand.end(); ++cit) pgroup->container.insert(player[self].list_hand.begin(), player[self].list_hand.end());
pgroup->container.insert(*cit);
count += player[self].list_hand.size(); count += player[self].list_hand.size();
} }
if(location & LOCATION_DECK) { if(location & LOCATION_DECK) {
if(pgroup) if(pgroup)
for(auto cit = player[self].list_main.rbegin(); cit != player[self].list_main.rend(); ++cit) pgroup->container.insert(player[self].list_main.rbegin(), player[self].list_main.rend());
pgroup->container.insert(*cit);
count += player[self].list_main.size(); count += player[self].list_main.size();
} }
if(location & LOCATION_EXTRA) { if(location & LOCATION_EXTRA) {
if(pgroup) if(pgroup)
for(auto cit = player[self].list_extra.rbegin(); cit != player[self].list_extra.rend(); ++cit) pgroup->container.insert(player[self].list_extra.rbegin(), player[self].list_extra.rend());
pgroup->container.insert(*cit);
count += player[self].list_extra.size(); count += player[self].list_extra.size();
} }
if(location & LOCATION_GRAVE) { if(location & LOCATION_GRAVE) {
if(pgroup) if(pgroup)
for(auto cit = player[self].list_grave.rbegin(); cit != player[self].list_grave.rend(); ++cit) pgroup->container.insert(player[self].list_grave.rbegin(), player[self].list_grave.rend());
pgroup->container.insert(*cit);
count += player[self].list_grave.size(); count += player[self].list_grave.size();
} }
if(location & LOCATION_REMOVED) { if(location & LOCATION_REMOVED) {
if(pgroup) if(pgroup)
for(auto cit = player[self].list_remove.rbegin(); cit != player[self].list_remove.rend(); ++cit) pgroup->container.insert(player[self].list_remove.rbegin(), player[self].list_remove.rend());
pgroup->container.insert(*cit);
count += player[self].list_remove.size(); count += player[self].list_remove.size();
} }
location = location2; location = location2;
...@@ -1240,8 +1235,7 @@ void field::get_overlay_group(uint8 self, uint8 s, uint8 o, card_set* pset) { ...@@ -1240,8 +1235,7 @@ void field::get_overlay_group(uint8 self, uint8 s, uint8 o, card_set* pset) {
for(int i = 0; i < 5; ++i) { for(int i = 0; i < 5; ++i) {
pcard = player[self].list_mzone[i]; pcard = player[self].list_mzone[i];
if(pcard && !pcard->is_status(STATUS_SUMMONING) && pcard->xyz_materials.size()) if(pcard && !pcard->is_status(STATUS_SUMMONING) && pcard->xyz_materials.size())
for(auto clit = pcard->xyz_materials.begin(); clit != pcard->xyz_materials.end(); ++clit) pset->insert(pcard->xyz_materials.begin(), pcard->xyz_materials.end());
pset->insert(*clit);
} }
} }
self = 1 - self; self = 1 - self;
...@@ -1403,7 +1397,7 @@ uint32 field::get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype ...@@ -1403,7 +1397,7 @@ uint32 field::get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype
} }
return count; return count;
} }
int32 field::effect_replace_check(uint32 code, tevent& e) { int32 field::effect_replace_check(uint32 code, const tevent& e) {
auto pr = effects.continuous_effect.equal_range(code); auto pr = effects.continuous_effect.equal_range(code);
for (; pr.first != pr.second; ++pr.first) { for (; pr.first != pr.second; ++pr.first) {
effect* peffect = pr.first->second; effect* peffect = pr.first->second;
...@@ -1582,7 +1576,7 @@ int32 field::is_player_can_discard_deck_as_cost(uint8 playerid, int32 count) { ...@@ -1582,7 +1576,7 @@ int32 field::is_player_can_discard_deck_as_cost(uint8 playerid, int32 count) {
if(is_player_affected_by_effect(playerid, EFFECT_CANNOT_DISCARD_DECK)) if(is_player_affected_by_effect(playerid, EFFECT_CANNOT_DISCARD_DECK))
return FALSE; return FALSE;
if((count == 1) && core.deck_reversed) if((count == 1) && core.deck_reversed)
return (*player[playerid].list_main.rbegin())->is_capable_cost_to_grave(playerid); return player[playerid].list_main.back()->is_capable_cost_to_grave(playerid);
effect_set eset; effect_set eset;
filter_field_effect(EFFECT_TO_GRAVE_REDIRECT, &eset); filter_field_effect(EFFECT_TO_GRAVE_REDIRECT, &eset);
for(int32 i = 0; i < eset.count; ++i) { for(int32 i = 0; i < eset.count; ++i) {
......
...@@ -350,7 +350,7 @@ public: ...@@ -350,7 +350,7 @@ public:
int32 pay_lp_cost(uint32 step, uint8 playerid, uint32 cost); int32 pay_lp_cost(uint32 step, uint8 playerid, uint32 cost);
uint32 get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype); uint32 get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype);
int32 effect_replace_check(uint32 code, tevent& e); int32 effect_replace_check(uint32 code, const tevent& e);
int32 get_attack_target(card* pcard, card_vector* v, uint8 chain_attack = FALSE); int32 get_attack_target(card* pcard, card_vector* v, uint8 chain_attack = FALSE);
void attack_all_target_check(); void attack_all_target_check();
int32 check_synchro_material(card* pcard, int32 findex1, int32 findex2, int32 min, int32 max); int32 check_synchro_material(card* pcard, int32 findex1, int32 findex2, int32 min, int32 max);
......
...@@ -525,9 +525,7 @@ int32 scriptlib::card_get_material(lua_State *L) { ...@@ -525,9 +525,7 @@ int32 scriptlib::card_get_material(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
group* pgroup = pcard->pduel->new_group(); group* pgroup = pcard->pduel->new_group();
card::card_set::iterator cit; pgroup->container.insert(pcard->material_cards.begin(), pcard->material_cards.end());
for(cit = pcard->material_cards.begin(); cit != pcard->material_cards.end(); ++cit)
pgroup->container.insert(*cit);
interpreter::group2value(L, pgroup); interpreter::group2value(L, pgroup);
return 1; return 1;
} }
...@@ -543,9 +541,7 @@ int32 scriptlib::card_get_equip_group(lua_State *L) { ...@@ -543,9 +541,7 @@ int32 scriptlib::card_get_equip_group(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
group* pgroup = pcard->pduel->new_group(); group* pgroup = pcard->pduel->new_group();
card::card_set::iterator cit; pgroup->container.insert(pcard->equiping_cards.begin(), pcard->equiping_cards.end());
for(cit = pcard->equiping_cards.begin(); cit != pcard->equiping_cards.end(); ++cit)
pgroup->container.insert(*cit);
interpreter::group2value(L, pgroup); interpreter::group2value(L, pgroup);
return 1; return 1;
} }
...@@ -595,8 +591,7 @@ int32 scriptlib::card_get_overlay_group(lua_State *L) { ...@@ -595,8 +591,7 @@ int32 scriptlib::card_get_overlay_group(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
group* pgroup = pcard->pduel->new_group(); group* pgroup = pcard->pduel->new_group();
for(auto cit = pcard->xyz_materials.begin(); cit != pcard->xyz_materials.end(); ++cit) pgroup->container.insert(pcard->xyz_materials.begin(), pcard->xyz_materials.end());
pgroup->container.insert(*cit);
interpreter::group2value(L, pgroup); interpreter::group2value(L, pgroup);
return 1; return 1;
} }
...@@ -1914,8 +1909,7 @@ int32 scriptlib::card_get_attackable_target(lua_State *L) { ...@@ -1914,8 +1909,7 @@ int32 scriptlib::card_get_attackable_target(lua_State *L) {
field::card_vector targets; field::card_vector targets;
pduel->game_field->get_attack_target(pcard, &targets); pduel->game_field->get_attack_target(pcard, &targets);
group* newgroup = pduel->new_group(); group* newgroup = pduel->new_group();
for(auto cit = targets.begin(); cit != targets.end(); ++cit) newgroup->container.insert(targets.begin(), targets.end());
newgroup->container.insert(*cit);
interpreter::group2value(L, newgroup); interpreter::group2value(L, newgroup);
lua_pushboolean(L, pcard->operation_param); lua_pushboolean(L, pcard->operation_param);
return 2; return 2;
......
...@@ -182,7 +182,7 @@ int32 scriptlib::group_filter_count(lua_State *L) { ...@@ -182,7 +182,7 @@ int32 scriptlib::group_filter_count(lua_State *L) {
if((*it) != pexception && pduel->lua->check_matching(*it, 2, extraargs)) if((*it) != pexception && pduel->lua->check_matching(*it, 2, extraargs))
count++; count++;
} }
lua_pushinteger(L, count);; lua_pushinteger(L, count);
return 1; return 1;
} }
int32 scriptlib::group_filter_select(lua_State *L) { int32 scriptlib::group_filter_select(lua_State *L) {
...@@ -270,7 +270,7 @@ int32 scriptlib::group_is_exists(lua_State *L) { ...@@ -270,7 +270,7 @@ int32 scriptlib::group_is_exists(lua_State *L) {
} }
} }
} }
lua_pushboolean(L, result);; lua_pushboolean(L, result);
return 1; return 1;
} }
int32 scriptlib::group_check_with_sum_equal(lua_State *L) { int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
...@@ -492,10 +492,7 @@ int32 scriptlib::group_merge(lua_State *L) { ...@@ -492,10 +492,7 @@ int32 scriptlib::group_merge(lua_State *L) {
group* mgroup = *(group**) lua_touserdata(L, 2); group* mgroup = *(group**) lua_touserdata(L, 2);
if(pgroup->is_readonly == 1) if(pgroup->is_readonly == 1)
return 0; return 0;
group::card_set::iterator cit; pgroup->container.insert(mgroup->container.begin(), mgroup->container.end());
for (cit = mgroup->container.begin(); cit != mgroup->container.end(); ++cit) {
pgroup->container.insert(*cit);
}
return 0; return 0;
} }
int32 scriptlib::group_sub(lua_State *L) { int32 scriptlib::group_sub(lua_State *L) {
......
...@@ -733,7 +733,7 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8 ...@@ -733,7 +733,7 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8
tevent e; tevent e;
e.event_cards = 0; e.event_cards = 0;
e.event_player = rplayer; e.event_player = rplayer;
e.event_value = min + (max << 16);; e.event_value = min + (max << 16);
e.reason = reason; e.reason = reason;
e.reason_effect = core.reason_effect; e.reason_effect = core.reason_effect;
e.reason_player = rplayer; e.reason_player = rplayer;
...@@ -990,10 +990,8 @@ int32 field::control_adjust(uint16 step) { ...@@ -990,10 +990,8 @@ int32 field::control_adjust(uint16 step) {
pduel->write_buffer8(pcard1->current.sequence); pduel->write_buffer8(pcard1->current.sequence);
pduel->write_buffer8(pcard1->current.position); pduel->write_buffer8(pcard1->current.position);
} }
while(cit1 != core.control_adjust_set[0].end()) core.operated_set.insert(cit1, core.control_adjust_set[0].end());
core.operated_set.insert(*cit1++); core.operated_set.insert(cit2, core.control_adjust_set[1].end());
while(cit2 != core.control_adjust_set[1].end())
core.operated_set.insert(*cit2++);
return FALSE; return FALSE;
} }
case 3: { case 3: {
...@@ -1004,11 +1002,11 @@ int32 field::control_adjust(uint16 step) { ...@@ -1004,11 +1002,11 @@ int32 field::control_adjust(uint16 step) {
core.operated_set.erase(cit); core.operated_set.erase(cit);
pcard->reset(RESET_CONTROL, RESET_EVENT); pcard->reset(RESET_CONTROL, RESET_EVENT);
move_to_field(pcard, 1 - pcard->current.controler, 1 - pcard->current.controler, LOCATION_MZONE, pcard->current.position); move_to_field(pcard, 1 - pcard->current.controler, 1 - pcard->current.controler, LOCATION_MZONE, pcard->current.position);
core.units.begin()->step = 2;
return FALSE; return FALSE;
} }
case 4: { case 4: {
for(auto cit = core.control_adjust_set[1].begin(); cit != core.control_adjust_set[1].end(); ++cit) core.control_adjust_set[0].insert(core.control_adjust_set[1].begin(), core.control_adjust_set[1].end());
core.control_adjust_set[0].insert(*cit);
for(auto cit = core.control_adjust_set[0].begin(); cit != core.control_adjust_set[0].end(); ++cit) { for(auto cit = core.control_adjust_set[0].begin(); cit != core.control_adjust_set[0].end(); ++cit) {
(*cit)->filter_disable_related_cards(); (*cit)->filter_disable_related_cards();
raise_single_event((*cit), 0, EVENT_CONTROL_CHANGED, 0, REASON_RULE, 0, 0, 0); raise_single_event((*cit), 0, EVENT_CONTROL_CHANGED, 0, REASON_RULE, 0, 0, 0);
...@@ -2160,9 +2158,7 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) { ...@@ -2160,9 +2158,7 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) {
int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_player, group * targets) { int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_player, group * targets) {
switch(step) { switch(step) {
case 0: { case 0: {
card_vector cv; card_vector cv(targets->container.begin(), targets->container.end());
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
if(cv.size() > 1) if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort); std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for(auto cvit = cv.begin(); cvit != cv.end(); ++cvit) for(auto cvit = cv.begin(); cvit != cv.end(); ++cvit)
...@@ -2340,9 +2336,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2340,9 +2336,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
pduel->delete_group(targets); pduel->delete_group(targets);
return TRUE; return TRUE;
} }
card_vector cv; card_vector cv(targets->container.begin(), targets->container.end());
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
if(cv.size() > 1) if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort); std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for (auto cvit = cv.begin(); cvit != cv.end(); ++cvit) { for (auto cvit = cv.begin(); cvit != cv.end(); ++cvit) {
...@@ -2502,7 +2496,7 @@ int32 field::release(uint16 step, group * targets, card * target) { ...@@ -2502,7 +2496,7 @@ int32 field::release(uint16 step, group * targets, card * target) {
int32 field::release(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) { int32 field::release(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
switch (step) { switch (step) {
case 0: { case 0: {
card_set extra; //card_set extra;
for (auto cit = targets->container.begin(); cit != targets->container.end();) { for (auto cit = targets->container.begin(); cit != targets->container.end();) {
auto rm = cit++; auto rm = cit++;
card* pcard = *rm; card* pcard = *rm;
...@@ -2537,9 +2531,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2537,9 +2531,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3
pduel->delete_group(targets); pduel->delete_group(targets);
return TRUE; return TRUE;
} }
card_vector cv; card_vector cv(targets->container.begin(), targets->container.end());
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
if(cv.size() > 1) if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort); std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for (auto cvit = cv.begin(); cvit != cv.end(); ++cvit) { for (auto cvit = cv.begin(); cvit != cv.end(); ++cvit) {
...@@ -2721,9 +2713,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2721,9 +2713,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
card_set leave, discard, detach; card_set leave, discard, detach;
uint8 oloc, playerid, dest, seq; uint8 oloc, playerid, dest, seq;
bool show_decktop[2] = {false, false}; bool show_decktop[2] = {false, false};
card_vector cv; card_vector cv(targets->container.begin(), targets->container.end());
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
if(cv.size() > 1) if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort); std::sort(cv.begin(), cv.end(), card::card_operation_sort);
if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) { if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) {
...@@ -3219,8 +3209,7 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret ...@@ -3219,8 +3209,7 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret
} }
if(target->xyz_materials.size()) { if(target->xyz_materials.size()) {
card_set overlays; card_set overlays;
for(auto clit = target->xyz_materials.begin(); clit != target->xyz_materials.end(); ++clit) overlays.insert(target->xyz_materials.begin(), target->xyz_materials.end());
overlays.insert(*clit);
send_to(&overlays, 0, REASON_LOST_TARGET + REASON_RULE, PLAYER_NONE, PLAYER_NONE, LOCATION_GRAVE, 0, POS_FACEUP); send_to(&overlays, 0, REASON_LOST_TARGET + REASON_RULE, PLAYER_NONE, PLAYER_NONE, LOCATION_GRAVE, 0, POS_FACEUP);
} }
} }
...@@ -3245,18 +3234,14 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret ...@@ -3245,18 +3234,14 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret
int32 field::change_position(uint16 step, group * targets, effect * reason_effect, uint8 reason_player, uint32 enable) { int32 field::change_position(uint16 step, group * targets, effect * reason_effect, uint8 reason_player, uint32 enable) {
switch(step) { switch(step) {
case 0: { case 0: {
card_set::iterator cit;
card_set equipings; card_set equipings;
card_set flips; card_set flips;
card_set pos_changed; card_set pos_changed;
uint8 npos, opos, noflip; uint8 npos, opos, noflip;
card_vector cv; card_vector cv(targets->container.begin(), targets->container.end());
card_vector::iterator cvit;
for(cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
if(cv.size() > 1) if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort); std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for(cvit = cv.begin(); cvit != cv.end(); ++cvit) { for(auto cvit = cv.begin(); cvit != cv.end(); ++cvit) {
card* pcard = *cvit; card* pcard = *cvit;
npos = pcard->operation_param & 0xff; npos = pcard->operation_param & 0xff;
opos = pcard->current.position; opos = pcard->current.position;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "effect.h" #include "effect.h"
#include "interpreter.h" #include "interpreter.h"
#include "ocgapi.h" #include "ocgapi.h"
#include <iterator>
void field::add_process(uint16 type, uint16 step, effect* peffect, group* target, ptr arg1, ptr arg2) { void field::add_process(uint16 type, uint16 step, effect* peffect, group* target, ptr arg1, ptr arg2) {
processor_unit new_unit; processor_unit new_unit;
...@@ -725,7 +726,7 @@ int32 field::process() { ...@@ -725,7 +726,7 @@ int32 field::process() {
move_card(pcard->current.controler, pcard, pcard->current.location, 0); move_card(pcard->current.controler, pcard, pcard->current.location, 0);
pduel->write_buffer8(MSG_BECOME_TARGET); pduel->write_buffer8(MSG_BECOME_TARGET);
pduel->write_buffer8(1); pduel->write_buffer8(1);
pduel->write_buffer32(core.select_cards[returns.bvalue[i + 1]]->get_info_location()); pduel->write_buffer32(pcard->get_info_location());
} }
} }
for(auto cit = pret->container.begin(); cit != pret->container.end(); ++cit) for(auto cit = pret->container.begin(); cit != pret->container.end(); ++cit)
...@@ -754,10 +755,7 @@ int32 field::process() { ...@@ -754,10 +755,7 @@ int32 field::process() {
core.units.begin()->step++; core.units.begin()->step++;
} else { } else {
group* pgroup = pduel->new_group(); group* pgroup = pduel->new_group();
card_set::iterator cit; pgroup->container.insert(core.fusion_materials.begin(), core.fusion_materials.end());
for(cit = core.fusion_materials.begin(); cit != core.fusion_materials.end(); ++cit) {
pgroup->container.insert(*cit);
}
if(it->arg2) if(it->arg2)
pgroup->container.insert((card*)it->arg2); pgroup->container.insert((card*)it->arg2);
pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP); pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP);
...@@ -840,8 +838,7 @@ int32 field::process() { ...@@ -840,8 +838,7 @@ int32 field::process() {
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_RANDOM_SELECT_S: { case PROCESSOR_RANDOM_SELECT_S: {
uint32 count = it->arg2, i = 0, p = 0; uint32 count = it->arg2;
field::card_set::iterator cit;
group* pgroup = it->ptarget; group* pgroup = it->ptarget;
group* newgroup = pduel->new_group(); group* newgroup = pduel->new_group();
if(count > pgroup->container.size()) if(count > pgroup->container.size())
...@@ -856,8 +853,9 @@ int32 field::process() { ...@@ -856,8 +853,9 @@ int32 field::process() {
newgroup->container = pgroup->container; newgroup->container = pgroup->container;
else { else {
while(newgroup->container.size() < count) { while(newgroup->container.size() < count) {
i = pduel->get_next_integer(0, pgroup->container.size() - 1); int32 i = pduel->get_next_integer(0, pgroup->container.size() - 1);
for(p = 0, cit = pgroup->container.begin(); p < i; ++p, ++cit); auto cit = pgroup->container.begin();
std::advance(cit, i);
newgroup->container.insert(*cit); newgroup->container.insert(*cit);
} }
} }
...@@ -865,7 +863,7 @@ int32 field::process() { ...@@ -865,7 +863,7 @@ int32 field::process() {
pduel->write_buffer8(MSG_RANDOM_SELECTED); pduel->write_buffer8(MSG_RANDOM_SELECTED);
pduel->write_buffer8(it->arg1); pduel->write_buffer8(it->arg1);
pduel->write_buffer8(count); pduel->write_buffer8(count);
for(cit = newgroup->container.begin(); cit != newgroup->container.end(); ++cit) { for(auto cit = newgroup->container.begin(); cit != newgroup->container.end(); ++cit) {
pduel->write_buffer32((*cit)->get_info_location()); pduel->write_buffer32((*cit)->get_info_location());
} }
core.units.pop_front(); core.units.pop_front();
...@@ -995,7 +993,7 @@ int32 field::process() { ...@@ -995,7 +993,7 @@ int32 field::process() {
} }
if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) { if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) {
if(count > 0) { if(count > 0) {
card* ptop = *player[target_player].list_main.rbegin(); card* ptop = player[target_player].list_main.back();
if(core.deck_reversed || (ptop->current.position == POS_FACEUP_DEFENCE)) { if(core.deck_reversed || (ptop->current.position == POS_FACEUP_DEFENCE)) {
pduel->write_buffer8(MSG_DECK_TOP); pduel->write_buffer8(MSG_DECK_TOP);
pduel->write_buffer8(target_player); pduel->write_buffer8(target_player);
...@@ -1040,7 +1038,7 @@ int32 field::execute_cost(uint16 step, effect * triggering_effect, uint8 trigger ...@@ -1040,7 +1038,7 @@ int32 field::execute_cost(uint16 step, effect * triggering_effect, uint8 trigger
} }
if (step == 0) { if (step == 0) {
core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event); core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event);
tevent e = *core.solving_event.begin(); const tevent& e = core.solving_event.front();
pduel->lua->add_param(1, PARAM_TYPE_INT, true); pduel->lua->add_param(1, PARAM_TYPE_INT, true);
pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT, true); pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT, true);
pduel->lua->add_param(e.reason, PARAM_TYPE_INT, true); pduel->lua->add_param(e.reason, PARAM_TYPE_INT, true);
...@@ -1092,7 +1090,7 @@ int32 field::execute_operation(uint16 step, effect * triggering_effect, uint8 tr ...@@ -1092,7 +1090,7 @@ int32 field::execute_operation(uint16 step, effect * triggering_effect, uint8 tr
} }
if (step == 0) { if (step == 0) {
core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event); core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event);
tevent e = *core.solving_event.begin(); const tevent& e = core.solving_event.front();
pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT, true); pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT, true);
pduel->lua->add_param(e.reason, PARAM_TYPE_INT, true); pduel->lua->add_param(e.reason, PARAM_TYPE_INT, true);
pduel->lua->add_param(e.reason_effect , PARAM_TYPE_EFFECT, true); pduel->lua->add_param(e.reason_effect , PARAM_TYPE_EFFECT, true);
...@@ -1147,7 +1145,7 @@ int32 field::execute_target(uint16 step, effect * triggering_effect, uint8 trigg ...@@ -1147,7 +1145,7 @@ int32 field::execute_target(uint16 step, effect * triggering_effect, uint8 trigg
} }
if (step == 0) { if (step == 0) {
core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event); core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event);
tevent e = *core.solving_event.begin(); const tevent& e = core.solving_event.front();
pduel->lua->add_param(1, PARAM_TYPE_INT, true); pduel->lua->add_param(1, PARAM_TYPE_INT, true);
pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT, true); pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT, true);
pduel->lua->add_param(e.reason, PARAM_TYPE_INT, true); pduel->lua->add_param(e.reason, PARAM_TYPE_INT, true);
...@@ -1271,7 +1269,7 @@ int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, i ...@@ -1271,7 +1269,7 @@ int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, i
if(pe) if(pe)
*pe = *eit; *pe = *eit;
if(copy_info && !pduel->lua->no_action && core.current_chain.size()) { if(copy_info && !pduel->lua->no_action && core.current_chain.size()) {
core.current_chain.rbegin()->evt = *eit; core.current_chain.back().evt = *eit;
} }
return TRUE; return TRUE;
} }
...@@ -1282,7 +1280,7 @@ int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, i ...@@ -1282,7 +1280,7 @@ int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, i
if(pe) if(pe)
*pe = *eit; *pe = *eit;
if(copy_info && !pduel->lua->no_action && core.current_chain.size()) { if(copy_info && !pduel->lua->no_action && core.current_chain.size()) {
core.current_chain.rbegin()->evt = *eit; core.current_chain.back().evt = *eit;
} }
return TRUE; return TRUE;
} }
...@@ -1898,7 +1896,7 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) { ...@@ -1898,7 +1896,7 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) {
if(core.current_chain.size() == 0) if(core.current_chain.size() == 0)
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, special, infos.turn_player); add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, special, infos.turn_player);
else else
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, special, 1 - core.current_chain.rbegin()->triggering_player); add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, special, 1 - core.current_chain.back().triggering_player);
return FALSE; return FALSE;
} }
case 10: { case 10: {
...@@ -2029,7 +2027,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) { ...@@ -2029,7 +2027,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
if(core.global_flag & GLOBALFLAG_DELAYED_QUICKEFFECT) { if(core.global_flag & GLOBALFLAG_DELAYED_QUICKEFFECT) {
for(auto eit = core.delayed_quick.begin(); eit != core.delayed_quick.end(); ++eit) { for(auto eit = core.delayed_quick.begin(); eit != core.delayed_quick.end(); ++eit) {
peffect = eit->first; peffect = eit->first;
tevent evt = eit->second; const tevent& evt = eit->second;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, evt, TRUE, FALSE, FALSE)) { if(peffect->is_chainable(priority) && peffect->is_activateable(priority, evt, TRUE, FALSE, FALSE)) {
newchain.flag = 0; newchain.flag = 0;
newchain.chain_id = infos.field_id++; newchain.chain_id = infos.field_id++;
...@@ -2089,7 +2087,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) { ...@@ -2089,7 +2087,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
core.new_chains.splice(core.new_chains.end(), core.tpchain); core.new_chains.splice(core.new_chains.end(), core.tpchain);
core.new_chains.splice(core.new_chains.end(), core.ntpchain); core.new_chains.splice(core.new_chains.end(), core.ntpchain);
add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0); add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0);
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, FALSE, 1 - core.new_chains.rbegin()->triggering_player); add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, FALSE, 1 - core.new_chains.back().triggering_player);
infos.priorities[0] = 0; infos.priorities[0] = 0;
infos.priorities[1] = 0; infos.priorities[1] = 0;
return TRUE; return TRUE;
...@@ -2268,7 +2266,7 @@ int32 field::process_single_event() { ...@@ -2268,7 +2266,7 @@ int32 field::process_single_event() {
starget = elit->trigger_card; starget = elit->trigger_card;
ev = elit->event_code; ev = elit->event_code;
auto pr = starget->single_effect.equal_range(ev); auto pr = starget->single_effect.equal_range(ev);
tevent e = *elit; const tevent& e = *elit;
for(; pr.first != pr.second; ++pr.first) { for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second; peffect = pr.first->second;
if(!(peffect->type & EFFECT_TYPE_ACTIONS)) if(!(peffect->type & EFFECT_TYPE_ACTIONS))
...@@ -2282,10 +2280,10 @@ int32 field::process_single_event() { ...@@ -2282,10 +2280,10 @@ int32 field::process_single_event() {
if((peffect->flag & EFFECT_FLAG_DELAY) && core.chain_solving) { if((peffect->flag & EFFECT_FLAG_DELAY) && core.chain_solving) {
if(owner_player == infos.turn_player) { if(owner_player == infos.turn_player) {
core.delayed_tp.push_back(peffect); core.delayed_tp.push_back(peffect);
core.delayed_tev.push_back(*elit); core.delayed_tev.push_back(e);
} else { } else {
core.delayed_ntp.push_back(peffect); core.delayed_ntp.push_back(peffect);
core.delayed_ntev.push_back(*elit); core.delayed_ntev.push_back(e);
} }
} else { } else {
if(owner_player == infos.turn_player) { if(owner_player == infos.turn_player) {
...@@ -4195,7 +4193,7 @@ int32 field::solve_continuous(uint16 step, effect * peffect, uint8 triggering_pl ...@@ -4195,7 +4193,7 @@ int32 field::solve_continuous(uint16 step, effect * peffect, uint8 triggering_pl
newchain.chain_count = 0; newchain.chain_count = 0;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
newchain.triggering_player = triggering_player; newchain.triggering_player = triggering_player;
newchain.evt = *core.solving_event.begin(); newchain.evt = core.solving_event.front();
newchain.target_cards = 0; newchain.target_cards = 0;
newchain.target_player = PLAYER_NONE; newchain.target_player = PLAYER_NONE;
newchain.target_param = 0; newchain.target_param = 0;
...@@ -4205,7 +4203,7 @@ int32 field::solve_continuous(uint16 step, effect * peffect, uint8 triggering_pl ...@@ -4205,7 +4203,7 @@ int32 field::solve_continuous(uint16 step, effect * peffect, uint8 triggering_pl
core.continuous_chain.push_back(newchain); core.continuous_chain.push_back(newchain);
if(!peffect->target) if(!peffect->target)
return FALSE; return FALSE;
core.sub_solving_event.push_back(*core.solving_event.begin()); core.sub_solving_event.push_back(core.solving_event.front());
add_process(PROCESSOR_EXECUTE_TARGET, 0, peffect, 0, triggering_player, 0); add_process(PROCESSOR_EXECUTE_TARGET, 0, peffect, 0, triggering_player, 0);
return FALSE; return FALSE;
} }
...@@ -4216,15 +4214,14 @@ int32 field::solve_continuous(uint16 step, effect * peffect, uint8 triggering_pl ...@@ -4216,15 +4214,14 @@ int32 field::solve_continuous(uint16 step, effect * peffect, uint8 triggering_pl
if(!peffect->operation) if(!peffect->operation)
return FALSE; return FALSE;
peffect->dec_count(); peffect->dec_count();
core.sub_solving_event.push_back(*core.solving_event.begin()); core.sub_solving_event.push_back(core.solving_event.front());
add_process(PROCESSOR_EXECUTE_OPERATION, 0, peffect, 0, triggering_player, 0); add_process(PROCESSOR_EXECUTE_OPERATION, 0, peffect, 0, triggering_player, 0);
return FALSE; return FALSE;
} }
case 3: { case 3: {
if(core.continuous_chain.rbegin()->target_cards) if(core.continuous_chain.back().target_cards)
pduel->delete_group(core.continuous_chain.rbegin()->target_cards); pduel->delete_group(core.continuous_chain.back().target_cards);
chain::opmap::iterator oit; for(auto oit = core.continuous_chain.back().opinfos.begin(); oit != core.continuous_chain.back().opinfos.end(); ++oit) {
for(oit = core.continuous_chain.rbegin()->opinfos.begin(); oit != core.continuous_chain.rbegin()->opinfos.end(); ++oit) {
if(oit->second.op_cards) if(oit->second.op_cards)
pduel->delete_group(oit->second.op_cards); pduel->delete_group(oit->second.op_cards);
} }
...@@ -4271,8 +4268,11 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4271,8 +4268,11 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
if((peffect->type & EFFECT_TYPE_ACTIVATE) && pcard->is_has_relation(peffect)) { if((peffect->type & EFFECT_TYPE_ACTIVATE) && pcard->is_has_relation(peffect)) {
pcard->set_status(STATUS_ACTIVATED, TRUE); pcard->set_status(STATUS_ACTIVATED, TRUE);
pcard->enable_field_effect(TRUE); pcard->enable_field_effect(TRUE);
if((pcard->data.type & TYPE_FIELD) && player[1 - pcard->current.controler].list_szone[5] && player[1 - pcard->current.controler].list_szone[5]->is_position(POS_FACEUP)) if(pcard->data.type & TYPE_FIELD) {
player[1 - pcard->current.controler].list_szone[5]->enable_field_effect(FALSE); card* fscard = player[1 - pcard->current.controler].list_szone[5];
if(fscard && fscard->is_position(POS_FACEUP))
fscard->enable_field_effect(FALSE);
}
adjust_instant(); adjust_instant();
} }
raise_event((card*)0, EVENT_CHAIN_SOLVING, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count); raise_event((card*)0, EVENT_CHAIN_SOLVING, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count);
...@@ -4347,10 +4347,12 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4347,10 +4347,12 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
if((pcard->data.type & TYPE_EQUIP) && (cait->triggering_effect->type & EFFECT_TYPE_ACTIVATE) if((pcard->data.type & TYPE_EQUIP) && (cait->triggering_effect->type & EFFECT_TYPE_ACTIVATE)
&& !pcard->equiping_target && (pcard->current.location == LOCATION_SZONE)) && !pcard->equiping_target && (pcard->current.location == LOCATION_SZONE))
pcard->set_status(STATUS_LEAVE_CONFIRMED, TRUE); pcard->set_status(STATUS_LEAVE_CONFIRMED, TRUE);
if((pcard->data.type & TYPE_FIELD) && (cait->triggering_effect->type & EFFECT_TYPE_ACTIVATE) && !pcard->is_status(STATUS_LEAVE_CONFIRMED) if((pcard->data.type & TYPE_FIELD) && (cait->triggering_effect->type & EFFECT_TYPE_ACTIVATE)
&& pcard->is_has_relation(cait->triggering_effect) && player[1 - pcard->current.controler].list_szone[5] && !pcard->is_status(STATUS_LEAVE_CONFIRMED) && pcard->is_has_relation(cait->triggering_effect)) {
&& player[1 - pcard->current.controler].list_szone[5]->is_position(POS_FACEUP)) card* fscard = player[1 - pcard->current.controler].list_szone[5];
destroy(player[1 - pcard->current.controler].list_szone[5], 0, REASON_RULE, 1 - pcard->current.controler); if(fscard && fscard->is_position(POS_FACEUP))
destroy(fscard, 0, REASON_RULE, 1 - pcard->current.controler);
}
pcard->release_relation(cait->triggering_effect); pcard->release_relation(cait->triggering_effect);
if(cait->target_cards) if(cait->target_cards)
pduel->delete_group(cait->target_cards); pduel->delete_group(cait->target_cards);
...@@ -4461,6 +4463,7 @@ void field::refresh_location_info_instant() { ...@@ -4461,6 +4463,7 @@ void field::refresh_location_info_instant() {
for (int32 i = 0; i < eset.count; ++i) { for (int32 i = 0; i < eset.count; ++i) {
p = eset[i]->get_handler_player(); p = eset[i]->get_handler_player();
value = eset[i]->get_value(); value = eset[i]->get_value();
player[p].disabled_location |= (value >> 8) & 0x1f00;
} }
int32 dis2 = player[0].disabled_location | (player[1].disabled_location << 16); int32 dis2 = player[0].disabled_location | (player[1].disabled_location << 16);
if(dis1 != dis2) { if(dis1 != dis2) {
...@@ -4669,7 +4672,7 @@ int32 field::adjust_step(uint16 step) { ...@@ -4669,7 +4672,7 @@ int32 field::adjust_step(uint16 step) {
case 1: { case 1: {
//win check //win check
uint32 winp = 5, rea = 1; uint32 winp = 5, rea = 1;
if((player[0].lp <= 0 && player[1].lp > 0)) { if(player[0].lp <= 0 && player[1].lp > 0) {
winp = 1; winp = 1;
rea = 1; rea = 1;
} }
...@@ -4915,7 +4918,7 @@ int32 field::adjust_step(uint16 step) { ...@@ -4915,7 +4918,7 @@ int32 field::adjust_step(uint16 step) {
pduel->write_buffer8(MSG_REVERSE_DECK); pduel->write_buffer8(MSG_REVERSE_DECK);
if(res) { if(res) {
if(player[0].list_main.size()) { if(player[0].list_main.size()) {
card* ptop = *player[0].list_main.rbegin(); card* ptop = player[0].list_main.back();
pduel->write_buffer8(MSG_DECK_TOP); pduel->write_buffer8(MSG_DECK_TOP);
pduel->write_buffer8(0); pduel->write_buffer8(0);
pduel->write_buffer8(0); pduel->write_buffer8(0);
...@@ -4925,7 +4928,7 @@ int32 field::adjust_step(uint16 step) { ...@@ -4925,7 +4928,7 @@ int32 field::adjust_step(uint16 step) {
pduel->write_buffer32(ptop->data.code | 0x80000000); pduel->write_buffer32(ptop->data.code | 0x80000000);
} }
if(player[1].list_main.size()) { if(player[1].list_main.size()) {
card* ptop = *player[1].list_main.rbegin(); card* ptop = player[1].list_main.back();
pduel->write_buffer8(MSG_DECK_TOP); pduel->write_buffer8(MSG_DECK_TOP);
pduel->write_buffer8(1); pduel->write_buffer8(1);
pduel->write_buffer8(0); pduel->write_buffer8(0);
......
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