Commit f9979a9f authored by VanillaSalt's avatar VanillaSalt

fix

parent ac779bf0
......@@ -113,7 +113,7 @@ int32 effect::is_available() {
status &= ~EFFECT_STATUS_AVAILABLE;
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))
return FALSE;
if((flag & EFFECT_FLAG_COUNT_LIMIT) && (reset_count & 0xf00) == 0)
......@@ -226,7 +226,7 @@ int32 effect::is_action_check(uint8 playerid) {
}
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) {
pduel->lua->add_param(this, PARAM_TYPE_EFFECT);
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
}
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)))
return FALSE;
if(!condition)
......@@ -299,7 +299,7 @@ int32 effect::is_condition_check(uint8 playerid, tevent& e) {
pduel->game_field->core.reason_player = op;
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();
effect* oreason = pduel->game_field->core.reason_effect;
uint8 op = pduel->game_field->core.reason_player;
......
......@@ -62,11 +62,11 @@ public:
int32 is_disable_related();
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_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_condition_check(uint8 playerid, 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_ready(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_condition_check(uint8 playerid, const tevent& e);
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_player(uint8 playerid);
int32 is_player_effect_target(card* pcard);
......
......@@ -512,8 +512,8 @@ void field::shuffle(uint8 playerid, uint8 location) {
pduel->write_buffer8(MSG_SHUFFLE_DECK);
pduel->write_buffer8(playerid);
core.shuffle_deck_check[playerid] = FALSE;
card* ptop = *svector.rbegin();
if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) {
card* ptop = svector.back();
if(core.deck_reversed || (ptop->current.position == POS_FACEUP_DEFENCE)) {
pduel->write_buffer8(MSG_DECK_TOP);
pduel->write_buffer8(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_hand.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
pduel->write_buffer32(0);
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
}
if(location & LOCATION_HAND) {
if(pgroup)
for(auto cit = player[self].list_hand.begin(); cit != player[self].list_hand.end(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(player[self].list_hand.begin(), player[self].list_hand.end());
count += player[self].list_hand.size();
}
if(location & LOCATION_DECK) {
if(pgroup)
for(auto cit = player[self].list_main.rbegin(); cit != player[self].list_main.rend(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(player[self].list_main.rbegin(), player[self].list_main.rend());
count += player[self].list_main.size();
}
if(location & LOCATION_EXTRA) {
if(pgroup)
for(auto cit = player[self].list_extra.rbegin(); cit != player[self].list_extra.rend(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(player[self].list_extra.rbegin(), player[self].list_extra.rend());
count += player[self].list_extra.size();
}
if(location & LOCATION_GRAVE) {
if(pgroup)
for(auto cit = player[self].list_grave.rbegin(); cit != player[self].list_grave.rend(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(player[self].list_grave.rbegin(), player[self].list_grave.rend());
count += player[self].list_grave.size();
}
if(location & LOCATION_REMOVED) {
if(pgroup)
for(auto cit = player[self].list_remove.rbegin(); cit != player[self].list_remove.rend(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(player[self].list_remove.rbegin(), player[self].list_remove.rend());
count += player[self].list_remove.size();
}
location = location2;
......@@ -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) {
pcard = player[self].list_mzone[i];
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(*clit);
pset->insert(pcard->xyz_materials.begin(), pcard->xyz_materials.end());
}
}
self = 1 - self;
......@@ -1403,7 +1397,7 @@ uint32 field::get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype
}
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);
for (; pr.first != pr.second; ++pr.first) {
effect* peffect = pr.first->second;
......@@ -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))
return FALSE;
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;
filter_field_effect(EFFECT_TO_GRAVE_REDIRECT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
......
......@@ -350,7 +350,7 @@ public:
int32 pay_lp_cost(uint32 step, uint8 playerid, uint32 cost);
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);
void attack_all_target_check();
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) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
group* pgroup = pcard->pduel->new_group();
card::card_set::iterator cit;
for(cit = pcard->material_cards.begin(); cit != pcard->material_cards.end(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(pcard->material_cards.begin(), pcard->material_cards.end());
interpreter::group2value(L, pgroup);
return 1;
}
......@@ -543,9 +541,7 @@ int32 scriptlib::card_get_equip_group(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
group* pgroup = pcard->pduel->new_group();
card::card_set::iterator cit;
for(cit = pcard->equiping_cards.begin(); cit != pcard->equiping_cards.end(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(pcard->equiping_cards.begin(), pcard->equiping_cards.end());
interpreter::group2value(L, pgroup);
return 1;
}
......@@ -595,8 +591,7 @@ int32 scriptlib::card_get_overlay_group(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
group* pgroup = pcard->pduel->new_group();
for(auto cit = pcard->xyz_materials.begin(); cit != pcard->xyz_materials.end(); ++cit)
pgroup->container.insert(*cit);
pgroup->container.insert(pcard->xyz_materials.begin(), pcard->xyz_materials.end());
interpreter::group2value(L, pgroup);
return 1;
}
......@@ -1914,8 +1909,7 @@ int32 scriptlib::card_get_attackable_target(lua_State *L) {
field::card_vector targets;
pduel->game_field->get_attack_target(pcard, &targets);
group* newgroup = pduel->new_group();
for(auto cit = targets.begin(); cit != targets.end(); ++cit)
newgroup->container.insert(*cit);
newgroup->container.insert(targets.begin(), targets.end());
interpreter::group2value(L, newgroup);
lua_pushboolean(L, pcard->operation_param);
return 2;
......
......@@ -182,7 +182,7 @@ int32 scriptlib::group_filter_count(lua_State *L) {
if((*it) != pexception && pduel->lua->check_matching(*it, 2, extraargs))
count++;
}
lua_pushinteger(L, count);;
lua_pushinteger(L, count);
return 1;
}
int32 scriptlib::group_filter_select(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;
}
int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
......@@ -492,10 +492,7 @@ int32 scriptlib::group_merge(lua_State *L) {
group* mgroup = *(group**) lua_touserdata(L, 2);
if(pgroup->is_readonly == 1)
return 0;
group::card_set::iterator cit;
for (cit = mgroup->container.begin(); cit != mgroup->container.end(); ++cit) {
pgroup->container.insert(*cit);
}
pgroup->container.insert(mgroup->container.begin(), mgroup->container.end());
return 0;
}
int32 scriptlib::group_sub(lua_State *L) {
......
......@@ -733,7 +733,7 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8
tevent e;
e.event_cards = 0;
e.event_player = rplayer;
e.event_value = min + (max << 16);;
e.event_value = min + (max << 16);
e.reason = reason;
e.reason_effect = core.reason_effect;
e.reason_player = rplayer;
......@@ -990,10 +990,8 @@ int32 field::control_adjust(uint16 step) {
pduel->write_buffer8(pcard1->current.sequence);
pduel->write_buffer8(pcard1->current.position);
}
while(cit1 != core.control_adjust_set[0].end())
core.operated_set.insert(*cit1++);
while(cit2 != core.control_adjust_set[1].end())
core.operated_set.insert(*cit2++);
core.operated_set.insert(cit1, core.control_adjust_set[0].end());
core.operated_set.insert(cit2, core.control_adjust_set[1].end());
return FALSE;
}
case 3: {
......@@ -1004,11 +1002,11 @@ int32 field::control_adjust(uint16 step) {
core.operated_set.erase(cit);
pcard->reset(RESET_CONTROL, RESET_EVENT);
move_to_field(pcard, 1 - pcard->current.controler, 1 - pcard->current.controler, LOCATION_MZONE, pcard->current.position);
core.units.begin()->step = 2;
return FALSE;
}
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(*cit);
core.control_adjust_set[0].insert(core.control_adjust_set[1].begin(), core.control_adjust_set[1].end());
for(auto cit = core.control_adjust_set[0].begin(); cit != core.control_adjust_set[0].end(); ++cit) {
(*cit)->filter_disable_related_cards();
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) {
int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_player, group * targets) {
switch(step) {
case 0: {
card_vector cv;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
card_vector cv(targets->container.begin(), targets->container.end());
if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for(auto cvit = cv.begin(); cvit != cv.end(); ++cvit)
......@@ -2340,9 +2336,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
pduel->delete_group(targets);
return TRUE;
}
card_vector cv;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
card_vector cv(targets->container.begin(), targets->container.end());
if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for (auto cvit = cv.begin(); cvit != cv.end(); ++cvit) {
......@@ -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) {
switch (step) {
case 0: {
card_set extra;
//card_set extra;
for (auto cit = targets->container.begin(); cit != targets->container.end();) {
auto rm = cit++;
card* pcard = *rm;
......@@ -2537,9 +2531,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3
pduel->delete_group(targets);
return TRUE;
}
card_vector cv;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
card_vector cv(targets->container.begin(), targets->container.end());
if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort);
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
card_set leave, discard, detach;
uint8 oloc, playerid, dest, seq;
bool show_decktop[2] = {false, false};
card_vector cv;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
card_vector cv(targets->container.begin(), targets->container.end());
if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort);
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
}
if(target->xyz_materials.size()) {
card_set overlays;
for(auto clit = target->xyz_materials.begin(); clit != target->xyz_materials.end(); ++clit)
overlays.insert(*clit);
overlays.insert(target->xyz_materials.begin(), target->xyz_materials.end());
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
int32 field::change_position(uint16 step, group * targets, effect * reason_effect, uint8 reason_player, uint32 enable) {
switch(step) {
case 0: {
card_set::iterator cit;
card_set equipings;
card_set flips;
card_set pos_changed;
uint8 npos, opos, noflip;
card_vector cv;
card_vector::iterator cvit;
for(cit = targets->container.begin(); cit != targets->container.end(); ++cit)
cv.push_back(*cit);
card_vector cv(targets->container.begin(), targets->container.end());
if(cv.size() > 1)
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;
npos = pcard->operation_param & 0xff;
opos = pcard->current.position;
......
This diff is collapsed.
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