Commit 26219407 authored by nanahira's avatar nanahira

Merge branch 'server' into server-develop

parents 73406c08 b731cece
......@@ -92,9 +92,9 @@ public:
case 4:
if (sizeof(wchar_t) == 2) {
cur = 0;
cur |= ((unsigned)*wsrc & 0x3ff) << 10;
cur |= (*wsrc & 0x3ffU) << 10;
++wsrc;
cur |= (unsigned)*wsrc & 0x3ff;
cur |= *wsrc & 0x3ffU;
cur += 0x10000;
}
pstr[0] = ((cur >> 18) & 0x7) | 0xf0;
......@@ -117,7 +117,7 @@ public:
const char* p = src;
wchar_t* wp = wstr;
while(*p != 0) {
const unsigned cur = (unsigned)*p & 0xff;
const unsigned cur = *p & 0xffU;
int codepoint_size = 0;
if ((cur & 0xf8) == 0xf0) {
if (sizeof(wchar_t) == 2)
......@@ -133,19 +133,19 @@ public:
*wp = *p;
p++;
} else if((cur & 0xe0) == 0xc0) {
*wp = (((unsigned)p[0] & 0x1f) << 6) | ((unsigned)p[1] & 0x3f);
*wp = ((p[0] & 0x1fU) << 6) | (p[1] & 0x3fU);
p += 2;
} else if((cur & 0xf0) == 0xe0) {
*wp = (((unsigned)p[0] & 0xf) << 12) | (((unsigned)p[1] & 0x3f) << 6) | ((unsigned)p[2] & 0x3f);
*wp = ((p[0] & 0xfU) << 12) | ((p[1] & 0x3fU) << 6) | (p[2] & 0x3fU);
p += 3;
} else if((cur & 0xf8) == 0xf0) {
if (sizeof(wchar_t) == 2) {
unsigned unicode = (((unsigned)p[0] & 0x7) << 18) | (((unsigned)p[1] & 0x3f) << 12) | (((unsigned)p[2] & 0x3f) << 6) | ((unsigned)p[3] & 0x3f);
unsigned unicode = ((p[0] & 0x7U) << 18) | ((p[1] & 0x3fU) << 12) | ((p[2] & 0x3fU) << 6) | (p[3] & 0x3fU);
unicode -= 0x10000;
*wp++ = (unicode >> 10) | 0xd800;
*wp = (unicode & 0x3ff) | 0xdc00;
} else {
*wp = (((unsigned)p[0] & 0x7) << 18) | (((unsigned)p[1] & 0x3f) << 12) | (((unsigned)p[2] & 0x3f) << 6) | ((unsigned)p[3] & 0x3f);
*wp = ((p[0] & 0x7U) << 18) | ((p[1] & 0x3fU) << 12) | ((p[2] & 0x3fU) << 6) | (p[3] & 0x3fU);
}
p += 4;
} else
......
......@@ -179,6 +179,13 @@ void SingleDuel::JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater)
}
}
void SingleDuel::LeaveGame(DuelPlayer* dp) {
#ifdef YGOPRO_SERVER_MODE
if(dp->type == 0 && duel_stage != DUEL_STAGE_BEGIN) {
EndDuel();
NetServer::StopServer();
return;
}
#endif
if(dp == host_player) {
#ifdef YGOPRO_SERVER_MODE
int host_pos;
......
......@@ -167,6 +167,13 @@ void TagDuel::JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater) {
}
}
void TagDuel::LeaveGame(DuelPlayer* dp) {
#ifdef YGOPRO_SERVER_MODE
if(dp->type == 0 && duel_stage != DUEL_STAGE_BEGIN) {
EndDuel();
NetServer::StopServer();
return;
}
#endif
if(dp == host_player) {
#ifdef YGOPRO_SERVER_MODE
int host_pos;
......
......@@ -1232,3 +1232,4 @@
!setname 0x1b3 徽记 エンブレーマ
!setname 0x1b4 时空 タキオン
!setname 0x1b5 蓝泪 青い涙
!setname 0x1b6 石版
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