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

card: add default member initializer #697

Merged
merged 3 commits into from
Dec 12, 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
29 changes: 2 additions & 27 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,34 +143,9 @@ uint32_t card::attacker_map::findcard(card* pcard) {
else
return it->second.second;
}
card::card(duel* pd) {
ref_handle = 0;
pduel = pd;
owner = PLAYER_NONE;
sendto_param.clear();
release_param = 0;
sum_param = 0;
position_param = 0;
spsummon_param = 0;
to_field_param = 0;
direct_attackable = 0;
summon_info = 0;
status = 0;
equiping_target = 0;
pre_equip_target = 0;
overlay_target = 0;
current = {};
previous = {};
spsummon = {};
card::card(duel* pd)
:pduel(pd) {
temp.init_state();
unique_pos[0] = unique_pos[1] = 0;
spsummon_counter[0] = spsummon_counter[1] = 0;
unique_code = 0;
unique_fieldid = 0;
assume_type = 0;
assume_value = 0;
spsummon_code = 0;
xyz_materials_previous_count_onfield = 0;
current.controler = PLAYER_NONE;
}
inline void update_cache(uint32_t tdata, uint32_t& cache, byte*& p, uint32_t& query_flag, uint32_t flag) {
Expand Down
78 changes: 39 additions & 39 deletions card.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,48 +144,48 @@ class card {
uint8_t sequence{ 0 };
};

int32_t ref_handle;
duel* pduel;
int32_t ref_handle{};
duel* pduel{};
card_data data;
card_state previous;
card_state temp;
card_state current;
card_state spsummon;
query_cache q_cache;
uint8_t owner;
uint8_t summon_player;
uint32_t summon_info;
uint32_t status;
uint8_t owner{ PLAYER_NONE };
uint8_t summon_player{ PLAYER_NONE };
uint32_t summon_info{};
uint32_t status{};
sendto_param_t sendto_param;
uint32_t release_param;
uint32_t sum_param;
uint32_t position_param;
uint32_t spsummon_param;
uint32_t to_field_param;
uint8_t attack_announce_count;
uint8_t direct_attackable;
uint8_t announce_count;
uint8_t attacked_count;
uint8_t attack_all_target;
uint8_t attack_controler;
uint16_t cardid;
uint32_t fieldid;
uint32_t fieldid_r;
uint16_t turnid;
uint16_t turn_counter;
uint8_t unique_pos[2];
uint32_t unique_fieldid;
uint32_t unique_code;
uint32_t unique_location;
int32_t unique_function;
effect* unique_effect;
uint32_t spsummon_code;
uint16_t spsummon_counter[2];
uint8_t assume_type;
uint32_t assume_value;
card* equiping_target;
card* pre_equip_target;
card* overlay_target;
uint32_t release_param{};
uint32_t sum_param{};
uint32_t position_param{};
uint32_t spsummon_param{};
uint32_t to_field_param{};
uint8_t attack_announce_count{};
uint8_t direct_attackable{};
uint8_t announce_count{};
uint8_t attacked_count{};
uint8_t attack_all_target{};
uint8_t attack_controler{};
uint16_t cardid{};
uint32_t fieldid{};
uint32_t fieldid_r{};
uint16_t turnid{};
uint16_t turn_counter{};
uint8_t unique_pos[2]{};
uint32_t unique_fieldid{};
uint32_t unique_code{};
uint32_t unique_location{};
int32_t unique_function{};
effect* unique_effect{};
uint32_t spsummon_code{};
uint16_t spsummon_counter[2]{};
uint8_t assume_type{};
uint32_t assume_value{};
card* equiping_target{};
card* pre_equip_target{};
card* overlay_target{};
relation_map relations;
counter_map counters;
effect_count indestructable_effects;
Expand All @@ -197,7 +197,7 @@ class card {
card_set effect_target_owner;
card_set effect_target_cards;
card_vector xyz_materials;
int32_t xyz_materials_previous_count_onfield;
int32_t xyz_materials_previous_count_onfield{};
effect_container single_effect;
effect_container field_effect;
effect_container equip_effect;
Expand Down Expand Up @@ -264,9 +264,9 @@ class card {
int32_t is_link_state();
int32_t is_extra_link_state();
int32_t is_position(uint32_t pos) const;
void set_status(uint32_t status, int32_t enabled);
int32_t get_status(uint32_t status) const;
int32_t is_status(uint32_t status) const;
void set_status(uint32_t x, int32_t enabled);
int32_t get_status(uint32_t x) const;
int32_t is_status(uint32_t x) const;
uint32_t get_column_zone(int32_t location);
void get_column_cards(card_set* cset);
int32_t is_all_column();
Expand Down
4 changes: 2 additions & 2 deletions effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ bool is_continuous_event(uint32_t code) {
return continuous_event.find(code) != continuous_event.end();
}

effect::effect(duel* pd) {
pduel = pd;
effect::effect(duel* pd)
: pduel(pd) {
label.reserve(4);
}
int32_t effect::is_disable_related() const {
Expand Down
4 changes: 2 additions & 2 deletions field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ void chain::set_triggering_state(card* pcard) {
bool tevent::operator< (const tevent& v) const {
return std::memcmp(this, &v, sizeof(tevent)) < 0;
}
field::field(duel* pduel) {
this->pduel = pduel;
field::field(duel* pd)
: pduel(pd) {
for (int32_t i = 0; i < 2; ++i) {
player[i].list_mzone.resize(7, 0);
player[i].list_szone.resize(8, 0);
Expand Down
4 changes: 2 additions & 2 deletions field.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ struct processor {
};
class field {
public:
duel* pduel;
duel* pduel{};
player_info player[2];
card* temp_card{};
field_info infos;
Expand All @@ -373,7 +373,7 @@ class field {
tevent nil_event;

static int32_t field_used_count[32];
explicit field(duel* pduel);
explicit field(duel* pd);
~field() = default;
void reload_field_info();

Expand Down