Commit a4a88216 authored by fallenstardust's avatar fallenstardust

sync ocgcore

parent 5ebdc826
...@@ -43,9 +43,10 @@ bool card::card_operation_sort(card* c1, card* c2) { ...@@ -43,9 +43,10 @@ bool card::card_operation_sort(card* c1, card* c2) {
if(c1->current.location != c2->current.location) if(c1->current.location != c2->current.location)
return c1->current.location < c2->current.location; return c1->current.location < c2->current.location;
if(c1->current.location & LOCATION_OVERLAY) { if(c1->current.location & LOCATION_OVERLAY) {
if(c1->overlay_target->current.sequence != c2->overlay_target->current.sequence) if(c1->overlay_target && c2->overlay_target && c1->overlay_target->current.sequence != c2->overlay_target->current.sequence)
return c1->overlay_target->current.sequence < c2->overlay_target->current.sequence; return c1->overlay_target->current.sequence < c2->overlay_target->current.sequence;
else return c1->current.sequence < c2->current.sequence; else
return c1->current.sequence < c2->current.sequence;
} else { } else {
if(c1->current.location & (LOCATION_DECK | LOCATION_EXTRA | LOCATION_GRAVE | LOCATION_REMOVED)) if(c1->current.location & (LOCATION_DECK | LOCATION_EXTRA | LOCATION_GRAVE | LOCATION_REMOVED))
return c1->current.sequence > c2->current.sequence; return c1->current.sequence > c2->current.sequence;
......
...@@ -30,6 +30,8 @@ interpreter::interpreter(duel* pd): coroutines(256) { ...@@ -30,6 +30,8 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_setglobal(lua_state, "package"); lua_setglobal(lua_state, "package");
lua_pushnil(lua_state); lua_pushnil(lua_state);
lua_setglobal(lua_state, "debug"); lua_setglobal(lua_state, "debug");
lua_pushnil(lua_state);
lua_setglobal(lua_state, "coroutine");
luaL_getsubtable(lua_state, LUA_REGISTRYINDEX, "_LOADED"); luaL_getsubtable(lua_state, LUA_REGISTRYINDEX, "_LOADED");
lua_pushnil(lua_state); lua_pushnil(lua_state);
lua_setfield(lua_state, -2, "io"); lua_setfield(lua_state, -2, "io");
...@@ -39,6 +41,8 @@ interpreter::interpreter(duel* pd): coroutines(256) { ...@@ -39,6 +41,8 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_setfield(lua_state, -2, "package"); lua_setfield(lua_state, -2, "package");
lua_pushnil(lua_state); lua_pushnil(lua_state);
lua_setfield(lua_state, -2, "debug"); lua_setfield(lua_state, -2, "debug");
lua_pushnil(lua_state);
lua_setfield(lua_state, -2, "coroutine");
lua_pop(lua_state, 1); lua_pop(lua_state, 1);
//open all libs //open all libs
scriptlib::open_cardlib(lua_state); scriptlib::open_cardlib(lua_state);
......
...@@ -1804,7 +1804,7 @@ int32 scriptlib::duel_disable_summon(lua_State *L) { ...@@ -1804,7 +1804,7 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
pduel = pgroup->pduel; pduel = pgroup->pduel;
} else } else
return luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 1); return luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 1);
uint8 sumplayer; uint8 sumplayer = PLAYER_NONE;
if(pcard) { if(pcard) {
sumplayer = pcard->summon_player; sumplayer = pcard->summon_player;
pcard->set_status(STATUS_SUMMONING, FALSE); pcard->set_status(STATUS_SUMMONING, FALSE);
......
...@@ -265,7 +265,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint ...@@ -265,7 +265,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
} }
} }
else { else {
field::card_vector* lst = 0; field::card_vector* lst = nullptr;
if(location == LOCATION_HAND) if(location == LOCATION_HAND)
lst = &player.list_hand; lst = &player.list_hand;
else if(location == LOCATION_GRAVE) else if(location == LOCATION_GRAVE)
...@@ -276,6 +276,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint ...@@ -276,6 +276,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
lst = &player.list_extra; lst = &player.list_extra;
else if(location == LOCATION_DECK) else if(location == LOCATION_DECK)
lst = &player.list_main; lst = &player.list_main;
else
return 0;
for(auto& pcard : *lst) { for(auto& pcard : *lst) {
uint32 clen = pcard->get_infos(p, query_flag, use_cache); uint32 clen = pcard->get_infos(p, query_flag, use_cache);
p += clen; p += clen;
......
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