Commit 2d276f9b authored by edo9300's avatar edo9300

Updated player name handling

parent 98aa5fe5
...@@ -656,8 +656,8 @@ void ClientField::ReplaySwap() { ...@@ -656,8 +656,8 @@ void ClientField::ReplaySwap() {
mainGame->dInfo.isFirst = !mainGame->dInfo.isFirst; mainGame->dInfo.isFirst = !mainGame->dInfo.isFirst;
std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]); std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]);
std::swap(mainGame->dInfo.strLP[0], mainGame->dInfo.strLP[1]); std::swap(mainGame->dInfo.strLP[0], mainGame->dInfo.strLP[1]);
std::swap(mainGame->dInfo.hostname, mainGame->dInfo.clientname); std::swap(mainGame->dInfo.hostname[0], mainGame->dInfo.clientname[0]);
std::swap(mainGame->dInfo.hostname_tag, mainGame->dInfo.clientname_tag); std::swap(mainGame->dInfo.hostname[1], mainGame->dInfo.clientname[1]);
for(auto chit = chains.begin(); chit != chains.end(); ++chit) { for(auto chit = chains.begin(); chit != chains.end(); ++chit) {
chit->controler = 1 - chit->controler; chit->controler = 1 - chit->controler;
GetChainLocation(chit->controler, chit->location, chit->sequence, &chit->chain_pos); GetChainLocation(chit->controler, chit->location, chit->sequence, &chit->chain_pos);
......
...@@ -512,25 +512,10 @@ void Game::DrawMisc() { ...@@ -512,25 +512,10 @@ void Game::DrawMisc() {
recti p1size = mainGame->Resize(335, 31, 629, 50); recti p1size = mainGame->Resize(335, 31, 629, 50);
recti p2size = mainGame->Resize(986, 31, 986, 50); recti p2size = mainGame->Resize(986, 31, 986, 50);
if (dInfo.isRelay) textFont->draw(dInfo.hostname[dInfo.current_player[0]], p1size, 0xffffffff, false, false, 0);
textFont->draw(dInfo.hostname_relay[dInfo.relay_player[0]], p1size, 0xffffffff, false, false, 0); auto cld = textFont->getDimension(dInfo.clientname[dInfo.current_player[1]]);
else if(!dInfo.isTag || !dInfo.tag_player[0])
textFont->draw(dInfo.hostname, p1size, 0xffffffff, false, false, 0);
else
textFont->draw(dInfo.hostname_tag, p1size, 0xffffffff, false, false, 0);
if (dInfo.isRelay) {
auto cld = textFont->getDimension(dInfo.clientname_relay[dInfo.relay_player[1]]);
p2size.UpperLeftCorner.X -= cld.Width;
textFont->draw(dInfo.clientname_relay[dInfo.relay_player[1]], p2size, 0xffffffff, false, false, 0);
} else if(!dInfo.isTag || !dInfo.tag_player[1]) {
auto cld = textFont->getDimension(dInfo.clientname);
p2size.UpperLeftCorner.X -= cld.Width; p2size.UpperLeftCorner.X -= cld.Width;
textFont->draw(dInfo.clientname, p2size, 0xffffffff, false, false, 0); textFont->draw(dInfo.clientname[dInfo.current_player[1]], p2size, 0xffffffff, false, false, 0);
} else {
auto cld = textFont->getDimension(dInfo.clientname_tag);
p2size.UpperLeftCorner.X -= cld.Width;
textFont->draw(dInfo.clientname_tag, p2size, 0xffffffff, false, false, 0);
}
driver->draw2DRectangle(mainGame->Resize(632, 10, 688, 30), 0x00000000, 0x00000000, 0xffffffff, 0xffffffff); driver->draw2DRectangle(mainGame->Resize(632, 10, 688, 30), 0x00000000, 0x00000000, 0xffffffff, 0xffffffff);
driver->draw2DRectangle(mainGame->Resize(632, 30, 688, 50), 0xffffffff, 0xffffffff, 0x00000000, 0x00000000); driver->draw2DRectangle(mainGame->Resize(632, 30, 688, 50), 0xffffffff, 0xffffffff, 0x00000000, 0x00000000);
lpcFont->draw(dataManager.GetNumString(dInfo.turn), mainGame->Resize(635, 5, 685, 40), 0x80000000, true, false, 0); lpcFont->draw(dataManager.GetNumString(dInfo.turn), mainGame->Resize(635, 5, 685, 40), 0x80000000, true, false, 0);
......
...@@ -660,6 +660,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -660,6 +660,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->wChat->setVisible(true); mainGame->wChat->setVisible(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->dInfo.extraval = (pkt->info.check == 2 && pkt->info.speed) ? 1 : 0; mainGame->dInfo.extraval = (pkt->info.check == 2 && pkt->info.speed) ? 1 : 0;
if(mainGame->dInfo.isRelay)
mainGame->dInfo.isFirst = mainGame->dInfo.player_type < 3;
else if (mainGame->dInfo.isTag)
mainGame->dInfo.isFirst = mainGame->dInfo.player_type < 2;
else
mainGame->dInfo.isFirst = mainGame->dInfo.player_type == 0;
watching = 0; watching = 0;
connect_state |= 0x4; connect_state |= 0x4;
break; break;
...@@ -792,8 +798,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -792,8 +798,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.time_left[0] = 0; mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0; mainGame->dInfo.time_left[1] = 0;
mainGame->dInfo.time_player = 2; mainGame->dInfo.time_player = 2;
mainGame->dInfo.relay_player[0] = 0; mainGame->dInfo.current_player[0] = 0;
mainGame->dInfo.relay_player[1] = 0; mainGame->dInfo.current_player[1] = 0;
mainGame->is_building = false; mainGame->is_building = false;
mainGame->wCardImg->setVisible(true); mainGame->wCardImg->setVisible(true);
mainGame->wInfos->setVisible(true); mainGame->wInfos->setVisible(true);
...@@ -820,11 +826,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -820,11 +826,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnSpectatorSwap->setVisible(true); mainGame->btnSpectatorSwap->setVisible(true);
} }
if(selftype != 1) { if(selftype != 1) {
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.hostname[0], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.clientname[0], 20);
} else { } else {
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.hostname[0], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.clientname[0], 20);
} }
} else if(mainGame->dInfo.isTag) { } else if(mainGame->dInfo.isTag) {
if(selftype > 3) { if(selftype > 3) {
...@@ -834,18 +840,18 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -834,18 +840,18 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnSpectatorSwap->setVisible(true); mainGame->btnSpectatorSwap->setVisible(true);
} }
if(selftype > 1 && selftype < 4) { if(selftype > 1 && selftype < 4) {
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[2]->getText(), mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[2]->getText(), mainGame->dInfo.hostname[0], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[3]->getText(), mainGame->dInfo.hostname_tag, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[3]->getText(), mainGame->dInfo.hostname[1], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.clientname[0], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.clientname_tag, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.clientname[1], 20);
} else { } else {
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[0]->getText(), mainGame->dInfo.hostname[0], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.hostname_tag, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[1]->getText(), mainGame->dInfo.hostname[1], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[2]->getText(), mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[2]->getText(), mainGame->dInfo.clientname[0], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[3]->getText(), mainGame->dInfo.clientname_tag, 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[3]->getText(), mainGame->dInfo.clientname[1], 20);
} }
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.current_player[0] = 0;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.current_player[1] = 0;
} else { } else {
if(selftype > 5) { if(selftype > 5) {
mainGame->dInfo.player_type = 7; mainGame->dInfo.player_type = 7;
...@@ -856,20 +862,20 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -856,20 +862,20 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
if(selftype > 2 && selftype < 6) { if(selftype > 2 && selftype < 6) {
for (int i = 2; i >= 0; i--) { for (int i = 2; i >= 0; i--) {
if (mainGame->chkHostPrepReady[i + 3]->isChecked()) if (mainGame->chkHostPrepReady[i + 3]->isChecked())
mainGame->dInfo.relay_player[0] = i; mainGame->dInfo.current_player[0] = i;
if (mainGame->chkHostPrepReady[i]->isChecked()) if (mainGame->chkHostPrepReady[i]->isChecked())
mainGame->dInfo.relay_player[1] = i; mainGame->dInfo.current_player[1] = i;
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i + 3]->getText(), mainGame->dInfo.hostname_relay[0], 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i + 3]->getText(), mainGame->dInfo.hostname[i], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i]->getText(), mainGame->dInfo.clientname_relay[1], 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i]->getText(), mainGame->dInfo.clientname[i], 20);
} }
} else { } else {
for (int i = 2; i >= 0; i--) { for (int i = 2; i >= 0; i--) {
if(mainGame->chkHostPrepReady[i]->isChecked()) if(mainGame->chkHostPrepReady[i]->isChecked())
mainGame->dInfo.relay_player[0] = i; mainGame->dInfo.current_player[0] = i;
if(mainGame->chkHostPrepReady[i + 3]->isChecked()) if(mainGame->chkHostPrepReady[i + 3]->isChecked())
mainGame->dInfo.relay_player[1] = i; mainGame->dInfo.current_player[1] = i;
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i]->getText(), mainGame->dInfo.hostname_relay[0], 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i]->getText(), mainGame->dInfo.hostname[i], 20);
BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i + 3]->getText(), mainGame->dInfo.clientname_relay[1], 20); BufferIO::CopyWStr(mainGame->stHostPrepDuelist[i + 3]->getText(), mainGame->dInfo.clientname[i], 20);
} }
} }
} }
...@@ -943,11 +949,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -943,11 +949,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
last_replay.BeginRecord(false); last_replay.BeginRecord(false);
last_replay.WriteHeader(pheader); last_replay.WriteHeader(pheader);
last_replay.pheader.id = 0x58707279; last_replay.pheader.id = 0x58707279;
last_replay.WriteData(mainGame->dInfo.hostname, 40, false); last_replay.WriteData(mainGame->dInfo.hostname[0], 40, false);
last_replay.WriteData(mainGame->dInfo.clientname, 40, false); last_replay.WriteData(mainGame->dInfo.clientname[0], 40, false);
if (last_replay.pheader.flag & REPLAY_TAG) { if (last_replay.pheader.flag & REPLAY_TAG) {
last_replay.WriteData(mainGame->dInfo.hostname_tag, 40, false); last_replay.WriteData(mainGame->dInfo.hostname[1], 40, false);
last_replay.WriteData(mainGame->dInfo.clientname_tag, 40, false); last_replay.WriteData(mainGame->dInfo.clientname[1], 40, false);
} }
last_replay.WriteInt32(mainGame->dInfo.duel_field | mainGame->dInfo.extraval >> 8); last_replay.WriteInt32(mainGame->dInfo.duel_field | mainGame->dInfo.extraval >> 8);
last_replay.WriteStream(replay_stream); last_replay.WriteStream(replay_stream);
...@@ -971,26 +977,25 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -971,26 +977,25 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
case STOC_CHAT: { case STOC_CHAT: {
STOC_Chat* pkt = (STOC_Chat*)pdata; STOC_Chat* pkt = (STOC_Chat*)pdata;
int player = pkt->player; int player = pkt->player;
if(player < 4) { if(player < 6) {
if(mainGame->chkIgnore1->isChecked()) if(mainGame->dInfo.isTag) {
break;
if(!mainGame->dInfo.isTag) {
if(mainGame->dInfo.isStarted)
player = mainGame->LocalPlayer(player);
} else {
if(mainGame->dInfo.isStarted && !mainGame->dInfo.isFirst) if(mainGame->dInfo.isStarted && !mainGame->dInfo.isFirst)
player ^= 2; player ^= 2;
if(player == 0) player = (player > 1) ? (player % 2) * 2 + 1 : (player % 2) * 2;
player = 0; if(player > 3)
else if(player == 1) player = 10;
player = 2; } else if(mainGame->dInfo.isRelay) {
else if(player == 2) if (mainGame->dInfo.isStarted && !mainGame->dInfo.isFirst)
player = 1; player ^= 2;
else if(player == 3) player = (player > 1) ? (player % 3) * 2 + 1 : (player % 3) * 2;
player = 3; if (player > 3)
else
player = 10; player = 10;
} else {
if(mainGame->dInfo.isStarted)
player = mainGame->LocalPlayer(player);
} }
if(mainGame->chkIgnore1->isChecked() && ((mainGame->dInfo.isFirst) ? player : player + 1) % 2)
break;
} else { } else {
if(player == 8) { //system custom message. if(player == 8) { //system custom message.
if(mainGame->chkIgnore1->isChecked()) if(mainGame->chkIgnore1->isChecked())
...@@ -1017,23 +1022,23 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -1017,23 +1022,23 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
BufferIO::CopyWStr(pkt->name, name, 20); BufferIO::CopyWStr(pkt->name, name, 20);
if (mainGame->dInfo.isRelay) { if (mainGame->dInfo.isRelay) {
if (pkt->pos < 3) if (pkt->pos < 3)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname_relay[pkt->pos], 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname[pkt->pos], 20);
else else
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname_relay[pkt->pos - 3], 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname[pkt->pos - 3], 20);
} else if(mainGame->dInfo.isTag) { } else if(mainGame->dInfo.isTag) {
if(pkt->pos == 0) if(pkt->pos == 0)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname[0], 20);
else if(pkt->pos == 1) else if(pkt->pos == 1)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname_tag, 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname[1], 20);
else if(pkt->pos == 2) else if(pkt->pos == 2)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname[0], 20);
else if(pkt->pos == 3) else if(pkt->pos == 3)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname_tag, 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname[1], 20);
} else { } else {
if(pkt->pos == 0) if(pkt->pos == 0)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.hostname[0], 20);
else if(pkt->pos == 1) else if(pkt->pos == 1)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname[0], 20);
} }
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stHostPrepDuelist[pkt->pos]->setText(name); mainGame->stHostPrepDuelist[pkt->pos]->setText(name);
...@@ -1055,18 +1060,18 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -1055,18 +1060,18 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->chkHostPrepReady[pos]->setChecked(false); mainGame->chkHostPrepReady[pos]->setChecked(false);
if (mainGame->dInfo.isRelay) { if (mainGame->dInfo.isRelay) {
if (pos < 3) if (pos < 3)
BufferIO::CopyWStr(prename, mainGame->dInfo.hostname_relay[pos], 20); BufferIO::CopyWStr(prename, mainGame->dInfo.hostname[pos], 20);
else else
BufferIO::CopyWStr(prename, mainGame->dInfo.clientname_relay[pos - 3], 20); BufferIO::CopyWStr(prename, mainGame->dInfo.clientname[pos - 3], 20);
} else { } else {
if (pos == 0) if (pos == 0)
BufferIO::CopyWStr(prename, mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(prename, mainGame->dInfo.hostname[0], 20);
else if (pos == 1) else if (pos == 1)
BufferIO::CopyWStr(prename, mainGame->dInfo.hostname_tag, 20); BufferIO::CopyWStr(prename, mainGame->dInfo.hostname[1], 20);
else if (pos == 2) else if (pos == 2)
BufferIO::CopyWStr(prename, mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(prename, mainGame->dInfo.clientname[0], 20);
else if (pos == 3) else if (pos == 3)
BufferIO::CopyWStr(prename, mainGame->dInfo.clientname_tag, 20); BufferIO::CopyWStr(prename, mainGame->dInfo.clientname[1], 20);
} }
} else if(state == PLAYERCHANGE_READY) { } else if(state == PLAYERCHANGE_READY) {
mainGame->chkHostPrepReady[pos]->setChecked(true); mainGame->chkHostPrepReady[pos]->setChecked(true);
...@@ -1316,7 +1321,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1316,7 +1321,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(match_kill) if(match_kill)
myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill)); myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill));
else if(type < 0x10) else if(type < 0x10)
myswprintf(vic_buf, L"[%ls] %ls", (mainGame->dInfo.isRelay) ? mainGame->dInfo.clientname_relay[mainGame->dInfo.relay_player[1]] : mainGame->dInfo.clientname, dataManager.GetVictoryString(type)); myswprintf(vic_buf, L"[%ls] %ls", mainGame->dInfo.clientname[mainGame->dInfo.current_player[1]], dataManager.GetVictoryString(type));
else else
myswprintf(vic_buf, L"%ls", dataManager.GetVictoryString(type)); myswprintf(vic_buf, L"%ls", dataManager.GetVictoryString(type));
mainGame->dInfo.vic_string = vic_buf; mainGame->dInfo.vic_string = vic_buf;
...@@ -1325,7 +1330,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1325,7 +1330,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(match_kill) if(match_kill)
myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill)); myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill));
else if(type < 0x10) else if(type < 0x10)
myswprintf(vic_buf, L"[%ls] %ls", (mainGame->dInfo.isRelay) ? mainGame->dInfo.hostname_relay[mainGame->dInfo.relay_player[0]] : mainGame->dInfo.hostname, dataManager.GetVictoryString(type)); myswprintf(vic_buf, L"[%ls] %ls", mainGame->dInfo.hostname[mainGame->dInfo.current_player[0]], dataManager.GetVictoryString(type));
else else
myswprintf(vic_buf, L"%ls", dataManager.GetVictoryString(type)); myswprintf(vic_buf, L"%ls", dataManager.GetVictoryString(type));
mainGame->dInfo.vic_string = vic_buf; mainGame->dInfo.vic_string = vic_buf;
...@@ -1358,11 +1363,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1358,11 +1363,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
if(playertype & 0xf0) if(playertype & 0xf0)
mainGame->dInfo.player_type = 7; mainGame->dInfo.player_type = 7;
if(mainGame->dInfo.isTag && !mainGame->dInfo.isRelay) { if(mainGame->dInfo.isTag) {
if(mainGame->dInfo.isFirst) if(mainGame->dInfo.isFirst)
mainGame->dInfo.tag_player[1] = true; mainGame->dInfo.current_player[1] = 1;
else else
mainGame->dInfo.tag_player[0] = true; mainGame->dInfo.current_player[0] = 1;
} }
mainGame->dInfo.lp[mainGame->LocalPlayer(0)] = BufferIO::ReadInt32(pbuf); mainGame->dInfo.lp[mainGame->LocalPlayer(0)] = BufferIO::ReadInt32(pbuf);
mainGame->dInfo.lp[mainGame->LocalPlayer(1)] = BufferIO::ReadInt32(pbuf); mainGame->dInfo.lp[mainGame->LocalPlayer(1)] = BufferIO::ReadInt32(pbuf);
...@@ -1669,11 +1674,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1669,11 +1674,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = (unsigned int)BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadInt8(pbuf);
ss = BufferIO::ReadInt8(pbuf); ss = BufferIO::ReadInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcard = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY) & 0xff, s)->overlayed[ss]; pcard = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY), s)->overlayed[ss];
else if (l == 0) { else if (l == 0) {
pcard = new ClientCard(); pcard = new ClientCard();
mainGame->dField.limbo_temp.push_back(pcard); mainGame->dField.limbo_temp.push_back(pcard);
...@@ -1730,11 +1735,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1730,11 +1735,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for (int i = 0; i < count1; ++i) { for (int i = 0; i < count1; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = (unsigned int)BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadInt8(pbuf);
ss = BufferIO::ReadInt8(pbuf); ss = BufferIO::ReadInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcard = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY) & 0xff, s)->overlayed[ss]; pcard = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY), s)->overlayed[ss];
else if (l == 0) { else if (l == 0) {
pcard = new ClientCard(); pcard = new ClientCard();
mainGame->dField.limbo_temp.push_back(pcard); mainGame->dField.limbo_temp.push_back(pcard);
...@@ -1754,11 +1759,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1754,11 +1759,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for (int i = count1; i < count1 + count2; ++i) { for (int i = count1; i < count1 + count2; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = (unsigned int)BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadInt8(pbuf);
ss = BufferIO::ReadInt8(pbuf); ss = BufferIO::ReadInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcard = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY) & 0xff, s)->overlayed[ss]; pcard = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY), s)->overlayed[ss];
else if (l == 0) { else if (l == 0) {
pcard = new ClientCard(); pcard = new ClientCard();
mainGame->dField.limbo_temp.push_back(pcard); mainGame->dField.limbo_temp.push_back(pcard);
...@@ -2591,11 +2596,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2591,11 +2596,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnCancelOrFinish->setVisible(false); mainGame->btnCancelOrFinish->setVisible(false);
} }
} }
if(!mainGame->dInfo.isRelay && mainGame->dInfo.isTag && mainGame->dInfo.turn != 1) { if(mainGame->dInfo.isTag && mainGame->dInfo.turn != 1) {
if(player == 0) if(player == 0)
mainGame->dInfo.tag_player[0] = !mainGame->dInfo.tag_player[0]; mainGame->dInfo.current_player[0] = (mainGame->dInfo.current_player[0] + 1) % 2;
else else
mainGame->dInfo.tag_player[1] = !mainGame->dInfo.tag_player[1]; mainGame->dInfo.current_player[1] = (mainGame->dInfo.current_player[1] + 1) % 2;
} }
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->showcardcode = 10; mainGame->showcardcode = 10;
...@@ -2775,7 +2780,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2775,7 +2780,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->ClearTarget(); pcard->ClearTarget();
pcard->is_showtarget = false; pcard->is_showtarget = false;
pcard->is_showchaintarget = false; pcard->is_showchaintarget = false;
ClientCard* olcard = mainGame->dField.GetCard(cc, cl & (~LOCATION_OVERLAY) & 0xff, cs); ClientCard* olcard = mainGame->dField.GetCard(cc, cl & (~LOCATION_OVERLAY), cs);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dField.RemoveCard(pc, pl, ps); mainGame->dField.RemoveCard(pc, pl, ps);
olcard->overlayed.push_back(pcard); olcard->overlayed.push_back(pcard);
...@@ -2803,7 +2808,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2803,7 +2808,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
} }
} else if (!(cl & LOCATION_OVERLAY)) { } else if (!(cl & LOCATION_OVERLAY)) {
ClientCard* olcard = mainGame->dField.GetCard(pc, pl & (~LOCATION_OVERLAY) & 0xff, ps); ClientCard* olcard = mainGame->dField.GetCard(pc, pl & (~LOCATION_OVERLAY), ps);
ClientCard* pcard = olcard->overlayed[pp]; ClientCard* pcard = olcard->overlayed[pp];
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence); olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence);
...@@ -2832,9 +2837,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2832,9 +2837,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
} else { } else {
ClientCard* olcard1 = mainGame->dField.GetCard(pc, pl & (~LOCATION_OVERLAY) & 0xff, ps); ClientCard* olcard1 = mainGame->dField.GetCard(pc, pl & (~LOCATION_OVERLAY), ps);
ClientCard* pcard = olcard1->overlayed[pp]; ClientCard* pcard = olcard1->overlayed[pp];
ClientCard* olcard2 = mainGame->dField.GetCard(cc, cl & (~LOCATION_OVERLAY) & 0xff, cs); ClientCard* olcard2 = mainGame->dField.GetCard(cc, cl & (~LOCATION_OVERLAY), cs);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
olcard1->overlayed.erase(olcard1->overlayed.begin() + pcard->sequence); olcard1->overlayed.erase(olcard1->overlayed.begin() + pcard->sequence);
olcard2->overlayed.push_back(pcard); olcard2->overlayed.push_back(pcard);
...@@ -3132,11 +3137,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3132,11 +3137,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard* pcards[10]; ClientCard* pcards[10];
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadInt8(pbuf);
int ss = BufferIO::ReadInt8(pbuf); int ss = BufferIO::ReadInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcards[i] = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY) & 0xff, s)->overlayed[ss]; pcards[i] = mainGame->dField.GetCard(c, l & (~LOCATION_OVERLAY), s)->overlayed[ss];
else else
pcards[i] = mainGame->dField.GetCard(c, l, s); pcards[i] = mainGame->dField.GetCard(c, l, s);
pcards[i]->is_highlighting = true; pcards[i]->is_highlighting = true;
...@@ -3713,8 +3718,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3713,8 +3718,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->cbANNumber->clear(); mainGame->cbANNumber->clear();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
u64 value = (mainGame->dInfo.lua64) ? BufferIO::ReadInt64(pbuf) : BufferIO::ReadInt32(pbuf); u32 value = (mainGame->dInfo.lua64) ? (u32)BufferIO::ReadInt64(pbuf) : BufferIO::ReadInt32(pbuf);
myswprintf(textBuffer, L" % d", value); myswprintf(textBuffer, L" %d", value);
mainGame->cbANNumber->addItem(textBuffer, value); mainGame->cbANNumber->addItem(textBuffer, value);
} }
mainGame->cbANNumber->setSelected(0); mainGame->cbANNumber->setSelected(0);
...@@ -3919,7 +3924,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3919,7 +3924,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
if(mainGame->dInfo.isRelay) if(mainGame->dInfo.isRelay)
mainGame->dInfo.relay_player[player] = newp; mainGame->dInfo.current_player[player] = newp;
break; break;
} }
case MSG_RELOAD_FIELD: { case MSG_RELOAD_FIELD: {
......
...@@ -1087,8 +1087,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1087,8 +1087,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
unsigned short msgbuf[256]; unsigned short msgbuf[256];
if(mainGame->dInfo.isStarted) { if(mainGame->dInfo.isStarted) {
if(mainGame->dInfo.player_type < 7) { if(mainGame->dInfo.player_type < 7) {
if(mainGame->dInfo.isTag && (mainGame->dInfo.player_type % 2)) if (mainGame->dInfo.isRelay)
mainGame->AddChatMsg((wchar_t*)input, 2); mainGame->AddChatMsg((wchar_t*)input, (mainGame->dInfo.player_type % 3) * 2);
else if(mainGame->dInfo.isTag)
mainGame->AddChatMsg((wchar_t*)input, (mainGame->dInfo.player_type % 2) * 2);
else else
mainGame->AddChatMsg((wchar_t*)input, 0); mainGame->AddChatMsg((wchar_t*)input, 0);
} else } else
...@@ -1847,21 +1849,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1847,21 +1849,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mplayer != hovered_player) { if(mplayer != hovered_player) {
if(mplayer >= 0) { if(mplayer >= 0) {
const wchar_t* player_name; const wchar_t* player_name;
if(mplayer == 0) { if (mplayer == 0)
if(mainGame->dInfo.isRelay) player_name = mainGame->dInfo.hostname[mainGame->dInfo.current_player[mplayer]];
player_name = mainGame->dInfo.hostname_relay[mainGame->dInfo.relay_player[0]];
else if(!mainGame->dInfo.isTag || !mainGame->dInfo.tag_player[0])
player_name = mainGame->dInfo.hostname;
else else
player_name = mainGame->dInfo.hostname_tag; player_name = mainGame->dInfo.clientname[mainGame->dInfo.current_player[mplayer]];
} else {
if (mainGame->dInfo.isRelay)
player_name = mainGame->dInfo.clientname_relay[mainGame->dInfo.relay_player[1]];
else if(!mainGame->dInfo.isTag || !mainGame->dInfo.tag_player[1])
player_name = mainGame->dInfo.clientname;
else
player_name = mainGame->dInfo.clientname_tag;
}
std::wstring str(player_name); std::wstring str(player_name);
const auto& player_desc_hints = mainGame->dField.player_desc_hints[mplayer]; const auto& player_desc_hints = mainGame->dField.player_desc_hints[mplayer];
for(auto iter = player_desc_hints.begin(); iter != player_desc_hints.end(); ++iter) { for(auto iter = player_desc_hints.begin(); iter != player_desc_hints.end(); ++iter) {
......
...@@ -1356,23 +1356,34 @@ void Game::AddChatMsg(wchar_t* msg, int player) { ...@@ -1356,23 +1356,34 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatTiming[0] = 1200; chatTiming[0] = 1200;
chatType[0] = player; chatType[0] = player;
switch(player) { switch(player) {
case 0: //from host case 0: //host 1
chatMsg[0].append((dInfo.isRelay) ? dInfo.hostname_relay[0] : dInfo.hostname); PlaySoundEffect("./sound/chatmessage.wav");
chatMsg[0].append(dInfo.hostname[0]);
chatMsg[0].append(L": ");
break;
case 1: //client 1
PlaySoundEffect("./sound/chatmessage.wav");
chatMsg[0].append(dInfo.clientname[0]);
chatMsg[0].append(L": ");
break;
case 2: //host 2
PlaySoundEffect("./sound/chatmessage.wav");
chatMsg[0].append(dInfo.hostname[1]);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 1: //from client case 3: //client 2
PlaySoundEffect("./sound/chatmessage.wav"); PlaySoundEffect("./sound/chatmessage.wav");
chatMsg[0].append((dInfo.isRelay) ? dInfo.clientname_relay[0] : dInfo.clientname); chatMsg[0].append(dInfo.clientname[1]);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 2: //host tag case 4: //host 3
PlaySoundEffect("./sound/chatmessage.wav"); PlaySoundEffect("./sound/chatmessage.wav");
chatMsg[0].append((dInfo.isRelay) ? dInfo.hostname_relay[1] : dInfo.hostname_tag); chatMsg[0].append(dInfo.hostname[2]);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 3: //client tag case 5: //client 3
PlaySoundEffect("./sound/chatmessage.wav"); PlaySoundEffect("./sound/chatmessage.wav");
chatMsg[0].append((dInfo.isRelay) ? dInfo.clientname_relay[1] : dInfo.clientname_tag); chatMsg[0].append(dInfo.clientname[2]);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 7: //local name case 7: //local name
...@@ -1476,7 +1487,7 @@ int Game::LocalPlayer(int player) { ...@@ -1476,7 +1487,7 @@ int Game::LocalPlayer(int player) {
return dInfo.isFirst ? player : 1 - player; return dInfo.isFirst ? player : 1 - player;
} }
const wchar_t* Game::LocalName(int local_player) { const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname; return local_player == 0 ? dInfo.hostname[0] : dInfo.clientname[0];
} }
void Game::UpdateDuelParam() { void Game::UpdateDuelParam() {
uint32 flag = 0, filter = 0x100; uint32 flag = 0, filter = 0x100;
......
...@@ -56,20 +56,15 @@ struct DuelInfo { ...@@ -56,20 +56,15 @@ struct DuelInfo {
bool isSingleMode; bool isSingleMode;
bool lua64; bool lua64;
bool is_shuffling; bool is_shuffling;
bool tag_player[2]; int current_player[2];
int relay_player[2];
int lp[2]; int lp[2];
int startlp; int startlp;
int duel_field; int duel_field;
int extraval; int extraval;
int turn; int turn;
short curMsg; short curMsg;
wchar_t hostname[20]; wchar_t clientname[3][20];
wchar_t clientname[20]; wchar_t hostname[3][20];
wchar_t hostname_tag[20];
wchar_t clientname_tag[20];
wchar_t clientname_relay[3][20];
wchar_t hostname_relay[3][20];
wchar_t strLP[2][16]; wchar_t strLP[2][16];
wchar_t* vic_string; wchar_t* vic_string;
unsigned char player_type; unsigned char player_type;
......
...@@ -20,8 +20,8 @@ namespace ygo { ...@@ -20,8 +20,8 @@ namespace ygo {
mainGame->dInfo.isTag = !!(rh.flag & REPLAY_TAG); mainGame->dInfo.isTag = !!(rh.flag & REPLAY_TAG);
mainGame->dInfo.isSingleMode = !!(rh.flag & REPLAY_SINGLE_MODE); mainGame->dInfo.isSingleMode = !!(rh.flag & REPLAY_SINGLE_MODE);
mainGame->dInfo.lua64 = true; mainGame->dInfo.lua64 = true;
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.current_player[0] = 0;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.current_player[1] = 0;
if (mainGame->dInfo.isSingleMode) { if (mainGame->dInfo.isSingleMode) {
set_script_reader((script_reader)SingleMode::ScriptReader); set_script_reader((script_reader)SingleMode::ScriptReader);
set_card_reader((card_reader)DataManager::CardReader); set_card_reader((card_reader)DataManager::CardReader);
...@@ -106,14 +106,14 @@ namespace ygo { ...@@ -106,14 +106,14 @@ namespace ygo {
int seed = rh.seed; int seed = rh.seed;
rnd.reset(seed); rnd.reset(seed);
if (mainGame->dInfo.isTag) { if (mainGame->dInfo.isTag) {
cur_replay.ReadName(mainGame->dInfo.hostname); cur_replay.ReadName(mainGame->dInfo.hostname[0]);
cur_replay.ReadName(mainGame->dInfo.hostname_tag); cur_replay.ReadName(mainGame->dInfo.hostname[1]);
cur_replay.ReadName(mainGame->dInfo.clientname_tag); cur_replay.ReadName(mainGame->dInfo.clientname[1]);
cur_replay.ReadName(mainGame->dInfo.clientname); cur_replay.ReadName(mainGame->dInfo.clientname[0]);
} }
else { else {
cur_replay.ReadName(mainGame->dInfo.hostname); cur_replay.ReadName(mainGame->dInfo.hostname[0]);
cur_replay.ReadName(mainGame->dInfo.clientname); cur_replay.ReadName(mainGame->dInfo.clientname[0]);
} }
pduel = create_duel(rnd.rand()); pduel = create_duel(rnd.rand());
int start_lp = cur_replay.ReadInt32(); int start_lp = cur_replay.ReadInt32();
......
...@@ -62,17 +62,17 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -62,17 +62,17 @@ int ReplayMode::ReplayThread(void* param) {
mainGame->dInfo.isTag = !!(rh.flag & REPLAY_TAG); mainGame->dInfo.isTag = !!(rh.flag & REPLAY_TAG);
mainGame->dInfo.isSingleMode = !!(rh.flag & REPLAY_SINGLE_MODE); mainGame->dInfo.isSingleMode = !!(rh.flag & REPLAY_SINGLE_MODE);
mainGame->dInfo.lua64 = !!(rh.flag & REPLAY_LUA64); mainGame->dInfo.lua64 = !!(rh.flag & REPLAY_LUA64);
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.current_player[0] = 0;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.current_player[1] = 0;
if (mainGame->dInfo.isTag) { if (mainGame->dInfo.isTag) {
cur_replay.ReadName(mainGame->dInfo.hostname); cur_replay.ReadName(mainGame->dInfo.hostname[0]);
cur_replay.ReadName(mainGame->dInfo.hostname_tag); cur_replay.ReadName(mainGame->dInfo.hostname[1]);
cur_replay.ReadName(mainGame->dInfo.clientname_tag); cur_replay.ReadName(mainGame->dInfo.clientname[1]);
cur_replay.ReadName(mainGame->dInfo.clientname); cur_replay.ReadName(mainGame->dInfo.clientname[0]);
} }
else { else {
cur_replay.ReadName(mainGame->dInfo.hostname); cur_replay.ReadName(mainGame->dInfo.hostname[0]);
cur_replay.ReadName(mainGame->dInfo.clientname); cur_replay.ReadName(mainGame->dInfo.clientname[0]);
} }
int opt = cur_replay.ReadInt32(); int opt = cur_replay.ReadInt32();
mainGame->dInfo.duel_field = opt & 0xff; mainGame->dInfo.duel_field = opt & 0xff;
...@@ -157,8 +157,8 @@ void ReplayMode::Restart(bool refresh) { ...@@ -157,8 +157,8 @@ void ReplayMode::Restart(bool refresh) {
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.turn = 0; mainGame->dInfo.turn = 0;
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.current_player[0] = 0;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.current_player[1] = 0;
if (yrp && !StartDuel()) { if (yrp && !StartDuel()) {
EndDuel(); EndDuel();
} }
...@@ -263,7 +263,7 @@ bool ReplayMode::ReplayAnalyze(ReplayPacket p) { ...@@ -263,7 +263,7 @@ bool ReplayMode::ReplayAnalyze(ReplayPacket p) {
pbuf += len + 1; pbuf += len + 1;
memcpy(namebuf, begin, len + 1); memcpy(namebuf, begin, len + 1);
BufferIO::DecodeUTF8(namebuf, wname); BufferIO::DecodeUTF8(namebuf, wname);
BufferIO::CopyWStr(wname, mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(wname, mainGame->dInfo.clientname[0], 20);
return true; return true;
} }
case OLD_REPLAY_MODE: case OLD_REPLAY_MODE:
......
...@@ -53,8 +53,8 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -53,8 +53,8 @@ int SingleMode::SinglePlayThread(void* param) {
mainGame->dInfo.startlp = start_lp; mainGame->dInfo.startlp = start_lp;
myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]); myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]);
myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]); myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]);
BufferIO::CopyWStr(mainGame->ebNickName->getText(), mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(mainGame->ebNickName->getText(), mainGame->dInfo.hostname[0], 20);
mainGame->dInfo.clientname[0] = 0; mainGame->dInfo.clientname[0][0] = 0;
mainGame->dInfo.turn = 0; mainGame->dInfo.turn = 0;
char filename[256]; char filename[256];
size_t slen = 0; size_t slen = 0;
...@@ -117,10 +117,10 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -117,10 +117,10 @@ int SingleMode::SinglePlayThread(void* param) {
new_replay.WriteHeader(rh); new_replay.WriteHeader(rh);
replay_stream.clear(); replay_stream.clear();
unsigned short buffer[20]; unsigned short buffer[20];
BufferIO::CopyWStr(mainGame->dInfo.hostname, buffer, 20); BufferIO::CopyWStr(mainGame->dInfo.hostname[0], buffer, 20);
last_replay.WriteData(buffer, 40, false); last_replay.WriteData(buffer, 40, false);
new_replay.WriteData(buffer, 40, false); new_replay.WriteData(buffer, 40, false);
BufferIO::CopyWStr(mainGame->dInfo.clientname, buffer, 20); BufferIO::CopyWStr(mainGame->dInfo.clientname[0], buffer, 20);
last_replay.WriteData(buffer, 40, false); last_replay.WriteData(buffer, 40, false);
new_replay.WriteData(buffer, 40, false); new_replay.WriteData(buffer, 40, false);
last_replay.WriteInt32(start_lp, false); last_replay.WriteInt32(start_lp, false);
...@@ -849,7 +849,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -849,7 +849,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
pbuf += len + 1; pbuf += len + 1;
memcpy(namebuf, begin, len + 1); memcpy(namebuf, begin, len + 1);
BufferIO::DecodeUTF8(namebuf, wname); BufferIO::DecodeUTF8(namebuf, wname);
BufferIO::CopyWStr(wname, mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(wname, mainGame->dInfo.clientname[0], 20);
break; break;
} }
case MSG_SHOW_HINT: { case MSG_SHOW_HINT: {
......
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