Commit d5158743 authored by Chen Bill's avatar Chen Bill

using card_set in global

parent 3d3341a3
......@@ -24,6 +24,8 @@ class effect;
class group;
struct chain;
using card_set = std::set<card*, card_sort>;
struct card_state {
uint32 code{ 0 };
uint32 code2{ 0 };
......@@ -115,7 +117,6 @@ public:
};
using card_vector = std::vector<card*>;
using effect_container = std::multimap<uint32, effect*>;
using card_set = std::set<card*, card_sort>;
using effect_indexer = std::unordered_map<effect*, effect_container::iterator>;
using effect_relation = std::unordered_set<std::pair<effect*, uint16>, effect_relation_hash>;
using relation_map = std::unordered_map<card*, uint32>;
......
......@@ -20,9 +20,10 @@ class effect;
class field;
class interpreter;
using card_set = std::set<card*, card_sort>;
class duel {
public:
using card_set = std::set<card*, card_sort>;
char strbuffer[256];
std::vector<byte> message_buffer;
interpreter* lua;
......
......@@ -178,7 +178,6 @@ struct processor {
using instant_f_list = std::map<effect*, chain>;
using chain_array = std::vector<chain>;
using processor_list = std::list<processor_unit>;
using card_set = std::set<card*, card_sort>;
using delayed_effect_collection = std::set<std::pair<effect*, tevent>>;
struct chain_limit_t {
chain_limit_t(int32 f, int32 p): function(f), player(p) {}
......@@ -365,7 +364,6 @@ struct processor {
class field {
public:
using effect_container = std::multimap<uint32, effect*>;
using card_set = std::set<card*, card_sort>;
using effect_vector = std::vector<effect*>;
using card_vector = std::vector<card*>;
using card_list = std::list<card*>;
......
......@@ -16,9 +16,10 @@
class card;
class duel;
using card_set = std::set<card*, card_sort>;
class group {
public:
using card_set = std::set<card*, card_sort>;
duel* pduel;
card_set container;
card_set::iterator it;
......
......@@ -411,7 +411,7 @@ int32 scriptlib::card_get_linked_group(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
card::card_set cset;
card_set cset;
pcard->get_linked_cards(&cset);
group* pgroup = pcard->pduel->new_group(cset);
interpreter::group2value(L, pgroup);
......@@ -421,7 +421,7 @@ int32 scriptlib::card_get_linked_group_count(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
card::card_set cset;
card_set cset;
pcard->get_linked_cards(&cset);
lua_pushinteger(L, cset.size());
return 1;
......@@ -444,7 +444,7 @@ int32 scriptlib::card_get_mutual_linked_group(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**)lua_touserdata(L, 1);
card::card_set cset;
card_set cset;
pcard->get_mutual_linked_cards(&cset);
group* pgroup = pcard->pduel->new_group(cset);
interpreter::group2value(L, pgroup);
......@@ -454,7 +454,7 @@ int32 scriptlib::card_get_mutual_linked_group_count(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**)lua_touserdata(L, 1);
card::card_set cset;
card_set cset;
pcard->get_mutual_linked_cards(&cset);
lua_pushinteger(L, cset.size());
return 1;
......@@ -491,7 +491,7 @@ int32 scriptlib::card_get_column_group(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
card::card_set cset;
card_set cset;
pcard->get_column_cards(&cset);
group* pgroup = pcard->pduel->new_group(cset);
interpreter::group2value(L, pgroup);
......@@ -501,7 +501,7 @@ int32 scriptlib::card_get_column_group_count(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
card::card_set cset;
card_set cset;
pcard->get_column_cards(&cset);
lua_pushinteger(L, cset.size());
return 1;
......
......@@ -577,7 +577,7 @@ int32 scriptlib::duel_special_summon(lua_State *L) {
if(lua_gettop(L) >= 8)
zone = (uint32)lua_tointeger(L, 8);
if(pcard) {
field::card_set cset;
card_set cset;
cset.insert(pcard);
pduel->game_field->special_summon(&cset, sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
} else
......@@ -807,7 +807,7 @@ int32 scriptlib::duel_change_form(lua_State *L) {
if(top > 4) dd = (uint32)lua_tointeger(L, 5);
if(top > 5 && lua_toboolean(L, 6)) flag |= NO_FLIP_EFFECT;
if(pcard) {
field::card_set cset;
card_set cset;
cset.insert(pcard);
pduel->game_field->change_position(&cset, pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, flag, TRUE);
} else
......@@ -934,7 +934,7 @@ int32 scriptlib::duel_swap_sequence(lua_State *L) {
&& pcard1->is_affect_by_effect(pduel->game_field->core.reason_effect)
&& pcard2->is_affect_by_effect(pduel->game_field->core.reason_effect)) {
pduel->game_field->swap_card(pcard1, pcard2);
field::card_set swapped;
card_set swapped;
swapped.insert(pcard1);
swapped.insert(pcard2);
pduel->game_field->raise_single_event(pcard1, 0, EVENT_MOVE, pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, player, 0);
......@@ -1363,7 +1363,7 @@ int32 scriptlib::duel_equip(lua_State *L) {
}
int32 scriptlib::duel_equip_complete(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
field::card_set etargets;
card_set etargets;
for(auto& equip_card : pduel->game_field->core.equiping_cards) {
if(equip_card->is_position(POS_FACEUP))
equip_card->enable_field_effect(true);
......@@ -1865,7 +1865,7 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
}
uint8 sumplayer = PLAYER_NONE;
effect* reason_effect = pduel->game_field->core.reason_effect;
field::card_set negated_cards;
card_set negated_cards;
if (sumtype == SUMMON_TYPE_DUAL || sumtype & SUMMON_TYPE_FLIP) {
if (!pcard->is_summon_negatable(sumtype, reason_effect))
return 0;
......@@ -2124,7 +2124,7 @@ int32 scriptlib::duel_get_linked_group(lua_State *L) {
uint32 s = (uint32)lua_tointeger(L, 2);
uint32 o = (uint32)lua_tointeger(L, 3);
duel* pduel = interpreter::get_duel_info(L);
field::card_set cset;
card_set cset;
pduel->game_field->get_linked_cards(rplayer, s, o, &cset);
group* pgroup = pduel->new_group(cset);
interpreter::group2value(L, pgroup);
......@@ -2138,7 +2138,7 @@ int32 scriptlib::duel_get_linked_group_count(lua_State *L) {
uint32 s = (uint32)lua_tointeger(L, 2);
uint32 o = (uint32)lua_tointeger(L, 3);
duel* pduel = interpreter::get_duel_info(L);
field::card_set cset;
card_set cset;
pduel->game_field->get_linked_cards(rplayer, s, o, &cset);
lua_pushinteger(L, cset.size());
return 1;
......@@ -3184,7 +3184,7 @@ int32 scriptlib::duel_get_synchro_material(lua_State *L) {
if (lua_gettop(L) >= 2)
facedown = lua_toboolean(L, 2);
duel* pduel = interpreter::get_duel_info(L);
group::card_set mats;
card_set mats;
pduel->game_field->get_synchro_material(playerid, &mats);
group* pgroup = pduel->new_group();
for (auto cit = mats.begin(); cit != mats.end(); ++cit) {
......@@ -3222,7 +3222,7 @@ int32 scriptlib::duel_select_synchro_material(lua_State *L) {
}
auto filter1 = interpreter::get_function_handle(L, 3);
auto filter2 = interpreter::get_function_handle(L, 4);
field::card_set select_cards;
card_set select_cards;
if (mg) {
for (auto& pm : mg->container) {
if (pduel->game_field->check_tuner_material(L, pcard, pm, 3, 4, min, max, nullptr, mg))
......@@ -3232,7 +3232,7 @@ int32 scriptlib::duel_select_synchro_material(lua_State *L) {
pduel->game_field->add_process(PROCESSOR_SELECT_SYNCHRO, 0, nullptr, nullptr, playerid, min + (max << 16), filter1, filter2, pcard, mg);
}
else {
field::card_set material;
card_set material;
pduel->game_field->get_synchro_material(playerid, &material);
for (auto& tuner : material) {
if (pduel->game_field->check_tuner_material(L, pcard, tuner, 3, 4, min, max, smat, nullptr))
......@@ -3631,7 +3631,7 @@ int32 scriptlib::duel_overlay(lua_State *L) {
} else
return luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 2);
if(pcard) {
card::card_set cset;
card_set cset;
cset.insert(pcard);
target->xyz_overlay(&cset);
} else
......
......@@ -138,7 +138,7 @@ int32 scriptlib::group_filter(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 1);
check_param(L, PARAM_TYPE_FUNCTION, 2);
group* pgroup = *(group**) lua_touserdata(L, 1);
field::card_set cset(pgroup->container);
card_set cset(pgroup->container);
if(check_param(L, PARAM_TYPE_CARD, 3, TRUE)) {
card* pexception = *(card**) lua_touserdata(L, 3);
cset.erase(pexception);
......@@ -163,7 +163,7 @@ int32 scriptlib::group_filter_count(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 1);
check_param(L, PARAM_TYPE_FUNCTION, 2);
group* pgroup = *(group**) lua_touserdata(L, 1);
field::card_set cset(pgroup->container);
card_set cset(pgroup->container);
if(check_param(L, PARAM_TYPE_CARD, 3, TRUE)) {
card* pexception = *(card**) lua_touserdata(L, 3);
cset.erase(pexception);
......@@ -188,7 +188,7 @@ int32 scriptlib::group_filter_select(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 1);
check_param(L, PARAM_TYPE_FUNCTION, 3);
group* pgroup = *(group**) lua_touserdata(L, 1);
field::card_set cset(pgroup->container);
card_set cset(pgroup->container);
if(check_param(L, PARAM_TYPE_CARD, 6, TRUE)) {
card* pexception = *(card**) lua_touserdata(L, 6);
cset.erase(pexception);
......@@ -226,7 +226,7 @@ int32 scriptlib::group_select(lua_State *L) {
check_param_count(L, 5);
check_param(L, PARAM_TYPE_GROUP, 1);
group* pgroup = *(group**) lua_touserdata(L, 1);
field::card_set cset(pgroup->container);
card_set cset(pgroup->container);
if(check_param(L, PARAM_TYPE_CARD, 5, TRUE)) {
card* pexception = *(card**) lua_touserdata(L, 5);
cset.erase(pexception);
......@@ -364,7 +364,7 @@ int32 scriptlib::group_cancelable_select(lua_State *L) {
check_param_count(L, 5);
check_param(L, PARAM_TYPE_GROUP, 1);
group* pgroup = *(group**) lua_touserdata(L, 1);
field::card_set cset(pgroup->container);
card_set cset(pgroup->container);
if(check_param(L, PARAM_TYPE_CARD, 5, TRUE)) {
card* pexception = *(card**) lua_touserdata(L, 5);
cset.erase(pexception);
......@@ -404,7 +404,7 @@ int32 scriptlib::group_is_exists(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 1);
check_param(L, PARAM_TYPE_FUNCTION, 2);
group* pgroup = *(group**) lua_touserdata(L, 1);
field::card_set cset(pgroup->container);
card_set cset(pgroup->container);
if(check_param(L, PARAM_TYPE_CARD, 4, TRUE)) {
card* pexception = *(card**) lua_touserdata(L, 4);
cset.erase(pexception);
......@@ -839,7 +839,7 @@ int32 scriptlib::group_meta_band(lua_State* L) {
return luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 2);
duel* pduel = interpreter::get_duel_info(L);
group* pgroup = pduel->new_group();
field::card_set check_set;
card_set check_set;
if(check_param(L, PARAM_TYPE_CARD, 1, TRUE)) {
card* ccard = *(card**) lua_touserdata(L, 1);
check_set.insert(ccard);
......
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