Commit 1529d09d authored by fallenstardust's avatar fallenstardust

update gframe remove BOOL

parent 25249028
...@@ -119,7 +119,6 @@ using namespace video; ...@@ -119,7 +119,6 @@ using namespace video;
using namespace io; using namespace io;
using namespace gui; using namespace gui;
using namespace os; using namespace os;
typedef int BOOL;
extern const unsigned short PRO_VERSION; extern const unsigned short PRO_VERSION;
extern int enable_log; extern int enable_log;
......
...@@ -50,13 +50,13 @@ public: ...@@ -50,13 +50,13 @@ public:
string_pointer strings_begin; string_pointer strings_begin;
string_pointer strings_end; string_pointer strings_end;
wchar_t numStrings[301][4]; wchar_t numStrings[301][4]{};
wchar_t numBuffer[6]; wchar_t numBuffer[6]{};
wchar_t attBuffer[128]; wchar_t attBuffer[128]{};
wchar_t racBuffer[128]; wchar_t racBuffer[128]{};
wchar_t tpBuffer[128]; wchar_t tpBuffer[128]{};
wchar_t scBuffer[128]; wchar_t scBuffer[128]{};
wchar_t lmBuffer[32]; wchar_t lmBuffer[32]{};
static byte scriptBuffer[0x20000]; static byte scriptBuffer[0x20000];
static const wchar_t* unknown_string; static const wchar_t* unknown_string;
......
...@@ -4122,9 +4122,9 @@ void DuelClient::BeginRefreshHost() { ...@@ -4122,9 +4122,9 @@ void DuelClient::BeginRefreshHost() {
SOCKET sSend = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); SOCKET sSend = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sSend == INVALID_SOCKET) if (sSend == INVALID_SOCKET)
return; return;
BOOL opt = TRUE; int opt = TRUE;
setsockopt(sSend, SOL_SOCKET, SO_BROADCAST, (const char*) &opt, setsockopt(sSend, SOL_SOCKET, SO_BROADCAST, (const char*) &opt,
sizeof(BOOL)); sizeof opt);
if (bind(sSend, (sockaddr*) &local, sizeof(sockaddr)) == SOCKET_ERROR) { if (bind(sSend, (sockaddr*) &local, sizeof(sockaddr)) == SOCKET_ERROR) {
closesocket(sSend); closesocket(sSend);
return; return;
...@@ -4141,8 +4141,8 @@ void DuelClient::BeginRefreshHost() { ...@@ -4141,8 +4141,8 @@ void DuelClient::BeginRefreshHost() {
SOCKET sSend = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); SOCKET sSend = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(sSend == INVALID_SOCKET) if(sSend == INVALID_SOCKET)
break; break;
BOOL opt = TRUE; int opt = TRUE;
setsockopt(sSend, SOL_SOCKET, SO_BROADCAST, (const char*)&opt, sizeof(BOOL)); setsockopt(sSend, SOL_SOCKET, SO_BROADCAST, (const char*)&opt, sizeof opt);
if(bind(sSend, (sockaddr*)&local, sizeof(sockaddr)) == SOCKET_ERROR) { if(bind(sSend, (sockaddr*)&local, sizeof(sockaddr)) == SOCKET_ERROR) {
closesocket(sSend); closesocket(sSend);
break; break;
......
...@@ -40,9 +40,9 @@ bool NetServer::StartBroadcast() { ...@@ -40,9 +40,9 @@ bool NetServer::StartBroadcast() {
if(!net_evbase) if(!net_evbase)
return false; return false;
SOCKET udp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); SOCKET udp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
BOOL opt = TRUE; int opt = TRUE;
setsockopt(udp, SOL_SOCKET, SO_BROADCAST, (const char*)&opt, sizeof(BOOL)); setsockopt(udp, SOL_SOCKET, SO_BROADCAST, (const char*)&opt, sizeof opt);
setsockopt(udp, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(BOOL)); setsockopt(udp, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof opt);
sockaddr_in addr; sockaddr_in addr;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
......
...@@ -260,11 +260,13 @@ void field::send_to(card_set* targets, effect* reason_effect, uint32 reason, uin ...@@ -260,11 +260,13 @@ void field::send_to(card_set* targets, effect* reason_effect, uint32 reason, uin
return; return;
for(auto& pcard : *targets) { for(auto& pcard : *targets) {
pcard->temp.reason = pcard->current.reason; pcard->temp.reason = pcard->current.reason;
pcard->current.reason = reason;
if(reason_player != PLAYER_SELFDES) {
pcard->temp.reason_effect = pcard->current.reason_effect; pcard->temp.reason_effect = pcard->current.reason_effect;
pcard->temp.reason_player = pcard->current.reason_player; pcard->temp.reason_player = pcard->current.reason_player;
pcard->current.reason = reason;
pcard->current.reason_effect = reason_effect; pcard->current.reason_effect = reason_effect;
pcard->current.reason_player = reason_player; pcard->current.reason_player = reason_player;
}
uint32 p = playerid; uint32 p = playerid;
// send to hand from deck and playerid not given => send to the hand of controler // send to hand from deck and playerid not given => send to the hand of controler
if(p == PLAYER_NONE && (destination & LOCATION_HAND) && (pcard->current.location & LOCATION_DECK) && pcard->current.controler == reason_player) if(p == PLAYER_NONE && (destination & LOCATION_HAND) && (pcard->current.location & LOCATION_DECK) && pcard->current.controler == reason_player)
...@@ -1273,7 +1275,7 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) { ...@@ -1273,7 +1275,7 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
pcard->temp.reason_player = pcard->current.reason_player; pcard->temp.reason_player = pcard->current.reason_player;
pcard->current.reason_effect = peffect; pcard->current.reason_effect = peffect;
pcard->current.reason_player = peffect->get_handler_player(); pcard->current.reason_player = peffect->get_handler_player();
send_to(pcard, 0, REASON_EFFECT, PLAYER_NONE, PLAYER_NONE, LOCATION_GRAVE, 0, POS_FACEUP); send_to(pcard, 0, REASON_EFFECT, PLAYER_SELFDES, PLAYER_NONE, LOCATION_GRAVE, 0, POS_FACEUP);
} }
core.self_tograve_set.erase(it); core.self_tograve_set.erase(it);
core.units.begin()->step = 19; core.units.begin()->step = 19;
...@@ -3155,6 +3157,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin ...@@ -3155,6 +3157,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
return FALSE; return FALSE;
} }
case 29: { case 29: {
effect* peffect = core.units.begin()->peffect;
group* pgroup = core.units.begin()->ptarget; group* pgroup = core.units.begin()->ptarget;
pduel->write_buffer8(MSG_SPSUMMONED); pduel->write_buffer8(MSG_SPSUMMONED);
set_spsummon_counter(sumplayer); set_spsummon_counter(sumplayer);
...@@ -3163,14 +3166,14 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin ...@@ -3163,14 +3166,14 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
for(auto& pcard : pgroup->container) { for(auto& pcard : pgroup->container) {
if(pcard->spsummon_code) if(pcard->spsummon_code)
spsummon_once_set.insert(pcard->spsummon_code); spsummon_once_set.insert(pcard->spsummon_code);
pcard->set_special_summon_status(pcard->current.reason_effect); pcard->set_special_summon_status(peffect);
} }
for(auto& cit : spsummon_once_set) for(auto& cit : spsummon_once_set)
++core.spsummon_once_map[sumplayer][cit]; ++core.spsummon_once_map[sumplayer][cit];
for(auto& pcard : pgroup->container) for(auto& pcard : pgroup->container)
raise_single_event(pcard, 0, EVENT_SPSUMMON_SUCCESS, pcard->current.reason_effect, 0, pcard->current.reason_player, pcard->summon_player, 0); raise_single_event(pcard, 0, EVENT_SPSUMMON_SUCCESS, peffect, 0, sumplayer, pcard->summon_player, 0);
process_single_event(); process_single_event();
raise_event(&pgroup->container, EVENT_SPSUMMON_SUCCESS, core.units.begin()->peffect, 0, sumplayer, sumplayer, 0); raise_event(&pgroup->container, EVENT_SPSUMMON_SUCCESS, peffect, 0, sumplayer, sumplayer, 0);
process_instant_event(); process_instant_event();
if(action_type == SUMMON_IN_IDLE) { if(action_type == SUMMON_IN_IDLE) {
adjust_all(); adjust_all();
...@@ -3366,9 +3369,9 @@ int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_pla ...@@ -3366,9 +3369,9 @@ int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_pla
pduel->write_buffer8(MSG_SPSUMMONED); pduel->write_buffer8(MSG_SPSUMMONED);
for(auto& pcard : targets->container) { for(auto& pcard : targets->container) {
check_card_counter(pcard, ACTIVITY_SPSUMMON, pcard->summon_player); check_card_counter(pcard, ACTIVITY_SPSUMMON, pcard->summon_player);
pcard->set_special_summon_status(pcard->current.reason_effect); pcard->set_special_summon_status(reason_effect);
if(!(pcard->current.position & POS_FACEDOWN)) if(!(pcard->current.position & POS_FACEDOWN))
raise_single_event(pcard, 0, EVENT_SPSUMMON_SUCCESS, pcard->current.reason_effect, 0, pcard->current.reason_player, pcard->summon_player, 0); raise_single_event(pcard, 0, EVENT_SPSUMMON_SUCCESS, reason_effect, 0, reason_player, pcard->summon_player, 0);
int32 summontype = pcard->summon_info & (SUMMON_VALUE_MAIN_TYPE | SUMMON_VALUE_SUB_TYPE); int32 summontype = pcard->summon_info & (SUMMON_VALUE_MAIN_TYPE | SUMMON_VALUE_SUB_TYPE);
int32 custom_type = pcard->summon_info & SUMMON_VALUE_CUSTOM_TYPE; int32 custom_type = pcard->summon_info & SUMMON_VALUE_CUSTOM_TYPE;
if(summontype && pcard->material_cards.size() && custom_type != SUMMON_VALUE_FUTURE_FUSION) { if(summontype && pcard->material_cards.size() && custom_type != SUMMON_VALUE_FUTURE_FUSION) {
...@@ -3382,7 +3385,7 @@ int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_pla ...@@ -3382,7 +3385,7 @@ int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_pla
else if(summontype == SUMMON_TYPE_LINK) else if(summontype == SUMMON_TYPE_LINK)
matreason = REASON_LINK; matreason = REASON_LINK;
for(auto& mcard : pcard->material_cards) for(auto& mcard : pcard->material_cards)
raise_single_event(mcard, &targets->container, EVENT_BE_MATERIAL, pcard->current.reason_effect, matreason, pcard->current.reason_player, pcard->summon_player, 0); raise_single_event(mcard, &targets->container, EVENT_BE_MATERIAL, reason_effect, matreason, reason_player, pcard->summon_player, 0);
raise_event(&(pcard->material_cards), EVENT_BE_MATERIAL, reason_effect, matreason, reason_player, pcard->summon_player, 0); raise_event(&(pcard->material_cards), EVENT_BE_MATERIAL, reason_effect, matreason, reason_player, pcard->summon_player, 0);
} }
} }
......
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