Commit a4a38143 authored by mercury233's avatar mercury233 Committed by GitHub

fix support for reloading field again in single mode (#2349)

parent fc3e5ee4
......@@ -3827,47 +3827,45 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.extra_p_count[p] = val;
}
mainGame->dField.RefreshAllCards();
val = BufferIO::ReadInt8(pbuf); //chains, always 0 in single mode
if(!mainGame->dInfo.isSingleMode) {
for(int i = 0; i < val; ++i) {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf);
int pcs = BufferIO::ReadInt8(pbuf);
int subs = BufferIO::ReadInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
mainGame->dField.current_chain.chain_card = pcard;
mainGame->dField.current_chain.code = code;
mainGame->dField.current_chain.desc = desc;
mainGame->dField.current_chain.controler = cc;
mainGame->dField.current_chain.location = cl;
mainGame->dField.current_chain.sequence = cs;
mainGame->dField.GetChainLocation(cc, cl, cs, &mainGame->dField.current_chain.chain_pos);
mainGame->dField.current_chain.solved = false;
int chc = 0;
for(auto chit = mainGame->dField.chains.begin(); chit != mainGame->dField.chains.end(); ++chit) {
if(cl == 0x10 || cl == 0x20) {
if(chit->controler == cc && chit->location == cl)
chc++;
} else {
if(chit->controler == cc && chit->location == cl && chit->sequence == cs)
chc++;
}
val = BufferIO::ReadInt8(pbuf); //chains
for(int i = 0; i < val; ++i) {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf);
int pcs = BufferIO::ReadInt8(pbuf);
int subs = BufferIO::ReadInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
mainGame->dField.current_chain.chain_card = pcard;
mainGame->dField.current_chain.code = code;
mainGame->dField.current_chain.desc = desc;
mainGame->dField.current_chain.controler = cc;
mainGame->dField.current_chain.location = cl;
mainGame->dField.current_chain.sequence = cs;
mainGame->dField.GetChainLocation(cc, cl, cs, &mainGame->dField.current_chain.chain_pos);
mainGame->dField.current_chain.solved = false;
int chc = 0;
for(auto chit = mainGame->dField.chains.begin(); chit != mainGame->dField.chains.end(); ++chit) {
if(cl == 0x10 || cl == 0x20) {
if(chit->controler == cc && chit->location == cl)
chc++;
} else {
if(chit->controler == cc && chit->location == cl && chit->sequence == cs)
chc++;
}
if(cl == LOCATION_HAND)
mainGame->dField.current_chain.chain_pos.X += 0.35f;
else
mainGame->dField.current_chain.chain_pos.Y += chc * 0.25f;
mainGame->dField.chains.push_back(mainGame->dField.current_chain);
}
if(val) {
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
mainGame->dField.last_chain = true;
}
if(cl == LOCATION_HAND)
mainGame->dField.current_chain.chain_pos.X += 0.35f;
else
mainGame->dField.current_chain.chain_pos.Y += chc * 0.25f;
mainGame->dField.chains.push_back(mainGame->dField.current_chain);
}
if(val) {
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
mainGame->dField.last_chain = true;
}
mainGame->gMutex.unlock();
break;
......
......@@ -728,7 +728,8 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
}
pbuf += 6;
}
pbuf++;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 15;
DuelClient::ClientAnalyze(offset, pbuf - offset);
SinglePlayReload();
mainGame->gMutex.lock();
......
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