Commit e0d08b62 authored by mercury233's avatar mercury233
parents ed0b8b5b 01ad314e
...@@ -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);
*(uint32*)(buf + 4) = query_flag; *(uint32*)(buf + 4) = query_flag;
return (uint32)((byte*)p - buf); return (uint32)((byte*)p - buf);
} }
...@@ -509,7 +509,7 @@ int32 card::get_base_attack() { ...@@ -509,7 +509,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);
...@@ -585,7 +585,7 @@ int32 card::get_attack() { ...@@ -585,7 +585,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);
...@@ -700,7 +700,7 @@ int32 card::get_base_defense() { ...@@ -700,7 +700,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);
...@@ -776,7 +776,7 @@ int32 card::get_defense() { ...@@ -776,7 +776,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);
...@@ -1465,7 +1465,7 @@ void card::xyz_add(card* mat, card_set* des) { ...@@ -1465,7 +1465,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;
...@@ -1486,7 +1486,7 @@ void card::xyz_remove(card* mat) { ...@@ -1486,7 +1486,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)
......
...@@ -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;
......
...@@ -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))
......
...@@ -130,7 +130,7 @@ void field::reload_field_info() { ...@@ -130,7 +130,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);
} }
...@@ -143,14 +143,14 @@ void field::reload_field_info() { ...@@ -143,14 +143,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);
...@@ -188,13 +188,13 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -188,13 +188,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;
} }
...@@ -203,7 +203,7 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -203,7 +203,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)
...@@ -212,12 +212,12 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -212,12 +212,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: {
...@@ -941,7 +941,7 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -941,7 +941,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) {
...@@ -958,7 +958,7 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -958,7 +958,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) {
...@@ -1077,7 +1077,7 @@ void field::swap_deck_and_grave(uint8 playerid) { ...@@ -1077,7 +1077,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) {
...@@ -1122,10 +1122,10 @@ void field::tag_swap(uint8 playerid) { ...@@ -1122,10 +1122,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
...@@ -1622,27 +1622,27 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g ...@@ -1622,27 +1622,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;
...@@ -1902,7 +1902,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) { ...@@ -1902,7 +1902,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;
...@@ -2779,7 +2779,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2779,7 +2779,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(); }))
...@@ -2836,7 +2836,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2836,7 +2836,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) {
...@@ -3269,7 +3269,7 @@ chain* field::get_chain(uint32 chaincount) { ...@@ -3269,7 +3269,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;
} }
......
...@@ -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;
......
...@@ -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) {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <vector> #include <vector>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <cmath>
class card; class card;
class effect; class effect;
......
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