Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use nullptr #662

Merged
merged 2 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ bool card::card_operation_sort(card* c1, card* c2) {
return c1->current.sequence < c2->current.sequence;
}
}
bool card::check_card_setcode(uint32 code, uint32 value) {
card_data dat;
::read_card(code, &dat);
return dat.is_setcode(value);
}
void card::attacker_map::addcard(card* pcard) {
auto fid = pcard ? pcard->fieldid_r : 0;
auto pr = emplace(fid, std::make_pair(pcard, 0));
Expand Down Expand Up @@ -488,11 +493,6 @@ inline bool check_setcode(uint16_t setcode, uint32 value) {
uint32 setsubtype = value & 0xf000U;
return (setcode & 0x0fffU) == settype && (setcode & 0xf000U & setsubtype) == setsubtype;
}
bool card::check_card_setcode(uint32 code, uint32 value) {
card_data dat;
::read_card(code, &dat);
return dat.is_setcode(value);
}
int32 card::is_set_card(uint32 set_code) {
uint32 code1 = get_code();
card_data dat1;
Expand Down
2 changes: 1 addition & 1 deletion card.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class card {
explicit card(duel* pd);
~card() = default;
static bool card_operation_sort(card* c1, card* c2);
static bool check_card_setcode(uint32 code, uint32 value);
bool is_extra_deck_monster() const { return !!(data.type & TYPES_EXTRA_DECK); }

int32 get_infos(byte* buf, uint32 query_flag, int32 use_cache = TRUE);
Expand All @@ -227,7 +228,6 @@ class card {
std::tuple<uint32, uint32> get_original_code_rule() const;
uint32 get_code();
uint32 get_another_code();
static bool check_card_setcode(uint32 code, uint32 value);
int32 is_set_card(uint32 set_code);
int32 is_origin_set_card(uint32 set_code);
int32 is_pre_set_card(uint32 set_code);
Expand Down
4 changes: 2 additions & 2 deletions libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ int32 scriptlib::duel_get_mzone_count(lua_State *L) {
used_location[p] |= digit;
list_mzone[p].push_back(pcard);
} else
list_mzone[p].push_back(0);
list_mzone[p].push_back(nullptr);
digit <<= 1;
}
used_location[p] |= pduel->game_field->player[p].used_location & 0xff00;
Expand Down Expand Up @@ -2049,7 +2049,7 @@ int32 scriptlib::duel_get_location_count_fromex(lua_State *L) {
used_location[p] |= digit;
list_mzone[p].push_back(pcard);
} else
list_mzone[p].push_back(0);
list_mzone[p].push_back(nullptr);
digit <<= 1;
}
used_location[p] |= pduel->game_field->player[p].used_location & 0xff00;
Expand Down
10 changes: 5 additions & 5 deletions operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost, uint32 must_p
core.select_effects.clear();
if(val <= player[playerid].lp) {
core.select_options.push_back(11);
core.select_effects.push_back(0);
core.select_effects.push_back(nullptr);
}
if(must_pay) {
if(core.select_options.size() == 0)
Expand Down Expand Up @@ -786,7 +786,7 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8
core.select_effects.clear();
if((pcard && (int32)pcard->xyz_materials.size() >= min) || (!pcard && get_overlay_count(rplayer, s, o) >= min)) {
core.select_options.push_back(12);
core.select_effects.push_back(0);
core.select_effects.push_back(nullptr);
}
auto pr = effects.continuous_effect.equal_range(EFFECT_OVERLAY_REMOVE_REPLACE);
tevent e;
Expand Down Expand Up @@ -1529,7 +1529,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
core.select_effects.clear();
core.select_options.clear();
if(ignore_count || core.summon_count[sumplayer] < get_summon_count_limit(sumplayer)) {
core.select_effects.push_back(0);
core.select_effects.push_back(nullptr);
core.select_options.push_back(1);
}
if(!ignore_count && !core.extra_summon[sumplayer]) {
Expand Down Expand Up @@ -2104,7 +2104,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
core.select_effects.clear();
core.select_options.clear();
if(res > 0) {
core.select_effects.push_back(0);
core.select_effects.push_back(nullptr);
core.select_options.push_back(1);
}
for(int32 i = 0; i < eset.size(); ++i) {
Expand All @@ -2129,7 +2129,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
core.select_effects.clear();
core.select_options.clear();
if(ignore_count || core.summon_count[setplayer] < get_summon_count_limit(setplayer)) {
core.select_effects.push_back(0);
core.select_effects.push_back(nullptr);
core.select_options.push_back(1);
}
if(!ignore_count && !core.extra_summon[setplayer]) {
Expand Down