Commit 1116f401 authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:Fluorohydride/ygopro-core

parents 7bbade93 f39a793b
...@@ -217,17 +217,17 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -217,17 +217,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);
} }
...@@ -268,7 +268,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -268,7 +268,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
...@@ -1575,7 +1575,7 @@ void card::xyz_add(card* mat, card_set* des) { ...@@ -1575,7 +1575,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;
...@@ -1596,7 +1596,7 @@ void card::xyz_remove(card* mat) { ...@@ -1596,7 +1596,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;
......
...@@ -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: {
...@@ -964,7 +964,7 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -964,7 +964,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) {
...@@ -981,7 +981,7 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -981,7 +981,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) {
...@@ -1100,7 +1100,7 @@ void field::swap_deck_and_grave(uint8 playerid) { ...@@ -1100,7 +1100,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) {
...@@ -1145,10 +1145,10 @@ void field::tag_swap(uint8 playerid) { ...@@ -1145,10 +1145,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
...@@ -1645,27 +1645,27 @@ int32 field::filter_field_card(uint8 self, uint32 location1, uint32 location2, g ...@@ -1645,27 +1645,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;
...@@ -1932,7 +1932,7 @@ int32 field::get_overlay_count(uint8 self, uint8 s, uint8 o) { ...@@ -1932,7 +1932,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;
...@@ -2809,7 +2809,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2809,7 +2809,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(); }))
...@@ -2866,7 +2866,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2866,7 +2866,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) {
...@@ -3318,7 +3318,7 @@ chain* field::get_chain(uint32 chaincount) { ...@@ -3318,7 +3318,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;
} }
......
...@@ -267,7 +267,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) { ...@@ -267,7 +267,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)
...@@ -291,7 +291,7 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) { ...@@ -291,7 +291,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: {
...@@ -524,7 +524,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg ...@@ -524,7 +524,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--;
...@@ -546,9 +546,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) { ...@@ -546,9 +546,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--;
...@@ -582,9 +582,9 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i ...@@ -582,9 +582,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);
...@@ -645,7 +645,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va ...@@ -645,7 +645,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) {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,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.
...@@ -27,12 +27,12 @@ int32 scriptlib::debug_message(lua_State *L) { ...@@ -27,12 +27,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;
...@@ -71,7 +71,7 @@ int32 scriptlib::debug_add_card(lua_State *L) { ...@@ -71,7 +71,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)
...@@ -85,10 +85,10 @@ int32 scriptlib::debug_add_card(lua_State *L) { ...@@ -85,10 +85,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;
...@@ -100,10 +100,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) { ...@@ -100,10 +100,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;
} }
...@@ -138,8 +138,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -138,8 +138,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;
...@@ -156,8 +156,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -156,8 +156,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)
...@@ -184,7 +184,7 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) { ...@@ -184,7 +184,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);
...@@ -202,7 +202,7 @@ int32 scriptlib::debug_show_hint(lua_State *L) { ...@@ -202,7 +202,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.
...@@ -96,7 +96,7 @@ int32 scriptlib::effect_set_description(lua_State *L) { ...@@ -96,7 +96,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;
} }
...@@ -104,7 +104,7 @@ int32 scriptlib::effect_set_code(lua_State *L) { ...@@ -104,7 +104,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;
} }
...@@ -112,7 +112,7 @@ int32 scriptlib::effect_set_range(lua_State *L) { ...@@ -112,7 +112,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;
} }
...@@ -120,8 +120,8 @@ int32 scriptlib::effect_set_target_range(lua_State *L) { ...@@ -120,8 +120,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;
...@@ -131,9 +131,9 @@ int32 scriptlib::effect_set_absolute_range(lua_State *L) { ...@@ -131,9 +131,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;
...@@ -148,10 +148,10 @@ int32 scriptlib::effect_set_count_limit(lua_State *L) { ...@@ -148,10 +148,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;
...@@ -164,8 +164,8 @@ int32 scriptlib::effect_set_reset(lua_State *L) { ...@@ -164,8 +164,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)))
...@@ -178,7 +178,7 @@ int32 scriptlib::effect_set_type(lua_State *L) { ...@@ -178,7 +178,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
...@@ -199,8 +199,8 @@ int32 scriptlib::effect_set_property(lua_State *L) { ...@@ -199,8 +199,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;
...@@ -211,7 +211,7 @@ int32 scriptlib::effect_set_label(lua_State *L) { ...@@ -211,7 +211,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;
...@@ -241,7 +241,7 @@ int32 scriptlib::effect_set_category(lua_State *L) { ...@@ -241,7 +241,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;
} }
...@@ -249,10 +249,10 @@ int32 scriptlib::effect_set_hint_timing(lua_State *L) { ...@@ -249,10 +249,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;
...@@ -301,9 +301,9 @@ int32 scriptlib::effect_set_value(lua_State *L) { ...@@ -301,9 +301,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;
} }
...@@ -324,7 +324,7 @@ int32 scriptlib::effect_set_owner_player(lua_State *L) { ...@@ -324,7 +324,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;
...@@ -382,7 +382,7 @@ int32 scriptlib::effect_get_label(lua_State *L) { ...@@ -382,7 +382,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;
} }
...@@ -490,7 +490,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) { ...@@ -490,7 +490,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
...@@ -501,8 +501,8 @@ int32 scriptlib::effect_is_has_property(lua_State *L) { ...@@ -501,8 +501,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
...@@ -513,7 +513,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) { ...@@ -513,7 +513,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
...@@ -524,7 +524,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -524,7 +524,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
...@@ -534,7 +534,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -534,7 +534,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;
...@@ -571,7 +571,7 @@ int32 scriptlib::effect_check_count_limit(lua_State *L) { ...@@ -571,7 +571,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;
} }
...@@ -579,12 +579,12 @@ int32 scriptlib::effect_use_count_limit(lua_State *L) { ...@@ -579,12 +579,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,13 +332,13 @@ int32 scriptlib::group_random_select(lua_State *L) { ...@@ -332,13 +332,13 @@ 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);
int32 no_hint = lua_toboolean(L, 4); int32 no_hint = lua_toboolean(L, 4);
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;
...@@ -347,7 +347,7 @@ int32 scriptlib::group_random_select(lua_State *L) { ...@@ -347,7 +347,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);
...@@ -381,7 +381,7 @@ int32 scriptlib::group_is_exists(lua_State *L) { ...@@ -381,7 +381,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;
...@@ -403,16 +403,16 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) { ...@@ -403,16 +403,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())
...@@ -431,12 +431,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -431,12 +431,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)
...@@ -448,7 +448,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -448,7 +448,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);
...@@ -462,7 +462,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -462,7 +462,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);
...@@ -478,10 +478,10 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) { ...@@ -478,10 +478,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())
...@@ -500,10 +500,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -500,10 +500,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) {
...@@ -511,7 +511,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -511,7 +511,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);
...@@ -525,7 +525,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -525,7 +525,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;
...@@ -89,7 +89,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) { ...@@ -89,7 +89,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) {
...@@ -98,7 +98,7 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) { ...@@ -98,7 +98,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;
} }
} }
...@@ -167,7 +167,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner, ...@@ -167,7 +167,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:
...@@ -175,7 +175,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner, ...@@ -175,7 +175,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;
} }
...@@ -219,15 +219,15 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uin ...@@ -219,15 +219,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)
...@@ -300,7 +300,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -300,7 +300,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;
} }
...@@ -313,14 +313,14 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) { ...@@ -313,14 +313,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.
...@@ -28,6 +28,10 @@ void field::add_process(uint16 type, uint16 step, effect* peffect, group* target ...@@ -28,6 +28,10 @@ void field::add_process(uint16 type, uint16 step, effect* peffect, group* target
new_unit.ptr2 = ptr2; new_unit.ptr2 = ptr2;
core.subunits.push_back(new_unit); core.subunits.push_back(new_unit);
} }
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4244)
#endif
int32 field::process() { int32 field::process() {
if (core.subunits.size()) if (core.subunits.size())
core.units.splice(core.units.begin(), core.subunits); core.units.splice(core.units.begin(), core.subunits);
...@@ -662,7 +666,7 @@ int32 field::process() { ...@@ -662,7 +666,7 @@ int32 field::process() {
uint8 target_player = it->arg1 >> 16; uint8 target_player = it->arg1 >> 16;
uint8 count = it->arg2, i = 0; uint8 count = it->arg2, i = 0;
if(count > player[target_player].list_main.size()) if(count > player[target_player].list_main.size())
count = player[target_player].list_main.size(); count = (uint8)player[target_player].list_main.size();
if(it->step == 0) { if(it->step == 0) {
core.select_cards.clear(); core.select_cards.clear();
for(auto clit = player[target_player].list_main.rbegin(); i < count; ++i, ++clit) for(auto clit = player[target_player].list_main.rbegin(); i < count; ++i, ++clit)
...@@ -678,7 +682,7 @@ int32 field::process() { ...@@ -678,7 +682,7 @@ int32 field::process() {
tc[(uint8)returns.bvalue[i]] = core.select_cards[i]; tc[(uint8)returns.bvalue[i]] = core.select_cards[i];
for(i = 0; i < count; ++i) { for(i = 0; i < count; ++i) {
player[target_player].list_main.push_back(tc[count - i - 1]); player[target_player].list_main.push_back(tc[count - i - 1]);
tc[count - i - 1]->current.sequence = player[target_player].list_main.size() - 1; tc[count - i - 1]->current.sequence = (uint8)player[target_player].list_main.size() - 1;
} }
} }
if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) { if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) {
...@@ -711,6 +715,9 @@ int32 field::process() { ...@@ -711,6 +715,9 @@ int32 field::process() {
} }
return pduel->bufferlen; return pduel->bufferlen;
} }
#ifdef _MSC_VER
#pragma warning(pop)
#endif
int32 field::execute_cost(uint16 step, effect * triggering_effect, uint8 triggering_player) { int32 field::execute_cost(uint16 step, effect * triggering_effect, uint8 triggering_player) {
if(!triggering_effect->cost) { if(!triggering_effect->cost) {
core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event); core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event);
...@@ -740,7 +747,7 @@ int32 field::execute_cost(uint16 step, effect * triggering_effect, uint8 trigger ...@@ -740,7 +747,7 @@ int32 field::execute_cost(uint16 step, effect * triggering_effect, uint8 trigger
} }
core.reason_effect = triggering_effect; core.reason_effect = triggering_effect;
core.reason_player = triggering_player; core.reason_player = triggering_player;
uint32 count = pduel->lua->params.size(); uint32 count = (uint32)pduel->lua->params.size();
uint32 yield_value = 0; uint32 yield_value = 0;
int32 result = pduel->lua->call_coroutine(triggering_effect->cost, count, &yield_value, step); int32 result = pduel->lua->call_coroutine(triggering_effect->cost, count, &yield_value, step);
returns.ivalue[0] = yield_value; returns.ivalue[0] = yield_value;
...@@ -791,7 +798,7 @@ int32 field::execute_operation(uint16 step, effect * triggering_effect, uint8 tr ...@@ -791,7 +798,7 @@ int32 field::execute_operation(uint16 step, effect * triggering_effect, uint8 tr
} }
core.reason_effect = triggering_effect; core.reason_effect = triggering_effect;
core.reason_player = triggering_player; core.reason_player = triggering_player;
uint32 count = pduel->lua->params.size(); uint32 count = (uint32)pduel->lua->params.size();
uint32 yield_value = 0; uint32 yield_value = 0;
int32 result = pduel->lua->call_coroutine(triggering_effect->operation, count, &yield_value, step); int32 result = pduel->lua->call_coroutine(triggering_effect->operation, count, &yield_value, step);
returns.ivalue[0] = yield_value; returns.ivalue[0] = yield_value;
...@@ -847,7 +854,7 @@ int32 field::execute_target(uint16 step, effect * triggering_effect, uint8 trigg ...@@ -847,7 +854,7 @@ int32 field::execute_target(uint16 step, effect * triggering_effect, uint8 trigg
} }
core.reason_effect = triggering_effect; core.reason_effect = triggering_effect;
core.reason_player = triggering_player; core.reason_player = triggering_player;
uint32 count = pduel->lua->params.size(); uint32 count = (uint32)pduel->lua->params.size();
uint32 yield_value = 0; uint32 yield_value = 0;
int32 result = pduel->lua->call_coroutine(triggering_effect->target, count, &yield_value, step); int32 result = pduel->lua->call_coroutine(triggering_effect->target, count, &yield_value, step);
returns.ivalue[0] = yield_value; returns.ivalue[0] = yield_value;
...@@ -1223,7 +1230,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1223,7 +1230,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
filter_player_effect(infos.turn_player, EFFECT_HAND_LIMIT, &eset); filter_player_effect(infos.turn_player, EFFECT_HAND_LIMIT, &eset);
if(eset.size()) if(eset.size())
limit = eset.get_last()->get_value(); limit = eset.get_last()->get_value();
int32 hd = player[infos.turn_player].list_hand.size(); int32 hd = (int32)player[infos.turn_player].list_hand.size();
if(hd <= limit) { if(hd <= limit) {
core.units.begin()->step = 24; core.units.begin()->step = 24;
return FALSE; return FALSE;
...@@ -1698,7 +1705,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori ...@@ -1698,7 +1705,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
core.select_chains.push_back(newchain); core.select_chains.push_back(newchain);
} }
} }
core.spe_effect[priority] = core.select_chains.size(); core.spe_effect[priority] = (int32)core.select_chains.size();
if(!skip_freechain) { if(!skip_freechain) {
nil_event.event_code = EVENT_FREE_CHAIN; nil_event.event_code = EVENT_FREE_CHAIN;
auto pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN); auto pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
...@@ -1739,7 +1746,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori ...@@ -1739,7 +1746,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
} }
} }
if(core.current_chain.size() || (core.hint_timing[0] & TIMING_ATTACK) || (core.hint_timing[1] & TIMING_ATTACK)) if(core.current_chain.size() || (core.hint_timing[0] & TIMING_ATTACK) || (core.hint_timing[1] & TIMING_ATTACK))
core.spe_effect[priority] = core.select_chains.size(); core.spe_effect[priority] = (int32)core.select_chains.size();
add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, priority, core.spe_effect[priority]); add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, priority, core.spe_effect[priority]);
return FALSE; return FALSE;
} }
...@@ -2305,7 +2312,7 @@ int32 field::process_idle_command(uint16 step) { ...@@ -2305,7 +2312,7 @@ int32 field::process_idle_command(uint16 step) {
return FALSE; return FALSE;
} }
case 11: { case 11: {
returns.ivalue[0] = core.units.begin()->arg1; returns.ivalue[0] = (int32)core.units.begin()->arg1;
infos.can_shuffle = TRUE; infos.can_shuffle = TRUE;
return TRUE; return TRUE;
} }
...@@ -2957,7 +2964,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2957,7 +2964,7 @@ int32 field::process_battle_command(uint16 step) {
core.attacker->battled_cards.addcard(core.attack_target); core.attacker->battled_cards.addcard(core.attack_target);
if(core.attack_target) if(core.attack_target)
core.attack_target->battled_cards.addcard(core.attacker); core.attack_target->battled_cards.addcard(core.attacker);
uint8 reason_player = core.temp_var[0]; uint8 reason_player = (uint8)core.temp_var[0];
card* reason_card = 0; card* reason_card = 0;
if(core.temp_var[1] == 1) if(core.temp_var[1] == 1)
reason_card = core.attacker; reason_card = core.attacker;
...@@ -3200,8 +3207,8 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3200,8 +3207,8 @@ int32 field::process_battle_command(uint16 step) {
case 42: { case 42: {
core.attacker = 0; core.attacker = 0;
core.attack_target = 0; core.attack_target = 0;
returns.ivalue[0] = core.units.begin()->arg1; returns.ivalue[0] = (int32)core.units.begin()->arg1;
returns.ivalue[1] = core.units.begin()->arg2; returns.ivalue[1] = (int32)core.units.begin()->arg2;
return TRUE; return TRUE;
} }
} }
...@@ -3271,7 +3278,7 @@ int32 field::process_damage_step(uint16 step, uint32 new_attack) { ...@@ -3271,7 +3278,7 @@ int32 field::process_damage_step(uint16 step, uint32 new_attack) {
if(core.attack_target) if(core.attack_target)
core.attack_target->set_status(STATUS_ATTACK_CANCELED, TRUE); core.attack_target->set_status(STATUS_ATTACK_CANCELED, TRUE);
core.effect_damage_step = 0; core.effect_damage_step = 0;
infos.phase = core.units.begin()->arg1; infos.phase = (uint16)core.units.begin()->arg1;
return TRUE; return TRUE;
} }
} }
...@@ -4005,7 +4012,7 @@ int32 field::add_chain(uint16 step) { ...@@ -4005,7 +4012,7 @@ int32 field::add_chain(uint16 step) {
pduel->write_buffer8((uint8)clit.triggering_location); pduel->write_buffer8((uint8)clit.triggering_location);
pduel->write_buffer8(clit.triggering_sequence); pduel->write_buffer8(clit.triggering_sequence);
pduel->write_buffer32(peffect->description); pduel->write_buffer32(peffect->description);
pduel->write_buffer8(core.current_chain.size() + 1); pduel->write_buffer8((uint8)core.current_chain.size() + 1);
break_effect(); break_effect();
for(auto& ch_lim : core.chain_limit) for(auto& ch_lim : core.chain_limit)
luaL_unref(pduel->lua->lua_state, LUA_REGISTRYINDEX, ch_lim.function); luaL_unref(pduel->lua->lua_state, LUA_REGISTRYINDEX, ch_lim.function);
...@@ -4015,7 +4022,7 @@ int32 field::add_chain(uint16 step) { ...@@ -4015,7 +4022,7 @@ int32 field::add_chain(uint16 step) {
peffect->card_type -= TYPE_TRAP; peffect->card_type -= TYPE_TRAP;
peffect->set_active_type(); peffect->set_active_type();
peffect->active_handler = peffect->handler->overlay_target; peffect->active_handler = peffect->handler->overlay_target;
clit.chain_count = core.current_chain.size() + 1; clit.chain_count = (uint8)core.current_chain.size() + 1;
clit.target_cards = 0; clit.target_cards = 0;
clit.target_player = PLAYER_NONE; clit.target_player = PLAYER_NONE;
clit.target_param = 0; clit.target_param = 0;
...@@ -4255,7 +4262,7 @@ int32 field::solve_continuous(uint16 step) { ...@@ -4255,7 +4262,7 @@ int32 field::solve_continuous(uint16 step) {
effect* peffect = clit.triggering_effect; effect* peffect = clit.triggering_effect;
uint8 triggering_player = clit.triggering_player; uint8 triggering_player = clit.triggering_player;
core.reason_effect = (effect*)core.units.begin()->ptarget; core.reason_effect = (effect*)core.units.begin()->ptarget;
core.reason_player = core.units.begin()->arg2; core.reason_player = (uint8)core.units.begin()->arg2;
if(core.continuous_chain.back().target_cards) if(core.continuous_chain.back().target_cards)
pduel->delete_group(core.continuous_chain.back().target_cards); pduel->delete_group(core.continuous_chain.back().target_cards);
for(auto& oit : core.continuous_chain.back().opinfos) { for(auto& oit : core.continuous_chain.back().opinfos) {
...@@ -4393,7 +4400,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2 ...@@ -4393,7 +4400,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
case 3: { case 3: {
effect* peffect = cait->triggering_effect; effect* peffect = cait->triggering_effect;
if(core.units.begin()->arg4) { if(core.units.begin()->arg4) {
peffect->operation = core.units.begin()->arg4; peffect->operation = (int32)core.units.begin()->arg4;
} }
core.special_summoning.clear(); core.special_summoning.clear();
core.equiping_cards.clear(); core.equiping_cards.clear();
...@@ -4701,7 +4708,7 @@ int32 field::refresh_location_info(uint16 step) { ...@@ -4701,7 +4708,7 @@ int32 field::refresh_location_info(uint16 step) {
return FALSE; return FALSE;
} }
case 4: { case 4: {
uint32 dis_count = core.units.begin()->arg1; uint32 dis_count = (uint32)core.units.begin()->arg1;
uint32 mzone_flag = 0; uint32 mzone_flag = 0;
uint8 pt = 0; uint8 pt = 0;
for(uint32 i = 0; i < dis_count; ++i) { for(uint32 i = 0; i < dis_count; ++i) {
...@@ -4740,7 +4747,7 @@ int32 field::refresh_location_info(uint16 step) { ...@@ -4740,7 +4747,7 @@ int32 field::refresh_location_info(uint16 step) {
return FALSE; return FALSE;
} }
case 6: { case 6: {
uint32 dis_count = core.units.begin()->arg1; uint32 dis_count = (uint32)core.units.begin()->arg1;
uint32 szone_flag = 0; uint32 szone_flag = 0;
uint8 pt = 0; uint8 pt = 0;
for(uint32 i = 0; i < dis_count; ++i) { for(uint32 i = 0; i < dis_count; ++i) {
......
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