Commit 0b50a732 authored by DailyShana's avatar DailyShana

Revert "say goodbye to &0xffff"

This reverts commit 38d6ca31.
parent 38d6ca31
...@@ -813,8 +813,8 @@ void field::get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset) { ...@@ -813,8 +813,8 @@ void field::get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset) {
uint8 c = s; uint8 c = s;
for(int32 p = 0; p < 2; ++p) { for(int32 p = 0; p < 2; ++p) {
if(c) { if(c) {
uint32 linked_zone = get_linked_zone(self); uint32 linked_zone = get_linked_zone(self) & 0xffff;
get_cards_in_zone(cset, linked_zone, self, LOCATION_MZONE, false); get_cards_in_zone(cset, linked_zone, self, LOCATION_MZONE);
} }
self = 1 - self; self = 1 - self;
c = o; c = o;
...@@ -877,7 +877,7 @@ int32 field::check_extra_link(int32 playerid, card* pcard, int32 sequence) { ...@@ -877,7 +877,7 @@ int32 field::check_extra_link(int32 playerid, card* pcard, int32 sequence) {
pcard->current.sequence = cur_sequence; pcard->current.sequence = cur_sequence;
return ret; return ret;
} }
void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location, bool oppo) { void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location) {
if(!(location & LOCATION_ONFIELD)) if(!(location & LOCATION_ONFIELD))
return; return;
uint32 icheck; uint32 icheck;
...@@ -892,17 +892,15 @@ void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 ...@@ -892,17 +892,15 @@ void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32
} }
icheck <<= 1; icheck <<= 1;
} }
if(oppo) { card_vector& svector_o = player[1 - playerid].list_mzone;
card_vector& svector_o = player[1 - playerid].list_mzone; icheck = 0x10000;
icheck = 0x10000; for(auto it = svector_o.begin(); it != svector_o.end(); ++it) {
for(auto it = svector_o.begin(); it != svector_o.end(); ++it) { if(zone & icheck) {
if(zone & icheck) { card* pcard = *it;
card* pcard = *it; if(pcard)
if(pcard) cset->insert(pcard);
cset->insert(pcard);
}
icheck <<= 1;
} }
icheck <<= 1;
} }
} }
if(location & LOCATION_SZONE) { if(location & LOCATION_SZONE) {
...@@ -916,17 +914,15 @@ void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 ...@@ -916,17 +914,15 @@ void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32
} }
icheck <<= 1; icheck <<= 1;
} }
if(oppo) { card_vector& svector_o = player[1 - playerid].list_szone;
card_vector& svector_o = player[1 - playerid].list_szone; icheck = 0x1000000;
icheck = 0x1000000; for(auto it = svector_o.begin(); it != svector_o.end(); ++it) {
for(auto it = svector_o.begin(); it != svector_o.end(); ++it) { if(zone & icheck) {
if(zone & icheck) { card* pcard = *it;
card* pcard = *it; if(pcard)
if(pcard) cset->insert(pcard);
cset->insert(pcard);
}
icheck <<= 1;
} }
icheck <<= 1;
} }
} }
} }
...@@ -2639,7 +2635,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 ...@@ -2639,7 +2635,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
card_set linked_cards; card_set linked_cards;
if(ct <= 0) { if(ct <= 0) {
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE, false); get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE);
if(linked_cards.find(tuner) != linked_cards.end()) if(linked_cards.find(tuner) != linked_cards.end())
ct++; ct++;
} }
...@@ -2937,7 +2933,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2937,7 +2933,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
if(ct <= 0) { if(ct <= 0) {
int32 ft = ct; int32 ft = ct;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE, false); get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE);
for(auto cit = core.xmaterial_lst.begin(); cit != core.xmaterial_lst.end(); ++cit) { for(auto cit = core.xmaterial_lst.begin(); cit != core.xmaterial_lst.end(); ++cit) {
card* pcard = cit->second; card* pcard = cit->second;
if(linked_cards.find(pcard) != linked_cards.end()) if(linked_cards.find(pcard) != linked_cards.end())
......
...@@ -374,7 +374,7 @@ public: ...@@ -374,7 +374,7 @@ public:
void get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset); void get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset);
int32 check_extra_link(int32 playerid); int32 check_extra_link(int32 playerid);
int32 check_extra_link(int32 playerid, card* pcard, int32 sequence); int32 check_extra_link(int32 playerid, card* pcard, int32 sequence);
void get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location = 0xc, bool oppo = true); void get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location = 0xc);
void shuffle(uint8 playerid, uint8 location); void shuffle(uint8 playerid, uint8 location);
void reset_sequence(uint8 playerid, uint8 location); void reset_sequence(uint8 playerid, uint8 location);
void swap_deck_and_grave(uint8 playerid); void swap_deck_and_grave(uint8 playerid);
......
...@@ -5067,7 +5067,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in ...@@ -5067,7 +5067,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
} }
card_set linked_cards; card_set linked_cards;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE, false); get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE);
if(linked_cards.find(tuner) != linked_cards.end()) if(linked_cards.find(tuner) != linked_cards.end())
ct++; ct++;
if(smat && linked_cards.find(smat) != linked_cards.end()) if(smat && linked_cards.find(smat) != linked_cards.end())
...@@ -5296,7 +5296,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc ...@@ -5296,7 +5296,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
card_set linked_cards; card_set linked_cards;
if(ct <= 0) { if(ct <= 0) {
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE, false); get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE);
} }
for(auto mit = core.operated_set.begin(); mit != core.operated_set.end(); ++mit) { for(auto mit = core.operated_set.begin(); mit != core.operated_set.end(); ++mit) {
card* pcard = *mit; card* pcard = *mit;
...@@ -5382,7 +5382,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc ...@@ -5382,7 +5382,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
} }
card_set linked_cards; card_set linked_cards;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE, false); get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE);
int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(), int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(),
[=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); }); [=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); });
if(ft > 0) { if(ft > 0) {
...@@ -5565,7 +5565,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc ...@@ -5565,7 +5565,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
return FALSE; return FALSE;
card_set linked_cards; card_set linked_cards;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE, false); get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE);
int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(), int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(),
[=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); }); [=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); });
if(ft > 0) if(ft > 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