Commit d8510201 authored by fallenstardust's avatar fallenstardust

sync ocgcore

parent eea64f9f
...@@ -172,17 +172,17 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -172,17 +172,17 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
query_flag &= ~QUERY_EQUIP_CARD; query_flag &= ~QUERY_EQUIP_CARD;
} }
if(query_flag & QUERY_TARGET_CARD) { if(query_flag & QUERY_TARGET_CARD) {
*p++ = effect_target_cards.size(); *p++ = (int32)effect_target_cards.size();
for(auto& pcard : effect_target_cards) for(auto& pcard : effect_target_cards)
*p++ = pcard->get_info_location(); *p++ = pcard->get_info_location();
} }
if(query_flag & QUERY_OVERLAY_CARD) { if(query_flag & QUERY_OVERLAY_CARD) {
*p++ = xyz_materials.size(); *p++ = (int32)xyz_materials.size();
for(auto& xcard : xyz_materials) for(auto& xcard : xyz_materials)
*p++ = xcard->data.code; *p++ = xcard->data.code;
} }
if(query_flag & QUERY_COUNTERS) { if(query_flag & QUERY_COUNTERS) {
*p++ = counters.size(); *p++ = (int32)counters.size();
for(const auto& cmit : counters) for(const auto& cmit : counters)
*p++ = cmit.first + ((cmit.second[0] + cmit.second[1]) << 16); *p++ = cmit.first + ((cmit.second[0] + cmit.second[1]) << 16);
} }
...@@ -223,7 +223,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -223,7 +223,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
} else query_flag &= ~QUERY_LINK; } else query_flag &= ~QUERY_LINK;
} }
} }
*(uint32*)buf = (byte*)p - buf; *(uint32*)buf = (uint32)((byte*)p - buf);
#ifdef _IRR_ANDROID_PLATFORM_ #ifdef _IRR_ANDROID_PLATFORM_
memcpy(buf + 4, &query_flag, sizeof(uint32)); memcpy(buf + 4, &query_flag, sizeof(uint32));
#else #else
...@@ -513,7 +513,7 @@ int32 card::get_base_attack() { ...@@ -513,7 +513,7 @@ int32 card::get_base_attack() {
eset.sort(); eset.sort();
// calculate continuous effects of this first // calculate continuous effects of this first
for(int32 i = 0; i < eset.size();) { for(int32 i = 0; i < eset.size();) {
if((eset[i]->type & EFFECT_TYPE_SINGLE) && eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) { if(!(eset[i]->type & EFFECT_TYPE_SINGLE) || eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) {
switch(eset[i]->code) { switch(eset[i]->code) {
case EFFECT_SET_BASE_ATTACK: case EFFECT_SET_BASE_ATTACK:
batk = eset[i]->get_value(this); batk = eset[i]->get_value(this);
...@@ -577,7 +577,6 @@ int32 card::get_attack() { ...@@ -577,7 +577,6 @@ int32 card::get_attack() {
filter_effect(EFFECT_UPDATE_ATTACK, &eset, FALSE); filter_effect(EFFECT_UPDATE_ATTACK, &eset, FALSE);
filter_effect(EFFECT_SET_ATTACK, &eset, FALSE); filter_effect(EFFECT_SET_ATTACK, &eset, FALSE);
filter_effect(EFFECT_SET_ATTACK_FINAL, &eset, FALSE); filter_effect(EFFECT_SET_ATTACK_FINAL, &eset, FALSE);
filter_effect(EFFECT_SWAP_ATTACK_FINAL, &eset, FALSE);
filter_effect(EFFECT_SET_BASE_ATTACK, &eset, FALSE); filter_effect(EFFECT_SET_BASE_ATTACK, &eset, FALSE);
if(!(data.type & TYPE_LINK)) { if(!(data.type & TYPE_LINK)) {
filter_effect(EFFECT_SWAP_AD, &eset, FALSE); filter_effect(EFFECT_SWAP_AD, &eset, FALSE);
...@@ -590,7 +589,7 @@ int32 card::get_attack() { ...@@ -590,7 +589,7 @@ int32 card::get_attack() {
rev = TRUE; rev = TRUE;
effect_set effects_atk, effects_atk_r; effect_set effects_atk, effects_atk_r;
for(int32 i = 0; i < eset.size();) { for(int32 i = 0; i < eset.size();) {
if((eset[i]->type & EFFECT_TYPE_SINGLE) && eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) { if(!(eset[i]->type & EFFECT_TYPE_SINGLE) || eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) {
switch(eset[i]->code) { switch(eset[i]->code) {
case EFFECT_SET_BASE_ATTACK: case EFFECT_SET_BASE_ATTACK:
batk = eset[i]->get_value(this); batk = eset[i]->get_value(this);
...@@ -641,11 +640,6 @@ int32 card::get_attack() { ...@@ -641,11 +640,6 @@ int32 card::get_attack() {
batk = 0; batk = 0;
atk = -1; atk = -1;
break; break;
case EFFECT_SWAP_ATTACK_FINAL:
atk = eset[i]->get_value(this);
up_atk = 0;
upc_atk = 0;
break;
case EFFECT_SET_BASE_DEFENSE: case EFFECT_SET_BASE_DEFENSE:
bdef = eset[i]->get_value(this); bdef = eset[i]->get_value(this);
if(bdef < 0) if(bdef < 0)
...@@ -710,7 +704,7 @@ int32 card::get_base_defense() { ...@@ -710,7 +704,7 @@ int32 card::get_base_defense() {
filter_effect(EFFECT_SET_BASE_ATTACK, &eset, FALSE); filter_effect(EFFECT_SET_BASE_ATTACK, &eset, FALSE);
eset.sort(); eset.sort();
for(int32 i = 0; i < eset.size();) { for(int32 i = 0; i < eset.size();) {
if((eset[i]->type & EFFECT_TYPE_SINGLE) && eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) { if(!(eset[i]->type & EFFECT_TYPE_SINGLE) || eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) {
switch(eset[i]->code) { switch(eset[i]->code) {
case EFFECT_SET_BASE_ATTACK: case EFFECT_SET_BASE_ATTACK:
batk = eset[i]->get_value(this); batk = eset[i]->get_value(this);
...@@ -777,7 +771,6 @@ int32 card::get_defense() { ...@@ -777,7 +771,6 @@ int32 card::get_defense() {
filter_effect(EFFECT_UPDATE_DEFENSE, &eset, FALSE); filter_effect(EFFECT_UPDATE_DEFENSE, &eset, FALSE);
filter_effect(EFFECT_SET_DEFENSE, &eset, FALSE); filter_effect(EFFECT_SET_DEFENSE, &eset, FALSE);
filter_effect(EFFECT_SET_DEFENSE_FINAL, &eset, FALSE); filter_effect(EFFECT_SET_DEFENSE_FINAL, &eset, FALSE);
filter_effect(EFFECT_SWAP_DEFENSE_FINAL, &eset, FALSE);
filter_effect(EFFECT_SWAP_BASE_AD, &eset, FALSE); filter_effect(EFFECT_SWAP_BASE_AD, &eset, FALSE);
filter_effect(EFFECT_SET_BASE_ATTACK, &eset, FALSE); filter_effect(EFFECT_SET_BASE_ATTACK, &eset, FALSE);
filter_effect(EFFECT_SET_BASE_DEFENSE, &eset, FALSE); filter_effect(EFFECT_SET_BASE_DEFENSE, &eset, FALSE);
...@@ -787,7 +780,7 @@ int32 card::get_defense() { ...@@ -787,7 +780,7 @@ int32 card::get_defense() {
rev = TRUE; rev = TRUE;
effect_set effects_def, effects_def_r; effect_set effects_def, effects_def_r;
for(int32 i = 0; i < eset.size();) { for(int32 i = 0; i < eset.size();) {
if((eset[i]->type & EFFECT_TYPE_SINGLE) && eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) { if(!(eset[i]->type & EFFECT_TYPE_SINGLE) || eset[i]->is_flag(EFFECT_FLAG_SINGLE_RANGE)) {
switch(eset[i]->code) { switch(eset[i]->code) {
case EFFECT_SET_BASE_ATTACK: case EFFECT_SET_BASE_ATTACK:
batk = eset[i]->get_value(this); batk = eset[i]->get_value(this);
...@@ -838,11 +831,6 @@ int32 card::get_defense() { ...@@ -838,11 +831,6 @@ int32 card::get_defense() {
bdef = 0; bdef = 0;
def = -1; def = -1;
break; break;
case EFFECT_SWAP_DEFENSE_FINAL:
def = eset[i]->get_value(this);
up_def = 0;
upc_def = 0;
break;
case EFFECT_SET_BASE_ATTACK: case EFFECT_SET_BASE_ATTACK:
batk = eset[i]->get_value(this); batk = eset[i]->get_value(this);
if(batk < 0) if(batk < 0)
...@@ -1481,7 +1469,7 @@ void card::xyz_add(card* mat, card_set* des) { ...@@ -1481,7 +1469,7 @@ void card::xyz_add(card* mat, card_set* des) {
mat->overlay_target = this; mat->overlay_target = this;
mat->current.controler = PLAYER_NONE; mat->current.controler = PLAYER_NONE;
mat->current.location = LOCATION_OVERLAY; mat->current.location = LOCATION_OVERLAY;
mat->current.sequence = xyz_materials.size() - 1; mat->current.sequence = (uint8)xyz_materials.size() - 1;
mat->current.reason = REASON_XYZ + REASON_MATERIAL; mat->current.reason = REASON_XYZ + REASON_MATERIAL;
for(auto& eit : mat->xmaterial_effect) { for(auto& eit : mat->xmaterial_effect) {
effect* peffect = eit.second; effect* peffect = eit.second;
...@@ -1502,7 +1490,7 @@ void card::xyz_remove(card* mat) { ...@@ -1502,7 +1490,7 @@ void card::xyz_remove(card* mat) {
mat->current.sequence = 0; mat->current.sequence = 0;
mat->overlay_target = 0; mat->overlay_target = 0;
for(auto clit = xyz_materials.begin(); clit != xyz_materials.end(); ++clit) for(auto clit = xyz_materials.begin(); clit != xyz_materials.end(); ++clit)
(*clit)->current.sequence = clit - xyz_materials.begin(); (*clit)->current.sequence = (uint8)(clit - xyz_materials.begin());
for(auto& eit : mat->xmaterial_effect) { for(auto& eit : mat->xmaterial_effect) {
effect* peffect = eit.second; effect* peffect = eit.second;
if(peffect->type & EFFECT_TYPE_FIELD) if(peffect->type & EFFECT_TYPE_FIELD)
...@@ -1915,7 +1903,8 @@ void card::reset(uint32 id, uint32 reset_type) { ...@@ -1915,7 +1903,8 @@ void card::reset(uint32 id, uint32 reset_type) {
} }
} }
if(id & RESET_TURN_SET) { if(id & RESET_TURN_SET) {
if(effect* peffect = check_control_effect()) { effect* peffect = std::get<effect*>(refresh_control_status());
if(peffect && (!(peffect->type & EFFECT_TYPE_SINGLE) || peffect->condition)) {
effect* new_effect = pduel->new_effect(); effect* new_effect = pduel->new_effect();
new_effect->id = peffect->id; new_effect->id = peffect->id;
new_effect->owner = this; new_effect->owner = this;
...@@ -1968,8 +1957,9 @@ void card::refresh_disable_status() { ...@@ -1968,8 +1957,9 @@ void card::refresh_disable_status() {
if(pre_dis != cur_dis) if(pre_dis != cur_dis)
filter_immune_effect(); filter_immune_effect();
} }
uint8 card::refresh_control_status() { std::tuple<uint8, effect*> card::refresh_control_status() {
uint8 final = owner; uint8 final = owner;
effect* ceffect = nullptr;
uint32 last_id = 0; uint32 last_id = 0;
if(pduel->game_field->core.remove_brainwashing && is_affected_by_effect(EFFECT_REMOVE_BRAINWASHING)) if(pduel->game_field->core.remove_brainwashing && is_affected_by_effect(EFFECT_REMOVE_BRAINWASHING))
last_id = pduel->game_field->core.last_control_changed_id; last_id = pduel->game_field->core.last_control_changed_id;
...@@ -1978,18 +1968,11 @@ uint8 card::refresh_control_status() { ...@@ -1978,18 +1968,11 @@ uint8 card::refresh_control_status() {
if(eset.size()) { if(eset.size()) {
effect* peffect = eset.get_last(); effect* peffect = eset.get_last();
if(peffect->id >= last_id) { if(peffect->id >= last_id) {
card* pcard = peffect->get_handler(); final = (uint8)peffect->get_value(this);
uint8 val = (uint8)peffect->get_value(this); ceffect = peffect;
if(val != current.controler)
pduel->game_field->core.readjust_map[pcard]++;
if(pduel->game_field->core.readjust_map[pcard] > 5) {
pduel->game_field->send_to(pcard, 0, REASON_RULE, peffect->get_handler_player(), PLAYER_NONE, LOCATION_GRAVE, 0, POS_FACEUP);
return final;
} }
final = val;
} }
} return std::make_tuple(final, ceffect);
return final;
} }
void card::count_turn(uint16 ct) { void card::count_turn(uint16 ct) {
turn_counter = ct; turn_counter = ct;
...@@ -2734,54 +2717,6 @@ effect* card::is_affected_by_effect(int32 code, card* target) { ...@@ -2734,54 +2717,6 @@ effect* card::is_affected_by_effect(int32 code, card* target) {
} }
return 0; return 0;
} }
effect* card::check_control_effect() {
effect* ret_effect = 0;
for (auto& pcard : equiping_cards) {
auto rg = pcard->equip_effect.equal_range(EFFECT_SET_CONTROL);
for (; rg.first != rg.second; ++rg.first) {
effect* peffect = rg.first->second;
if(!ret_effect || peffect->id > ret_effect->id)
ret_effect = peffect;
}
}
for (auto& pcard : effect_target_owner) {
auto rg = pcard->target_effect.equal_range(EFFECT_SET_CONTROL);
for (; rg.first != rg.second; ++rg.first) {
effect* peffect = rg.first->second;
if(!ret_effect || peffect->is_target(pcard) && peffect->id > ret_effect->id)
ret_effect = peffect;
}
}
for (auto& pcard : xyz_materials) {
auto rg = pcard->xmaterial_effect.equal_range(EFFECT_SET_CONTROL);
for (; rg.first != rg.second; ++rg.first) {
effect* peffect = rg.first->second;
if (peffect->type & EFFECT_TYPE_FIELD)
continue;
if(!ret_effect || peffect->id > ret_effect->id)
ret_effect = peffect;
}
}
auto rg = single_effect.equal_range(EFFECT_SET_CONTROL);
for (; rg.first != rg.second; ++rg.first) {
effect* peffect = rg.first->second;
if(!peffect->condition)
continue;
if(!ret_effect || peffect->id > ret_effect->id)
ret_effect = peffect;
}
/*
rg = pduel->game_field->effects.aura_effect.equal_range(EFFECT_SET_CONTROL);
for(; rg.first != rg.second; ++rg.first) {
effect* peffect = rg.first->second;
if(peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET) || !peffect->is_target(this))
continue;
if(!ret_effect || peffect->id > ret_effect->id)
ret_effect = peffect;
}
*/
return ret_effect;
}
int32 card::fusion_check(group* fusion_m, card* cg, uint32 chkf, uint8 not_material) { int32 card::fusion_check(group* fusion_m, card* cg, uint32 chkf, uint8 not_material) {
group* matgroup = 0; group* matgroup = 0;
if(fusion_m && !not_material) { if(fusion_m && !not_material) {
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <map> #include <map>
#include <unordered_set> #include <unordered_set>
#include <unordered_map> #include <unordered_map>
#include <tuple>
class card; class card;
class duel; class duel;
...@@ -93,14 +94,14 @@ public: ...@@ -93,14 +94,14 @@ public:
return std::hash<uint16>()(v.second); return std::hash<uint16>()(v.second);
} }
}; };
typedef std::vector<card*> card_vector; using card_vector = std::vector<card*>;
typedef std::multimap<uint32, effect*> effect_container; using effect_container = std::multimap<uint32, effect*>;
typedef std::set<card*, card_sort> card_set; using card_set = std::set<card*, card_sort>;
typedef std::unordered_map<effect*, effect_container::iterator> effect_indexer; using effect_indexer = std::unordered_map<effect*, effect_container::iterator>;
typedef std::unordered_set<std::pair<effect*, uint16>, effect_relation_hash> effect_relation; using effect_relation = std::unordered_set<std::pair<effect*, uint16>, effect_relation_hash>;
typedef std::unordered_map<card*, uint32> relation_map; using relation_map = std::unordered_map<card*, uint32>;
typedef std::map<uint16, std::array<uint16, 2>> counter_map; using counter_map = std::map<uint16, std::array<uint16, 2>>;
typedef std::map<uint32, int32> effect_count; using effect_count = std::map<uint32, int32>;
class attacker_map : public std::unordered_map<uint16, std::pair<card*, uint32>> { class attacker_map : public std::unordered_map<uint16, std::pair<card*, uint32>> {
public: public:
void addcard(card* pcard); void addcard(card* pcard);
...@@ -257,7 +258,7 @@ public: ...@@ -257,7 +258,7 @@ public:
void reset(uint32 id, uint32 reset_type); void reset(uint32 id, uint32 reset_type);
void reset_effect_count(); void reset_effect_count();
void refresh_disable_status(); void refresh_disable_status();
uint8 refresh_control_status(); std::tuple<uint8, effect*> refresh_control_status();
void count_turn(uint16 ct); void count_turn(uint16 ct);
void create_relation(card* target, uint32 reset); void create_relation(card* target, uint32 reset);
...@@ -294,7 +295,6 @@ public: ...@@ -294,7 +295,6 @@ public:
void filter_spsummon_procedure_g(uint8 playerid, effect_set* eset); void filter_spsummon_procedure_g(uint8 playerid, effect_set* eset);
effect* is_affected_by_effect(int32 code); effect* is_affected_by_effect(int32 code);
effect* is_affected_by_effect(int32 code, card* target); effect* is_affected_by_effect(int32 code, card* target);
effect* check_control_effect();
int32 fusion_check(group* fusion_m, card* cg, uint32 chkf, uint8 not_material); int32 fusion_check(group* fusion_m, card* cg, uint32 chkf, uint8 not_material);
void fusion_select(uint8 playerid, group* fusion_m, card* cg, uint32 chkf, uint8 not_material); void fusion_select(uint8 playerid, group* fusion_m, card* cg, uint32 chkf, uint8 not_material);
int32 check_fusion_substitute(card* fcard); int32 check_fusion_substitute(card* fcard);
......
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
#ifndef COMMON_H_ #ifndef COMMON_H_
#define COMMON_H_ #define COMMON_H_
#ifdef _MSC_VER
#pragma warning(disable: 4244)
#endif
typedef unsigned long uptr; typedef unsigned long uptr;
typedef unsigned long long uint64; typedef unsigned long long uint64;
typedef unsigned int uint32; typedef unsigned int uint32;
......
...@@ -21,7 +21,7 @@ class interpreter; ...@@ -21,7 +21,7 @@ class interpreter;
class duel { class duel {
public: public:
typedef std::set<card*, card_sort> card_set; using card_set = std::set<card*, card_sort>;
char strbuffer[256]; char strbuffer[256];
byte buffer[0x1000]; byte buffer[0x1000];
uint32 bufferlen; uint32 bufferlen;
......
...@@ -270,8 +270,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con ...@@ -270,8 +270,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
if(phandler->is_position(POS_FACEUP) && !phandler->is_status(STATUS_EFFECT_ENABLED)) if(phandler->is_position(POS_FACEUP) && !phandler->is_status(STATUS_EFFECT_ENABLED))
return FALSE; return FALSE;
} }
if(!(type & (EFFECT_TYPE_FLIP | EFFECT_TYPE_TRIGGER_F)) if(!(type & (EFFECT_TYPE_FLIP | EFFECT_TYPE_TRIGGER_F)) && !((type & EFFECT_TYPE_TRIGGER_O) && (type & EFFECT_TYPE_SINGLE))) {
&& !((type & EFFECT_TYPE_SINGLE) && (code == EVENT_TO_GRAVE || code == EVENT_DESTROYED || code == EVENT_SPSUMMON_SUCCESS || code == EVENT_TO_HAND || code == EVENT_REMOVE || code == EVENT_FLIP))) {
if((code < 1132 || code > 1149) && pduel->game_field->infos.phase == PHASE_DAMAGE && !is_flag(EFFECT_FLAG_DAMAGE_STEP)) if((code < 1132 || code > 1149) && pduel->game_field->infos.phase == PHASE_DAMAGE && !is_flag(EFFECT_FLAG_DAMAGE_STEP))
return FALSE; return FALSE;
if((code < 1134 || code > 1136) && pduel->game_field->infos.phase == PHASE_DAMAGE_CAL && !is_flag(EFFECT_FLAG_DAMAGE_CAL)) if((code < 1134 || code > 1136) && pduel->game_field->infos.phase == PHASE_DAMAGE_CAL && !is_flag(EFFECT_FLAG_DAMAGE_CAL))
......
...@@ -301,8 +301,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -301,8 +301,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_REVERSE_UPDATE 108 // #define EFFECT_REVERSE_UPDATE 108 //
#define EFFECT_SWAP_AD 109 // #define EFFECT_SWAP_AD 109 //
#define EFFECT_SWAP_BASE_AD 110 // #define EFFECT_SWAP_BASE_AD 110 //
#define EFFECT_SWAP_ATTACK_FINAL 111 //#define EFFECT_SWAP_ATTACK_FINAL 111
#define EFFECT_SWAP_DEFENSE_FINAL 112 //#define EFFECT_SWAP_DEFENSE_FINAL 112
#define EFFECT_ADD_CODE 113 // #define EFFECT_ADD_CODE 113 //
#define EFFECT_CHANGE_CODE 114 // #define EFFECT_CHANGE_CODE 114 //
#define EFFECT_ADD_TYPE 115 // #define EFFECT_ADD_TYPE 115 //
......
...@@ -133,7 +133,7 @@ void field::reload_field_info() { ...@@ -133,7 +133,7 @@ void field::reload_field_info() {
if(pcard) { if(pcard) {
pduel->write_buffer8(1); pduel->write_buffer8(1);
pduel->write_buffer8(pcard->current.position); pduel->write_buffer8(pcard->current.position);
pduel->write_buffer8(pcard->xyz_materials.size()); pduel->write_buffer8((uint8)pcard->xyz_materials.size());
} else { } else {
pduel->write_buffer8(0); pduel->write_buffer8(0);
} }
...@@ -146,14 +146,14 @@ void field::reload_field_info() { ...@@ -146,14 +146,14 @@ void field::reload_field_info() {
pduel->write_buffer8(0); pduel->write_buffer8(0);
} }
} }
pduel->write_buffer8(player[playerid].list_main.size()); pduel->write_buffer8((uint8)player[playerid].list_main.size());
pduel->write_buffer8(player[playerid].list_hand.size()); pduel->write_buffer8((uint8)player[playerid].list_hand.size());
pduel->write_buffer8(player[playerid].list_grave.size()); pduel->write_buffer8((uint8)player[playerid].list_grave.size());
pduel->write_buffer8(player[playerid].list_remove.size()); pduel->write_buffer8((uint8)player[playerid].list_remove.size());
pduel->write_buffer8(player[playerid].list_extra.size()); pduel->write_buffer8((uint8)player[playerid].list_extra.size());
pduel->write_buffer8(player[playerid].extra_p_count); pduel->write_buffer8((uint8)player[playerid].extra_p_count);
} }
pduel->write_buffer8(core.current_chain.size()); pduel->write_buffer8((uint8)core.current_chain.size());
for(const auto& ch : core.current_chain) { for(const auto& ch : core.current_chain) {
effect* peffect = ch.triggering_effect; effect* peffect = ch.triggering_effect;
pduel->write_buffer32(peffect->get_handler()->data.code); pduel->write_buffer32(peffect->get_handler()->data.code);
...@@ -191,13 +191,13 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -191,13 +191,13 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
case LOCATION_DECK: { case LOCATION_DECK: {
if (sequence == 0) { //deck top if (sequence == 0) { //deck top
player[playerid].list_main.push_back(pcard); player[playerid].list_main.push_back(pcard);
pcard->current.sequence = player[playerid].list_main.size() - 1; pcard->current.sequence = (uint8)player[playerid].list_main.size() - 1;
} else if (sequence == 1) { //deck bottom } else if (sequence == 1) { //deck bottom
player[playerid].list_main.insert(player[playerid].list_main.begin(), pcard); player[playerid].list_main.insert(player[playerid].list_main.begin(), pcard);
reset_sequence(playerid, LOCATION_DECK); reset_sequence(playerid, LOCATION_DECK);
} else { //deck top & shuffle } else { //deck top & shuffle
player[playerid].list_main.push_back(pcard); player[playerid].list_main.push_back(pcard);
pcard->current.sequence = player[playerid].list_main.size() - 1; pcard->current.sequence = (uint8)player[playerid].list_main.size() - 1;
if(!core.shuffle_check_disabled) if(!core.shuffle_check_disabled)
core.shuffle_deck_check[playerid] = TRUE; core.shuffle_deck_check[playerid] = TRUE;
} }
...@@ -206,7 +206,7 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -206,7 +206,7 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
} }
case LOCATION_HAND: { case LOCATION_HAND: {
player[playerid].list_hand.push_back(pcard); player[playerid].list_hand.push_back(pcard);
pcard->current.sequence = player[playerid].list_hand.size() - 1; pcard->current.sequence = (uint8)player[playerid].list_hand.size() - 1;
uint32 pos = pcard->is_affected_by_effect(EFFECT_PUBLIC) ? POS_FACEUP : POS_FACEDOWN; uint32 pos = pcard->is_affected_by_effect(EFFECT_PUBLIC) ? POS_FACEUP : POS_FACEDOWN;
pcard->sendto_param.position = pos; pcard->sendto_param.position = pos;
if(!(pcard->current.reason & REASON_DRAW) && !core.shuffle_check_disabled) if(!(pcard->current.reason & REASON_DRAW) && !core.shuffle_check_disabled)
...@@ -215,12 +215,12 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -215,12 +215,12 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
} }
case LOCATION_GRAVE: { case LOCATION_GRAVE: {
player[playerid].list_grave.push_back(pcard); player[playerid].list_grave.push_back(pcard);
pcard->current.sequence = player[playerid].list_grave.size() - 1; pcard->current.sequence = (uint8)player[playerid].list_grave.size() - 1;
break; break;
} }
case LOCATION_REMOVED: { case LOCATION_REMOVED: {
player[playerid].list_remove.push_back(pcard); player[playerid].list_remove.push_back(pcard);
pcard->current.sequence = player[playerid].list_remove.size() - 1; pcard->current.sequence = (uint8)player[playerid].list_remove.size() - 1;
break; break;
} }
case LOCATION_EXTRA: { case LOCATION_EXTRA: {
...@@ -523,7 +523,7 @@ void field::swap_card(card* pcard1, card* pcard2) { ...@@ -523,7 +523,7 @@ void field::swap_card(card* pcard1, card* pcard2) {
return swap_card(pcard1, pcard2, pcard1->current.sequence, pcard2->current.sequence); return swap_card(pcard1, pcard2, pcard1->current.sequence, pcard2->current.sequence);
} }
void field::set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 reset_count) { void field::set_control(card* pcard, uint8 playerid, uint16 reset_phase, uint8 reset_count) {
if((core.remove_brainwashing && pcard->is_affected_by_effect(EFFECT_REMOVE_BRAINWASHING)) || pcard->refresh_control_status() == playerid) if((core.remove_brainwashing && pcard->is_affected_by_effect(EFFECT_REMOVE_BRAINWASHING)) || std::get<uint8>(pcard->refresh_control_status()) == playerid)
return; return;
effect* peffect = pduel->new_effect(); effect* peffect = pduel->new_effect();
if(core.reason_effect) if(core.reason_effect)
...@@ -944,7 +944,7 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -944,7 +944,7 @@ void field::shuffle(uint8 playerid, uint8 location) {
} }
} }
if(location == LOCATION_HAND || !(core.duel_options & DUEL_PSEUDO_SHUFFLE)) { if(location == LOCATION_HAND || !(core.duel_options & DUEL_PSEUDO_SHUFFLE)) {
uint32 s = svector.size(); uint32 s = (uint32)svector.size();
if(location == LOCATION_EXTRA) if(location == LOCATION_EXTRA)
s = s - player[playerid].extra_p_count; s = s - player[playerid].extra_p_count;
if(s > 1) { if(s > 1) {
...@@ -961,7 +961,7 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -961,7 +961,7 @@ void field::shuffle(uint8 playerid, uint8 location) {
if(location == LOCATION_HAND || location == LOCATION_EXTRA) { if(location == LOCATION_HAND || location == LOCATION_EXTRA) {
pduel->write_buffer8((location == LOCATION_HAND) ? MSG_SHUFFLE_HAND : MSG_SHUFFLE_EXTRA); pduel->write_buffer8((location == LOCATION_HAND) ? MSG_SHUFFLE_HAND : MSG_SHUFFLE_EXTRA);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
pduel->write_buffer8(svector.size()); pduel->write_buffer8((uint8)svector.size());
for(auto& pcard : svector) for(auto& pcard : svector)
pduel->write_buffer32(pcard->data.code); pduel->write_buffer32(pcard->data.code);
if(location == LOCATION_HAND) { if(location == LOCATION_HAND) {
...@@ -1080,7 +1080,7 @@ void field::swap_deck_and_grave(uint8 playerid) { ...@@ -1080,7 +1080,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
shuffle(playerid, LOCATION_DECK); shuffle(playerid, LOCATION_DECK);
} }
void field::reverse_deck(uint8 playerid) { void field::reverse_deck(uint8 playerid) {
int32 count = player[playerid].list_main.size(); int32 count = (int32)player[playerid].list_main.size();
if(count == 0) if(count == 0)
return; return;
for(int32 i = 0; i < count / 2; ++i) { for(int32 i = 0; i < count / 2; ++i) {
...@@ -1125,10 +1125,10 @@ void field::tag_swap(uint8 playerid) { ...@@ -1125,10 +1125,10 @@ void field::tag_swap(uint8 playerid) {
} }
pduel->write_buffer8(MSG_TAG_SWAP); pduel->write_buffer8(MSG_TAG_SWAP);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
pduel->write_buffer8(player[playerid].list_main.size()); pduel->write_buffer8((uint8)player[playerid].list_main.size());
pduel->write_buffer8(player[playerid].list_extra.size()); pduel->write_buffer8((uint8)player[playerid].list_extra.size());
pduel->write_buffer8(player[playerid].extra_p_count); pduel->write_buffer8((uint8)player[playerid].extra_p_count);
pduel->write_buffer8(player[playerid].list_hand.size()); pduel->write_buffer8((uint8)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.back()->data.code); pduel->write_buffer32(player[playerid].list_main.back()->data.code);
else else
...@@ -1625,27 +1625,27 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g ...@@ -1625,27 +1625,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)
pgroup->container.insert(player[self].list_hand.begin(), player[self].list_hand.end()); pgroup->container.insert(player[self].list_hand.begin(), player[self].list_hand.end());
count += player[self].list_hand.size(); count += (uint32)player[self].list_hand.size();
} }
if(location & LOCATION_DECK) { if(location & LOCATION_DECK) {
if(pgroup) if(pgroup)
pgroup->container.insert(player[self].list_main.rbegin(), player[self].list_main.rend()); pgroup->container.insert(player[self].list_main.rbegin(), player[self].list_main.rend());
count += player[self].list_main.size(); count += (uint32)player[self].list_main.size();
} }
if(location & LOCATION_EXTRA) { if(location & LOCATION_EXTRA) {
if(pgroup) if(pgroup)
pgroup->container.insert(player[self].list_extra.rbegin(), player[self].list_extra.rend()); pgroup->container.insert(player[self].list_extra.rbegin(), player[self].list_extra.rend());
count += player[self].list_extra.size(); count += (uint32)player[self].list_extra.size();
} }
if(location & LOCATION_GRAVE) { if(location & LOCATION_GRAVE) {
if(pgroup) if(pgroup)
pgroup->container.insert(player[self].list_grave.rbegin(), player[self].list_grave.rend()); pgroup->container.insert(player[self].list_grave.rbegin(), player[self].list_grave.rend());
count += player[self].list_grave.size(); count += (uint32)player[self].list_grave.size();
} }
if(location & LOCATION_REMOVED) { if(location & LOCATION_REMOVED) {
if(pgroup) if(pgroup)
pgroup->container.insert(player[self].list_remove.rbegin(), player[self].list_remove.rend()); pgroup->container.insert(player[self].list_remove.rbegin(), player[self].list_remove.rend());
count += player[self].list_remove.size(); count += (uint32)player[self].list_remove.size();
} }
location = location2; location = location2;
self = 1 - self; self = 1 - self;
...@@ -1905,7 +1905,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) { ...@@ -1905,7 +1905,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) {
if(c) { if(c) {
for(auto& pcard : player[self].list_mzone) { for(auto& pcard : player[self].list_mzone) {
if(pcard && !pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP)) if(pcard && !pcard->get_status(STATUS_SUMMONING | STATUS_SPSUMMON_STEP))
count += pcard->xyz_materials.size(); count += (uint32)pcard->xyz_materials.size();
} }
} }
self = 1 - self; self = 1 - self;
...@@ -2782,7 +2782,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2782,7 +2782,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
card_set mcset; card_set mcset;
for(int32 i = 0; i < eset.size(); ++i) for(int32 i = 0; i < eset.size(); ++i)
mcset.insert(eset[i]->handler); mcset.insert(eset[i]->handler);
int32 mct = mcset.size(); int32 mct = (int32)mcset.size();
if(mct > 0) { if(mct > 0) {
if(ct == 0 && std::none_of(mcset.begin(), mcset.end(), if(ct == 0 && std::none_of(mcset.begin(), mcset.end(),
[=](card* pcard) { return handover_zone_cards.find(pcard) != handover_zone_cards.end(); })) [=](card* pcard) { return handover_zone_cards.find(pcard) != handover_zone_cards.end(); }))
...@@ -2839,7 +2839,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2839,7 +2839,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
pcard->sum_param |= 1; pcard->sum_param |= 1;
++cit; ++cit;
} }
ct += std::count_if(mcset.begin(), mcset.end(), ct += (int32)std::count_if(mcset.begin(), mcset.end(),
[=](card* pcard) { return handover_zone_cards.find(pcard) != handover_zone_cards.end(); }); [=](card* pcard) { return handover_zone_cards.find(pcard) != handover_zone_cards.end(); });
std::multimap<int32, card*, std::greater<int32>> mat; std::multimap<int32, card*, std::greater<int32>> mat;
for(int32 icheck = 1; icheck <= digit; icheck <<= 1) { for(int32 icheck = 1; icheck <= digit; icheck <<= 1) {
...@@ -3272,7 +3272,7 @@ chain* field::get_chain(uint32 chaincount) { ...@@ -3272,7 +3272,7 @@ chain* field::get_chain(uint32 chaincount) {
if(chaincount == 0 && core.continuous_chain.size() && (core.reason_effect->type & EFFECT_TYPE_CONTINUOUS)) if(chaincount == 0 && core.continuous_chain.size() && (core.reason_effect->type & EFFECT_TYPE_CONTINUOUS))
return &core.continuous_chain.back(); return &core.continuous_chain.back();
if(chaincount == 0 || chaincount > core.current_chain.size()) { if(chaincount == 0 || chaincount > core.current_chain.size()) {
chaincount = core.current_chain.size(); chaincount = (uint32)core.current_chain.size();
if(chaincount == 0) if(chaincount == 0)
return 0; return 0;
} }
......
...@@ -44,7 +44,7 @@ struct optarget { ...@@ -44,7 +44,7 @@ struct optarget {
int32 op_param; int32 op_param;
}; };
struct chain { struct chain {
typedef std::unordered_map<uint32, optarget> opmap; using opmap = std::unordered_map<uint32, optarget>;
uint16 chain_id; uint16 chain_id;
uint8 chain_count; uint8 chain_count;
uint8 triggering_player; uint8 triggering_player;
...@@ -68,7 +68,7 @@ struct chain { ...@@ -68,7 +68,7 @@ struct chain {
}; };
struct player_info { struct player_info {
typedef std::vector<card*> card_vector; using card_vector = std::vector<card*>;
int32 lp; int32 lp;
int32 start_count; int32 start_count;
int32 draw_count; int32 draw_count;
...@@ -88,12 +88,12 @@ struct player_info { ...@@ -88,12 +88,12 @@ struct player_info {
card_vector tag_list_extra; card_vector tag_list_extra;
}; };
struct field_effect { struct field_effect {
typedef std::multimap<uint32, effect*> effect_container; using effect_container = std::multimap<uint32, effect*>;
typedef std::unordered_map<effect*, effect_container::iterator> effect_indexer; using effect_indexer = std::unordered_map<effect*, effect_container::iterator>;
typedef std::unordered_map<effect*, effect*> oath_effects; using oath_effects = std::unordered_map<effect*, effect*>;
typedef std::unordered_set<effect*> effect_collection; using effect_collection = std::unordered_set<effect*>;
typedef std::unordered_map<card*, effect*> gain_effects; using gain_effects = std::unordered_map<card*, effect*>;
typedef std::unordered_map<effect*, gain_effects> grant_effect_container; using grant_effect_container = std::unordered_map<effect*, gain_effects>;
effect_container aura_effect; effect_container aura_effect;
effect_container ignition_effect; effect_container ignition_effect;
...@@ -150,23 +150,23 @@ union return_value { ...@@ -150,23 +150,23 @@ union return_value {
int64 lvalue[8]; int64 lvalue[8];
}; };
struct processor { struct processor {
typedef std::vector<effect*> effect_vector; using effect_vector = std::vector<effect*>;
typedef std::vector<card*> card_vector; using card_vector = std::vector<card*>;
typedef std::vector<uint32> option_vector; using option_vector = std::vector<uint32>;
typedef std::list<card*> card_list; using card_list = std::list<card*>;
typedef std::list<tevent> event_list; using event_list = std::list<tevent>;
typedef std::list<chain> chain_list; using chain_list = std::list<chain>;
typedef std::map<effect*, chain> instant_f_list; using instant_f_list = std::map<effect*, chain>;
typedef std::vector<chain> chain_array; using chain_array = std::vector<chain>;
typedef std::list<processor_unit> processor_list; using processor_list = std::list<processor_unit>;
typedef std::set<card*, card_sort> card_set; using card_set = std::set<card*, card_sort>;
typedef std::set<std::pair<effect*, tevent>> delayed_effect_collection; using delayed_effect_collection = std::set<std::pair<effect*, tevent>>;
struct chain_limit_t { struct chain_limit_t {
chain_limit_t(int32 f, int32 p): function(f), player(p) {} chain_limit_t(int32 f, int32 p): function(f), player(p) {}
int32 function; int32 function;
int32 player; int32 player;
}; };
typedef std::vector<chain_limit_t> chain_limit_list; using chain_limit_list = std::vector<chain_limit_t>;
processor_list units; processor_list units;
processor_list subunits; processor_list subunits;
...@@ -209,7 +209,6 @@ struct processor { ...@@ -209,7 +209,6 @@ struct processor {
chain_list new_ochain_h; chain_list new_ochain_h;
chain_list new_chains; chain_list new_chains;
delayed_effect_collection delayed_quick_tmp; delayed_effect_collection delayed_quick_tmp;
delayed_effect_collection delayed_quick_break;
delayed_effect_collection delayed_quick; delayed_effect_collection delayed_quick;
instant_f_list quick_f_chain; instant_f_list quick_f_chain;
card_set leave_confirmed; card_set leave_confirmed;
...@@ -335,16 +334,16 @@ struct processor { ...@@ -335,16 +334,16 @@ struct processor {
}; };
class field { class field {
public: public:
typedef std::multimap<uint32, effect*> effect_container; using effect_container = std::multimap<uint32, effect*>;
typedef std::set<card*, card_sort> card_set; using card_set = std::set<card*, card_sort>;
typedef std::vector<effect*> effect_vector; using effect_vector = std::vector<effect*>;
typedef std::vector<card*> card_vector; using card_vector = std::vector<card*>;
typedef std::list<card*> card_list; using card_list = std::list<card*>;
typedef std::list<tevent> event_list; using event_list = std::list<tevent>;
typedef std::list<chain> chain_list; using chain_list = std::list<chain>;
typedef std::map<effect*, chain> instant_f_list; using instant_f_list = std::map<effect*, chain>;
typedef std::vector<chain> chain_array; using chain_array = std::vector<chain>;
typedef std::list<processor_unit> processor_list; using processor_list = std::list<processor_unit>;
duel* pduel; duel* pduel;
player_info player[2]; player_info player[2];
......
...@@ -17,7 +17,7 @@ class duel; ...@@ -17,7 +17,7 @@ class duel;
class group { class group {
public: public:
typedef std::set<card*, card_sort> card_set; using card_set = std::set<card*, card_sort>;
int32 ref_handle; int32 ref_handle;
duel* pduel; duel* pduel;
card_set container; card_set container;
......
...@@ -183,7 +183,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) { ...@@ -183,7 +183,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) {
lua_pushstring(L, (const char *) it.first); lua_pushstring(L, (const char *) it.first);
break; break;
case PARAM_TYPE_BOOLEAN: case PARAM_TYPE_BOOLEAN:
lua_pushboolean(L, (ptr) it.first); lua_pushboolean(L, (int32)(ptr)it.first);
break; break;
case PARAM_TYPE_CARD: { case PARAM_TYPE_CARD: {
if (it.first) if (it.first)
...@@ -207,7 +207,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) { ...@@ -207,7 +207,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) {
break; break;
} }
case PARAM_TYPE_FUNCTION: { case PARAM_TYPE_FUNCTION: {
function2value(L, (ptr)it.first); function2value(L, (int32)(ptr)it.first);
break; break;
} }
case PARAM_TYPE_INDEX: { case PARAM_TYPE_INDEX: {
...@@ -433,7 +433,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg ...@@ -433,7 +433,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
} }
return OPERATION_FAIL; return OPERATION_FAIL;
} }
int32 result = lua_isinteger(current_state, -1) ? lua_tointeger(current_state, -1) : std::round(lua_tonumber(current_state, -1)); int32 result = lua_isinteger(current_state, -1) ? (int32)lua_tointeger(current_state, -1) : (int32)lua_tonumber(current_state, -1);
lua_pop(current_state, 1); lua_pop(current_state, 1);
no_action--; no_action--;
call_depth--; call_depth--;
...@@ -455,9 +455,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) { ...@@ -455,9 +455,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
if(lua_isboolean(current_state, -1)) if(lua_isboolean(current_state, -1))
result = lua_toboolean(current_state, -1); result = lua_toboolean(current_state, -1);
else if(lua_isinteger(current_state, -1)) else if(lua_isinteger(current_state, -1))
result = lua_tointeger(current_state, -1); result = (int32)lua_tointeger(current_state, -1);
else else
result = std::round(lua_tonumber(current_state, -1)); result = (int32)lua_tonumber(current_state, -1);
lua_pop(current_state, 1); lua_pop(current_state, 1);
no_action--; no_action--;
call_depth--; call_depth--;
...@@ -491,9 +491,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i ...@@ -491,9 +491,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
if(lua_isboolean(current_state, index)) if(lua_isboolean(current_state, index))
return_value = lua_toboolean(current_state, index); return_value = lua_toboolean(current_state, index);
else if(lua_isinteger(current_state, index)) else if(lua_isinteger(current_state, index))
return_value = lua_tointeger(current_state, index); return_value = (int32)lua_tointeger(current_state, index);
else else
return_value = std::round(lua_tonumber(current_state, index)); return_value = (int32)lua_tonumber(current_state, index);
result->push_back(return_value); result->push_back(return_value);
} }
lua_settop(current_state, stack_top); lua_settop(current_state, stack_top);
...@@ -554,7 +554,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va ...@@ -554,7 +554,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
if (result == 0) { if (result == 0) {
coroutines.erase(f); coroutines.erase(f);
if(yield_value) if(yield_value)
*yield_value = lua_isboolean(rthread, -1) ? lua_toboolean(rthread, -1) : lua_tointeger(rthread, -1); *yield_value = lua_isboolean(rthread, -1) ? lua_toboolean(rthread, -1) : (uint32)lua_tointeger(rthread, -1);
current_state = lua_state; current_state = lua_state;
call_depth--; call_depth--;
if(call_depth == 0) { if(call_depth == 0) {
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <vector> #include <vector>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <cmath>
class card; class card;
class effect; class effect;
...@@ -24,8 +23,8 @@ class duel; ...@@ -24,8 +23,8 @@ class duel;
class interpreter { class interpreter {
public: public:
typedef std::unordered_map<int32, lua_State*> coroutine_map; using coroutine_map = std::unordered_map<int32, lua_State*>;
typedef std::list<std::pair<void*, uint32>> param_list; using param_list = std::list<std::pair<void*, uint32>>;
duel* pduel; duel* pduel;
char msgbuf[64]; char msgbuf[64];
......
This diff is collapsed.
...@@ -25,12 +25,12 @@ int32 scriptlib::debug_message(lua_State *L) { ...@@ -25,12 +25,12 @@ int32 scriptlib::debug_message(lua_State *L) {
int32 scriptlib::debug_add_card(lua_State *L) { int32 scriptlib::debug_add_card(lua_State *L) {
check_param_count(L, 6); check_param_count(L, 6);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
int32 code = lua_tointeger(L, 1); int32 code = (int32)lua_tointeger(L, 1);
int32 owner = lua_tointeger(L, 2); int32 owner = (int32)lua_tointeger(L, 2);
int32 playerid = lua_tointeger(L, 3); int32 playerid = (int32)lua_tointeger(L, 3);
int32 location = lua_tointeger(L, 4); int32 location = (int32)lua_tointeger(L, 4);
int32 sequence = lua_tointeger(L, 5); int32 sequence = (int32)lua_tointeger(L, 5);
int32 position = lua_tointeger(L, 6); int32 position = (int32)lua_tointeger(L, 6);
int32 proc = lua_toboolean(L, 7); int32 proc = lua_toboolean(L, 7);
if(owner != 0 && owner != 1) if(owner != 0 && owner != 1)
return 0; return 0;
...@@ -65,7 +65,7 @@ int32 scriptlib::debug_add_card(lua_State *L) { ...@@ -65,7 +65,7 @@ int32 scriptlib::debug_add_card(lua_State *L) {
pcard->overlay_target = fcard; pcard->overlay_target = fcard;
pcard->current.controler = PLAYER_NONE; pcard->current.controler = PLAYER_NONE;
pcard->current.location = LOCATION_OVERLAY; pcard->current.location = LOCATION_OVERLAY;
pcard->current.sequence = fcard->xyz_materials.size() - 1; pcard->current.sequence = (uint8)fcard->xyz_materials.size() - 1;
for(auto& eit : pcard->xmaterial_effect) { for(auto& eit : pcard->xmaterial_effect) {
effect* peffect = eit.second; effect* peffect = eit.second;
if(peffect->type & EFFECT_TYPE_FIELD) if(peffect->type & EFFECT_TYPE_FIELD)
...@@ -79,10 +79,10 @@ int32 scriptlib::debug_add_card(lua_State *L) { ...@@ -79,10 +79,10 @@ int32 scriptlib::debug_add_card(lua_State *L) {
int32 scriptlib::debug_set_player_info(lua_State *L) { int32 scriptlib::debug_set_player_info(lua_State *L) {
check_param_count(L, 4); check_param_count(L, 4);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
uint32 playerid = lua_tointeger(L, 1); uint32 playerid = (uint32)lua_tointeger(L, 1);
uint32 lp = lua_tointeger(L, 2); uint32 lp = (uint32)lua_tointeger(L, 2);
uint32 startcount = lua_tointeger(L, 3); uint32 startcount = (uint32)lua_tointeger(L, 3);
uint32 drawcount = lua_tointeger(L, 4); uint32 drawcount = (uint32)lua_tointeger(L, 4);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
pduel->game_field->player[playerid].lp = lp; pduel->game_field->player[playerid].lp = lp;
...@@ -94,10 +94,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) { ...@@ -94,10 +94,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
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);
uint32 summon_type = lua_tointeger(L, 2); uint32 summon_type = (uint32)lua_tointeger(L, 2);
uint8 summon_location = 0; uint8 summon_location = 0;
if(lua_gettop(L) > 2) if(lua_gettop(L) > 2)
summon_location = lua_tointeger(L, 3); summon_location = (uint8)lua_tointeger(L, 3);
pcard->summon_info = summon_type | (summon_location << 16); pcard->summon_info = summon_type | (summon_location << 16);
return 0; return 0;
} }
...@@ -132,8 +132,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -132,8 +132,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
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);
uint32 countertype = lua_tointeger(L, 2); uint32 countertype = (uint32)lua_tointeger(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = (uint32)lua_tointeger(L, 3);
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE; uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
auto pr = pcard->counters.emplace(cttype, card::counter_map::mapped_type()); auto pr = pcard->counters.emplace(cttype, card::counter_map::mapped_type());
auto cmit = pr.first; auto cmit = pr.first;
...@@ -150,8 +150,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -150,8 +150,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
int32 scriptlib::debug_reload_field_begin(lua_State *L) { int32 scriptlib::debug_reload_field_begin(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
uint32 flag = lua_tointeger(L, 1); uint32 flag = (uint32)lua_tointeger(L, 1);
int32 rule = lua_tointeger(L, 2); int32 rule = (int32)lua_tointeger(L, 2);
pduel->clear(); pduel->clear();
pduel->game_field->core.duel_options = flag; pduel->game_field->core.duel_options = flag;
if (rule) if (rule)
...@@ -177,7 +177,7 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) { ...@@ -177,7 +177,7 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
pduel->write_buffer8(MSG_AI_NAME); pduel->write_buffer8(MSG_AI_NAME);
const char* pstr = lua_tostring(L, 1); const char* pstr = lua_tostring(L, 1);
int len = strlen(pstr); int len = (int)strlen(pstr);
if(len > 100) if(len > 100)
len = 100; len = 100;
pduel->write_buffer16(len); pduel->write_buffer16(len);
...@@ -193,7 +193,7 @@ int32 scriptlib::debug_show_hint(lua_State *L) { ...@@ -193,7 +193,7 @@ int32 scriptlib::debug_show_hint(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
pduel->write_buffer8(MSG_SHOW_HINT); pduel->write_buffer8(MSG_SHOW_HINT);
const char* pstr = lua_tostring(L, 1); const char* pstr = lua_tostring(L, 1);
int len = strlen(pstr); int len = (int)strlen(pstr);
if(len > 1024) if(len > 1024)
len = 1024; len = 1024;
pduel->write_buffer16(len); pduel->write_buffer16(len);
......
This diff is collapsed.
...@@ -62,7 +62,7 @@ int32 scriptlib::effect_set_description(lua_State *L) { ...@@ -62,7 +62,7 @@ int32 scriptlib::effect_set_description(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v = lua_tointeger(L, 2); uint32 v = (uint32)lua_tointeger(L, 2);
peffect->description = v; peffect->description = v;
return 0; return 0;
} }
...@@ -70,7 +70,7 @@ int32 scriptlib::effect_set_code(lua_State *L) { ...@@ -70,7 +70,7 @@ int32 scriptlib::effect_set_code(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v = lua_tointeger(L, 2); uint32 v = (uint32)lua_tointeger(L, 2);
peffect->code = v; peffect->code = v;
return 0; return 0;
} }
...@@ -78,7 +78,7 @@ int32 scriptlib::effect_set_range(lua_State *L) { ...@@ -78,7 +78,7 @@ int32 scriptlib::effect_set_range(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v = lua_tointeger(L, 2); uint32 v = (uint32)lua_tointeger(L, 2);
peffect->range = v; peffect->range = v;
return 0; return 0;
} }
...@@ -86,8 +86,8 @@ int32 scriptlib::effect_set_target_range(lua_State *L) { ...@@ -86,8 +86,8 @@ int32 scriptlib::effect_set_target_range(lua_State *L) {
check_param_count(L, 3); check_param_count(L, 3);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 s = lua_tointeger(L, 2); uint32 s = (uint32)lua_tointeger(L, 2);
uint32 o = lua_tointeger(L, 3); uint32 o = (uint32)lua_tointeger(L, 3);
peffect->s_range = s; peffect->s_range = s;
peffect->o_range = o; peffect->o_range = o;
peffect->flag[0] &= ~EFFECT_FLAG_ABSOLUTE_TARGET; peffect->flag[0] &= ~EFFECT_FLAG_ABSOLUTE_TARGET;
...@@ -97,9 +97,9 @@ int32 scriptlib::effect_set_absolute_range(lua_State *L) { ...@@ -97,9 +97,9 @@ int32 scriptlib::effect_set_absolute_range(lua_State *L) {
check_param_count(L, 4); check_param_count(L, 4);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = (uint32)lua_tointeger(L, 2);
uint32 s = lua_tointeger(L, 3); uint32 s = (uint32)lua_tointeger(L, 3);
uint32 o = lua_tointeger(L, 4); uint32 o = (uint32)lua_tointeger(L, 4);
if(playerid == 0) { if(playerid == 0) {
peffect->s_range = s; peffect->s_range = s;
peffect->o_range = o; peffect->o_range = o;
...@@ -114,10 +114,10 @@ int32 scriptlib::effect_set_count_limit(lua_State *L) { ...@@ -114,10 +114,10 @@ int32 scriptlib::effect_set_count_limit(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v = lua_tointeger(L, 2); uint32 v = (uint32)lua_tointeger(L, 2);
uint32 code = 0; uint32 code = 0;
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3)
code = lua_tointeger(L, 3); code = (uint32)lua_tointeger(L, 3);
if(v == 0) if(v == 0)
v = 1; v = 1;
peffect->flag[0] |= EFFECT_FLAG_COUNT_LIMIT; peffect->flag[0] |= EFFECT_FLAG_COUNT_LIMIT;
...@@ -130,8 +130,8 @@ int32 scriptlib::effect_set_reset(lua_State *L) { ...@@ -130,8 +130,8 @@ int32 scriptlib::effect_set_reset(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v = lua_tointeger(L, 2); uint32 v = (uint32)lua_tointeger(L, 2);
uint32 c = lua_tointeger(L, 3); uint32 c = (uint32)lua_tointeger(L, 3);
if(c == 0) if(c == 0)
c = 1; c = 1;
if(v & (RESET_PHASE) && !(v & (RESET_SELF_TURN | RESET_OPPO_TURN))) if(v & (RESET_PHASE) && !(v & (RESET_SELF_TURN | RESET_OPPO_TURN)))
...@@ -144,7 +144,7 @@ int32 scriptlib::effect_set_type(lua_State *L) { ...@@ -144,7 +144,7 @@ int32 scriptlib::effect_set_type(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v = lua_tointeger(L, 2); uint32 v = (uint32)lua_tointeger(L, 2);
if (v & 0x0ff0) if (v & 0x0ff0)
v |= EFFECT_TYPE_ACTIONS; v |= EFFECT_TYPE_ACTIONS;
else else
...@@ -165,8 +165,8 @@ int32 scriptlib::effect_set_property(lua_State *L) { ...@@ -165,8 +165,8 @@ int32 scriptlib::effect_set_property(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v1 = lua_tointeger(L, 2); uint32 v1 = (uint32)lua_tointeger(L, 2);
uint32 v2 = lua_tointeger(L, 3); uint32 v2 = (uint32)lua_tointeger(L, 3);
peffect->flag[0] = (peffect->flag[0] & 0x4f) | (v1 & ~0x4f); peffect->flag[0] = (peffect->flag[0] & 0x4f) | (v1 & ~0x4f);
peffect->flag[1] = v2; peffect->flag[1] = v2;
return 0; return 0;
...@@ -177,7 +177,7 @@ int32 scriptlib::effect_set_label(lua_State *L) { ...@@ -177,7 +177,7 @@ int32 scriptlib::effect_set_label(lua_State *L) {
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
peffect->label.clear(); peffect->label.clear();
for(int32 i = 2; i <= lua_gettop(L); ++i) { for(int32 i = 2; i <= lua_gettop(L); ++i) {
uint32 v = lua_tointeger(L, i); uint32 v = (uint32)lua_tointeger(L, i);
peffect->label.push_back(v); peffect->label.push_back(v);
} }
return 0; return 0;
...@@ -207,7 +207,7 @@ int32 scriptlib::effect_set_category(lua_State *L) { ...@@ -207,7 +207,7 @@ int32 scriptlib::effect_set_category(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v = lua_tointeger(L, 2); uint32 v = (uint32)lua_tointeger(L, 2);
peffect->category = v; peffect->category = v;
return 0; return 0;
} }
...@@ -215,10 +215,10 @@ int32 scriptlib::effect_set_hint_timing(lua_State *L) { ...@@ -215,10 +215,10 @@ int32 scriptlib::effect_set_hint_timing(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 vs = lua_tointeger(L, 2); uint32 vs = (uint32)lua_tointeger(L, 2);
uint32 vo = vs; uint32 vo = vs;
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3)
vo = lua_tointeger(L, 3); vo = (uint32)lua_tointeger(L, 3);
peffect->hint_timing[0] = vs; peffect->hint_timing[0] = vs;
peffect->hint_timing[1] = vo; peffect->hint_timing[1] = vo;
return 0; return 0;
...@@ -267,9 +267,9 @@ int32 scriptlib::effect_set_value(lua_State *L) { ...@@ -267,9 +267,9 @@ int32 scriptlib::effect_set_value(lua_State *L) {
if(lua_isboolean(L, 2)) if(lua_isboolean(L, 2))
peffect->value = lua_toboolean(L, 2); peffect->value = lua_toboolean(L, 2);
else if(lua_isinteger(L, 2)) else if(lua_isinteger(L, 2))
peffect->value = lua_tointeger(L, 2); peffect->value = (int32)lua_tointeger(L, 2);
else else
peffect->value = std::round(lua_tonumber(L, 2)); peffect->value = (int32)lua_tonumber(L, 2);
} }
return 0; return 0;
} }
...@@ -290,7 +290,7 @@ int32 scriptlib::effect_set_owner_player(lua_State *L) { ...@@ -290,7 +290,7 @@ int32 scriptlib::effect_set_owner_player(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 p = lua_tointeger(L, 2); uint32 p = (uint32)lua_tointeger(L, 2);
if(p != 0 && p != 1) if(p != 0 && p != 1)
return 0; return 0;
peffect->effect_owner = p; peffect->effect_owner = p;
...@@ -348,7 +348,7 @@ int32 scriptlib::effect_get_label(lua_State *L) { ...@@ -348,7 +348,7 @@ int32 scriptlib::effect_get_label(lua_State *L) {
} }
for(const auto& lab : peffect->label) for(const auto& lab : peffect->label)
lua_pushinteger(L, lab); lua_pushinteger(L, lab);
return peffect->label.size(); return (int32)peffect->label.size();
} }
return 0; return 0;
} }
...@@ -456,7 +456,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) { ...@@ -456,7 +456,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 type = lua_tointeger(L, 2); uint32 type = (uint32)lua_tointeger(L, 2);
if(peffect->get_active_type() & type) if(peffect->get_active_type() & type)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -467,8 +467,8 @@ int32 scriptlib::effect_is_has_property(lua_State *L) { ...@@ -467,8 +467,8 @@ int32 scriptlib::effect_is_has_property(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 tflag1 = lua_tointeger(L, 2); uint32 tflag1 = (uint32)lua_tointeger(L, 2);
uint32 tflag2 = lua_tointeger(L, 3); uint32 tflag2 = (uint32)lua_tointeger(L, 3);
if (peffect && (!tflag1 || (peffect->flag[0] & tflag1)) && (!tflag2 || (peffect->flag[1] & tflag2))) if (peffect && (!tflag1 || (peffect->flag[0] & tflag1)) && (!tflag2 || (peffect->flag[1] & tflag2)))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -479,7 +479,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) { ...@@ -479,7 +479,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 tcate = lua_tointeger(L, 2); uint32 tcate = (uint32)lua_tointeger(L, 2);
if (peffect && (peffect->category & tcate)) if (peffect && (peffect->category & tcate))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -490,7 +490,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -490,7 +490,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 ttype = lua_tointeger(L, 2); uint32 ttype = (uint32)lua_tointeger(L, 2);
if (peffect && (peffect->type & ttype)) if (peffect && (peffect->type & ttype))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -500,7 +500,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -500,7 +500,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
int32 scriptlib::effect_is_activatable(lua_State *L) { int32 scriptlib::effect_is_activatable(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = (uint32)lua_tointeger(L, 2);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 neglect_loc = 0; uint32 neglect_loc = 0;
uint32 neglect_target = 0; uint32 neglect_target = 0;
...@@ -537,7 +537,7 @@ int32 scriptlib::effect_check_count_limit(lua_State *L) { ...@@ -537,7 +537,7 @@ int32 scriptlib::effect_check_count_limit(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 p = lua_tointeger(L, 2); uint32 p = (uint32)lua_tointeger(L, 2);
lua_pushboolean(L, peffect->check_count_limit(p)); lua_pushboolean(L, peffect->check_count_limit(p));
return 1; return 1;
} }
...@@ -545,12 +545,12 @@ int32 scriptlib::effect_use_count_limit(lua_State *L) { ...@@ -545,12 +545,12 @@ int32 scriptlib::effect_use_count_limit(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 p = lua_tointeger(L, 2); uint32 p = (uint32)lua_tointeger(L, 2);
uint32 count = 1; uint32 count = 1;
uint32 oath_only = 0; uint32 oath_only = 0;
uint32 code = peffect->count_code; uint32 code = peffect->count_code;
if(lua_gettop(L) > 2) { if(lua_gettop(L) > 2) {
count = lua_tointeger(L, 3); count = (uint32)lua_tointeger(L, 3);
if (lua_gettop(L) > 3) if (lua_gettop(L) > 3)
oath_only = lua_toboolean(L, 4); oath_only = lua_toboolean(L, 4);
} }
......
...@@ -206,11 +206,11 @@ int32 scriptlib::group_filter_select(lua_State *L) { ...@@ -206,11 +206,11 @@ int32 scriptlib::group_filter_select(lua_State *L) {
cset.erase(pcard); cset.erase(pcard);
} }
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = (uint32)lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 min = lua_tointeger(L, 4); uint32 min = (uint32)lua_tointeger(L, 4);
uint32 max = lua_tointeger(L, 5); uint32 max = (uint32)lua_tointeger(L, 5);
uint32 extraargs = lua_gettop(L) - 6; uint32 extraargs = lua_gettop(L) - 6;
pduel->game_field->core.select_cards.clear(); pduel->game_field->core.select_cards.clear();
for (auto& pcard : cset) { for (auto& pcard : cset) {
...@@ -244,11 +244,11 @@ int32 scriptlib::group_select(lua_State *L) { ...@@ -244,11 +244,11 @@ int32 scriptlib::group_select(lua_State *L) {
cset.erase(pcard); cset.erase(pcard);
} }
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = (uint32)lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 min = lua_tointeger(L, 3); uint32 min = (uint32)lua_tointeger(L, 3);
uint32 max = lua_tointeger(L, 4); uint32 max = (uint32)lua_tointeger(L, 4);
pduel->game_field->core.select_cards.clear(); pduel->game_field->core.select_cards.clear();
for (auto& pcard : cset) { for (auto& pcard : cset) {
pduel->game_field->core.select_cards.push_back(pcard); pduel->game_field->core.select_cards.push_back(pcard);
...@@ -273,7 +273,7 @@ int32 scriptlib::group_select_unselect(lua_State *L) { ...@@ -273,7 +273,7 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
group* pgroup1 = *(group**)lua_touserdata(L, 1); group* pgroup1 = *(group**)lua_touserdata(L, 1);
group* pgroup2 = *(group**)lua_touserdata(L, 2); group* pgroup2 = *(group**)lua_touserdata(L, 2);
duel* pduel = pgroup1->pduel; duel* pduel = pgroup1->pduel;
uint32 playerid = lua_tointeger(L, 3); uint32 playerid = (uint32)lua_tointeger(L, 3);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
if(pgroup1->container.size() + pgroup2->container.size() == 0) if(pgroup1->container.size() + pgroup2->container.size() == 0)
...@@ -296,11 +296,11 @@ int32 scriptlib::group_select_unselect(lua_State *L) { ...@@ -296,11 +296,11 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
} }
uint32 min = 1; uint32 min = 1;
if(lua_gettop(L) > 5) { if(lua_gettop(L) > 5) {
min = lua_tointeger(L, 6); min = (uint32)lua_tointeger(L, 6);
} }
uint32 max = 1; uint32 max = 1;
if(lua_gettop(L) > 6) { if(lua_gettop(L) > 6) {
max = lua_tointeger(L, 7); max = (uint32)lua_tointeger(L, 7);
} }
if(min > max) if(min > max)
min = max; min = max;
...@@ -332,12 +332,12 @@ int32 scriptlib::group_random_select(lua_State *L) { ...@@ -332,12 +332,12 @@ int32 scriptlib::group_random_select(lua_State *L) {
check_param_count(L, 3); check_param_count(L, 3);
check_param(L, PARAM_TYPE_GROUP, 1); check_param(L, PARAM_TYPE_GROUP, 1);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
int32 playerid = lua_tointeger(L, 2); int32 playerid = (int32)lua_tointeger(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = (uint32)lua_tointeger(L, 3);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
group* newgroup = pduel->new_group(); group* newgroup = pduel->new_group();
if(count > pgroup->container.size()) if(count > pgroup->container.size())
count = pgroup->container.size(); count = (uint32)pgroup->container.size();
if(count == 0) { if(count == 0) {
interpreter::group2value(L, newgroup); interpreter::group2value(L, newgroup);
return 1; return 1;
...@@ -346,7 +346,7 @@ int32 scriptlib::group_random_select(lua_State *L) { ...@@ -346,7 +346,7 @@ int32 scriptlib::group_random_select(lua_State *L) {
newgroup->container = pgroup->container; newgroup->container = pgroup->container;
else { else {
while(newgroup->container.size() < count) { while(newgroup->container.size() < count) {
int32 i = pduel->get_next_integer(0, pgroup->container.size() - 1); int32 i = pduel->get_next_integer(0, (int32)pgroup->container.size() - 1);
auto cit = pgroup->container.begin(); auto cit = pgroup->container.begin();
std::advance(cit, i); std::advance(cit, i);
newgroup->container.insert(*cit); newgroup->container.insert(*cit);
...@@ -376,7 +376,7 @@ int32 scriptlib::group_is_exists(lua_State *L) { ...@@ -376,7 +376,7 @@ int32 scriptlib::group_is_exists(lua_State *L) {
cset.erase(pcard); cset.erase(pcard);
} }
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
uint32 count = lua_tointeger(L, 3); uint32 count = (uint32)lua_tointeger(L, 3);
uint32 extraargs = lua_gettop(L) - 4; uint32 extraargs = lua_gettop(L) - 4;
uint32 fcount = 0; uint32 fcount = 0;
uint32 result = FALSE; uint32 result = FALSE;
...@@ -398,16 +398,16 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) { ...@@ -398,16 +398,16 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 2); check_param(L, PARAM_TYPE_FUNCTION, 2);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 acc = lua_tointeger(L, 3); int32 acc = (int32)lua_tointeger(L, 3);
int32 min = lua_tointeger(L, 4); int32 min = (int32)lua_tointeger(L, 4);
int32 max = lua_tointeger(L, 5); int32 max = (int32)lua_tointeger(L, 5);
if(min < 0) if(min < 0)
min = 0; min = 0;
if(max < min) if(max < min)
max = min; max = min;
int32 extraargs = lua_gettop(L) - 5; int32 extraargs = lua_gettop(L) - 5;
field::card_vector cv(pduel->game_field->core.must_select_cards); field::card_vector cv(pduel->game_field->core.must_select_cards);
int32 mcount = cv.size(); int32 mcount = (int32)cv.size();
for(auto& pcard : pgroup->container) { for(auto& pcard : pgroup->container) {
auto it = std::find(pduel->game_field->core.must_select_cards.begin(), pduel->game_field->core.must_select_cards.end(), pcard); auto it = std::find(pduel->game_field->core.must_select_cards.begin(), pduel->game_field->core.must_select_cards.end(), pcard);
if(it == pduel->game_field->core.must_select_cards.end()) if(it == pduel->game_field->core.must_select_cards.end())
...@@ -426,12 +426,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -426,12 +426,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 3); check_param(L, PARAM_TYPE_FUNCTION, 3);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 playerid = lua_tointeger(L, 2); int32 playerid = (int32)lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 acc = lua_tointeger(L, 4); int32 acc = (int32)lua_tointeger(L, 4);
int32 min = lua_tointeger(L, 5); int32 min = (int32)lua_tointeger(L, 5);
int32 max = lua_tointeger(L, 6); int32 max = (int32)lua_tointeger(L, 6);
if(min < 0) if(min < 0)
min = 0; min = 0;
if(max < min) if(max < min)
...@@ -443,7 +443,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -443,7 +443,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
pduel->game_field->core.select_cards.erase(it, pduel->game_field->core.select_cards.end()); pduel->game_field->core.select_cards.erase(it, pduel->game_field->core.select_cards.end());
} }
field::card_vector cv(pduel->game_field->core.must_select_cards); field::card_vector cv(pduel->game_field->core.must_select_cards);
int32 mcount = cv.size(); int32 mcount = (int32)cv.size();
cv.insert(cv.end(), pduel->game_field->core.select_cards.begin(), pduel->game_field->core.select_cards.end()); cv.insert(cv.end(), pduel->game_field->core.select_cards.begin(), pduel->game_field->core.select_cards.end());
for(auto& pcard : cv) for(auto& pcard : cv)
pcard->sum_param = pduel->lua->get_operation_value(pcard, 3, extraargs); pcard->sum_param = pduel->lua->get_operation_value(pcard, 3, extraargs);
...@@ -457,7 +457,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -457,7 +457,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) { return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) {
duel* pduel = (duel*)ctx; duel* pduel = (duel*)ctx;
group* pgroup = pduel->new_group(); group* pgroup = pduel->new_group();
int32 mcount = pduel->game_field->core.must_select_cards.size(); int32 mcount = (int32)pduel->game_field->core.must_select_cards.size();
for(int32 i = mcount; i < pduel->game_field->returns.bvalue[0]; ++i) { for(int32 i = mcount; i < pduel->game_field->returns.bvalue[0]; ++i) {
card* pcard = pduel->game_field->core.select_cards[pduel->game_field->returns.bvalue[i + 1]]; card* pcard = pduel->game_field->core.select_cards[pduel->game_field->returns.bvalue[i + 1]];
pgroup->container.insert(pcard); pgroup->container.insert(pcard);
...@@ -473,10 +473,10 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) { ...@@ -473,10 +473,10 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 2); check_param(L, PARAM_TYPE_FUNCTION, 2);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 acc = lua_tointeger(L, 3); int32 acc = (int32)lua_tointeger(L, 3);
int32 extraargs = lua_gettop(L) - 3; int32 extraargs = lua_gettop(L) - 3;
field::card_vector cv(pduel->game_field->core.must_select_cards); field::card_vector cv(pduel->game_field->core.must_select_cards);
int32 mcount = cv.size(); int32 mcount = (int32)cv.size();
for(auto& pcard : pgroup->container) { for(auto& pcard : pgroup->container) {
auto it = std::find(pduel->game_field->core.must_select_cards.begin(), pduel->game_field->core.must_select_cards.end(), pcard); auto it = std::find(pduel->game_field->core.must_select_cards.begin(), pduel->game_field->core.must_select_cards.end(), pcard);
if(it == pduel->game_field->core.must_select_cards.end()) if(it == pduel->game_field->core.must_select_cards.end())
...@@ -495,10 +495,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -495,10 +495,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 3); check_param(L, PARAM_TYPE_FUNCTION, 3);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 playerid = lua_tointeger(L, 2); int32 playerid = (int32)lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 acc = lua_tointeger(L, 4); int32 acc = (int32)lua_tointeger(L, 4);
int32 extraargs = lua_gettop(L) - 4; int32 extraargs = lua_gettop(L) - 4;
pduel->game_field->core.select_cards.assign(pgroup->container.begin(), pgroup->container.end()); pduel->game_field->core.select_cards.assign(pgroup->container.begin(), pgroup->container.end());
for(auto& pcard : pduel->game_field->core.must_select_cards) { for(auto& pcard : pduel->game_field->core.must_select_cards) {
...@@ -506,7 +506,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -506,7 +506,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
pduel->game_field->core.select_cards.erase(it, pduel->game_field->core.select_cards.end()); pduel->game_field->core.select_cards.erase(it, pduel->game_field->core.select_cards.end());
} }
field::card_vector cv(pduel->game_field->core.must_select_cards); field::card_vector cv(pduel->game_field->core.must_select_cards);
int32 mcount = cv.size(); int32 mcount = (int32)cv.size();
cv.insert(cv.end(), pduel->game_field->core.select_cards.begin(), pduel->game_field->core.select_cards.end()); cv.insert(cv.end(), pduel->game_field->core.select_cards.begin(), pduel->game_field->core.select_cards.end());
for(auto& pcard : cv) for(auto& pcard : cv)
pcard->sum_param = pduel->lua->get_operation_value(pcard, 3, extraargs); pcard->sum_param = pduel->lua->get_operation_value(pcard, 3, extraargs);
...@@ -520,7 +520,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -520,7 +520,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) { return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) {
duel* pduel = (duel*)ctx; duel* pduel = (duel*)ctx;
group* pgroup = pduel->new_group(); group* pgroup = pduel->new_group();
int32 mcount = pduel->game_field->core.must_select_cards.size(); int32 mcount = (int32)pduel->game_field->core.must_select_cards.size();
for(int32 i = mcount; i < pduel->game_field->returns.bvalue[0]; ++i) { for(int32 i = mcount; i < pduel->game_field->returns.bvalue[0]; ++i) {
card* pcard = pduel->game_field->core.select_cards[pduel->game_field->returns.bvalue[i + 1]]; card* pcard = pduel->game_field->core.select_cards[pduel->game_field->returns.bvalue[i + 1]];
pgroup->container.insert(pcard); pgroup->container.insert(pcard);
......
...@@ -44,7 +44,7 @@ byte* default_script_reader(const char* script_name, int* slen) { ...@@ -44,7 +44,7 @@ byte* default_script_reader(const char* script_name, int* slen) {
fp = fopen(script_name, "rb"); fp = fopen(script_name, "rb");
if (!fp) if (!fp)
return 0; return 0;
int len = fread(buffer, 1, sizeof(buffer), fp); int len = (int)fread(buffer, 1, sizeof(buffer), fp);
fclose(fp); fclose(fp);
if(len >= sizeof(buffer)) if(len >= sizeof(buffer))
return 0; return 0;
...@@ -88,7 +88,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) { ...@@ -88,7 +88,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) {
pd->game_field->player[0].tag_list_hand.push_back(pcard); pd->game_field->player[0].tag_list_hand.push_back(pcard);
pcard->current.controler = 0; pcard->current.controler = 0;
pcard->current.location = LOCATION_HAND; pcard->current.location = LOCATION_HAND;
pcard->current.sequence = pd->game_field->player[0].tag_list_hand.size() - 1; pcard->current.sequence = (uint8)pd->game_field->player[0].tag_list_hand.size() - 1;
pcard->current.position = POS_FACEDOWN; pcard->current.position = POS_FACEDOWN;
} }
for(int i = 0; i < pd->game_field->player[1].start_count && pd->game_field->player[1].tag_list_main.size(); ++i) { for(int i = 0; i < pd->game_field->player[1].start_count && pd->game_field->player[1].tag_list_main.size(); ++i) {
...@@ -97,7 +97,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) { ...@@ -97,7 +97,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) {
pd->game_field->player[1].tag_list_hand.push_back(pcard); pd->game_field->player[1].tag_list_hand.push_back(pcard);
pcard->current.controler = 1; pcard->current.controler = 1;
pcard->current.location = LOCATION_HAND; pcard->current.location = LOCATION_HAND;
pcard->current.sequence = pd->game_field->player[1].tag_list_hand.size() - 1; pcard->current.sequence = (uint8)pd->game_field->player[1].tag_list_hand.size() - 1;
pcard->current.position = POS_FACEDOWN; pcard->current.position = POS_FACEDOWN;
} }
} }
...@@ -162,7 +162,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner, ...@@ -162,7 +162,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner,
pcard->owner = owner; pcard->owner = owner;
pcard->current.controler = owner; pcard->current.controler = owner;
pcard->current.location = LOCATION_DECK; pcard->current.location = LOCATION_DECK;
pcard->current.sequence = ptduel->game_field->player[owner].tag_list_main.size() - 1; pcard->current.sequence = (uint8)ptduel->game_field->player[owner].tag_list_main.size() - 1;
pcard->current.position = POS_FACEDOWN_DEFENSE; pcard->current.position = POS_FACEDOWN_DEFENSE;
break; break;
case LOCATION_EXTRA: case LOCATION_EXTRA:
...@@ -170,7 +170,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner, ...@@ -170,7 +170,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner,
pcard->owner = owner; pcard->owner = owner;
pcard->current.controler = owner; pcard->current.controler = owner;
pcard->current.location = LOCATION_EXTRA; pcard->current.location = LOCATION_EXTRA;
pcard->current.sequence = ptduel->game_field->player[owner].tag_list_extra.size() - 1; pcard->current.sequence = (uint8)ptduel->game_field->player[owner].tag_list_extra.size() - 1;
pcard->current.position = POS_FACEDOWN_DEFENSE; pcard->current.position = POS_FACEDOWN_DEFENSE;
break; break;
} }
...@@ -214,15 +214,15 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uin ...@@ -214,15 +214,15 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uin
return 0; return 0;
auto& player = ptduel->game_field->player[playerid]; auto& player = ptduel->game_field->player[playerid];
if(location == LOCATION_HAND) if(location == LOCATION_HAND)
return player.list_hand.size(); return (int32)player.list_hand.size();
if(location == LOCATION_GRAVE) if(location == LOCATION_GRAVE)
return player.list_grave.size(); return (int32)player.list_grave.size();
if(location == LOCATION_REMOVED) if(location == LOCATION_REMOVED)
return player.list_remove.size(); return (int32)player.list_remove.size();
if(location == LOCATION_EXTRA) if(location == LOCATION_EXTRA)
return player.list_extra.size(); return (int32)player.list_extra.size();
if(location == LOCATION_DECK) if(location == LOCATION_DECK)
return player.list_main.size(); return (int32)player.list_main.size();
if(location == LOCATION_MZONE) { if(location == LOCATION_MZONE) {
uint32 count = 0; uint32 count = 0;
for(auto& pcard : player.list_mzone) for(auto& pcard : player.list_mzone)
...@@ -295,7 +295,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -295,7 +295,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
if(pcard) { if(pcard) {
*p++ = 1; *p++ = 1;
*p++ = pcard->current.position; *p++ = pcard->current.position;
*p++ = pcard->xyz_materials.size(); *p++ = (uint8)pcard->xyz_materials.size();
} else { } else {
*p++ = 0; *p++ = 0;
} }
...@@ -308,14 +308,14 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -308,14 +308,14 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*p++ = 0; *p++ = 0;
} }
} }
*p++ = player.list_main.size(); *p++ = (uint8)player.list_main.size();
*p++ = player.list_hand.size(); *p++ = (uint8)player.list_hand.size();
*p++ = player.list_grave.size(); *p++ = (uint8)player.list_grave.size();
*p++ = player.list_remove.size(); *p++ = (uint8)player.list_remove.size();
*p++ = player.list_extra.size(); *p++ = (uint8)player.list_extra.size();
*p++ = player.extra_p_count; *p++ = (uint8)player.extra_p_count;
} }
*p++ = ptduel->game_field->core.current_chain.size(); *p++ = (uint8)ptduel->game_field->core.current_chain.size();
for(const auto& ch : ptduel->game_field->core.current_chain) { for(const auto& ch : ptduel->game_field->core.current_chain) {
effect* peffect = ch.triggering_effect; effect* peffect = ch.triggering_effect;
*((int*)p) = peffect->get_handler()->data.code; *((int*)p) = peffect->get_handler()->data.code;
......
This diff is collapsed.
This diff is collapsed.
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