Commit 8a37c8be authored by edo9300's avatar edo9300

Merge remote-tracking branch 'refs/remotes/Fluorohydride/master'

parents 8107c321 6afb4850
......@@ -306,7 +306,6 @@ void ClientField::UpdateCard(int controler, int location, int sequence, char* da
}
void ClientField::UpdateFieldCard(int controler, int location, char* data) {
std::vector<ClientCard*>* lst = 0;
std::vector<ClientCard*>::iterator cit;
switch(location) {
case LOCATION_DECK:
lst = &deck[controler];
......@@ -333,7 +332,7 @@ void ClientField::UpdateFieldCard(int controler, int location, char* data) {
if(!lst)
return;
int len;
for(cit = lst->begin(); cit != lst->end(); ++cit) {
for(auto cit = lst->begin(); cit != lst->end(); ++cit) {
len = BufferIO::ReadInt32(data);
if(len > 8)
(*cit)->UpdateInfo(data);
......@@ -341,20 +340,19 @@ void ClientField::UpdateFieldCard(int controler, int location, char* data) {
}
}
void ClientField::ClearCommandFlag() {
std::vector<ClientCard*>::iterator cit;
for(cit = activatable_cards.begin(); cit != activatable_cards.end(); ++cit)
for(auto cit = activatable_cards.begin(); cit != activatable_cards.end(); ++cit)
(*cit)->cmdFlag = 0;
for(cit = summonable_cards.begin(); cit != summonable_cards.end(); ++cit)
for(auto cit = summonable_cards.begin(); cit != summonable_cards.end(); ++cit)
(*cit)->cmdFlag = 0;
for(cit = spsummonable_cards.begin(); cit != spsummonable_cards.end(); ++cit)
for(auto cit = spsummonable_cards.begin(); cit != spsummonable_cards.end(); ++cit)
(*cit)->cmdFlag = 0;
for(cit = msetable_cards.begin(); cit != msetable_cards.end(); ++cit)
for(auto cit = msetable_cards.begin(); cit != msetable_cards.end(); ++cit)
(*cit)->cmdFlag = 0;
for(cit = ssetable_cards.begin(); cit != ssetable_cards.end(); ++cit)
for(auto cit = ssetable_cards.begin(); cit != ssetable_cards.end(); ++cit)
(*cit)->cmdFlag = 0;
for(cit = reposable_cards.begin(); cit != reposable_cards.end(); ++cit)
for(auto cit = reposable_cards.begin(); cit != reposable_cards.end(); ++cit)
(*cit)->cmdFlag = 0;
for(cit = attackable_cards.begin(); cit != attackable_cards.end(); ++cit)
for(auto cit = attackable_cards.begin(); cit != attackable_cards.end(); ++cit)
(*cit)->cmdFlag = 0;
conti_cards.clear();
deck_act = false;
......@@ -366,15 +364,13 @@ void ClientField::ClearCommandFlag() {
conti_act = false;
}
void ClientField::ClearSelect() {
std::vector<ClientCard*>::iterator cit;
for(cit = selectable_cards.begin(); cit != selectable_cards.end(); ++cit) {
for(auto cit = selectable_cards.begin(); cit != selectable_cards.end(); ++cit) {
(*cit)->is_selectable = false;
(*cit)->is_selected = false;
}
}
void ClientField::ClearChainSelect() {
std::vector<ClientCard*>::iterator cit;
for(cit = activatable_cards.begin(); cit != activatable_cards.end(); ++cit) {
for(auto cit = activatable_cards.begin(); cit != activatable_cards.end(); ++cit) {
(*cit)->cmdFlag = 0;
(*cit)->chain_code = 0;
(*cit)->is_selectable = false;
......
......@@ -663,8 +663,7 @@ void Game::ConvertCoords(float x, float y, int* x1, int* y1) {
}
void Game::DrawGUI() {
if(imageLoading.size()) {
std::map<irr::gui::CGUIImageButton*, int>::iterator mit;
for(mit = imageLoading.begin(); mit != imageLoading.end(); ++mit)
for(auto mit = imageLoading.begin(); mit != imageLoading.end(); ++mit)
mit->first->setImage(imageManager.GetTexture(mit->second));
imageLoading.clear();
}
......@@ -763,7 +762,7 @@ void Game::DrawSpec() {
}
case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), Resize(574, 150));
driver->draw2DImage(imageManager.tMask, ResizeElem(574 + showcarddif, 150, 761, 404), recti(0, 0, CARD_IMG_WIDTH - showcarddif, 254), 0, 0, true);
driver->draw2DImage(imageManager.tMask, ResizeElem(574 + showcarddif, 150, 751, 404), recti(0, 0, CARD_IMG_WIDTH - showcarddif, 254), 0, 0, true);
showcarddif += 15;
if(showcarddif >= CARD_IMG_WIDTH) {
showcard = 0;
......
......@@ -2459,8 +2459,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_SHUFFLE_SET_CARD: {
std::vector<ClientCard*>::iterator cit;
std::vector<ClientCard*>* lst = 0;
int loc = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf);
if(loc == LOCATION_MZONE)
lst = mainGame->dField.mzone;
else
lst = mainGame->dField.szone;
ClientCard* mc[5];
ClientCard* swp;
int c, l, s, ps;
......@@ -2469,7 +2474,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
l = BufferIO::ReadInt8(pbuf);
s = BufferIO::ReadInt8(pbuf);
BufferIO::ReadInt8(pbuf);
mc[i] = mainGame->dField.mzone[c][s];
mc[i] = lst[c][s];
mc[i]->SetCode(0);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mc[i]->dPos = irr::core::vector3df((3.95f - mc[i]->curPos.X) / 10, 0, 0.05f);
......@@ -2487,9 +2492,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt8(pbuf);
ps = mc[i]->sequence;
if (l > 0) {
swp = mainGame->dField.mzone[c][s];
mainGame->dField.mzone[c][ps] = swp;
mainGame->dField.mzone[c][s] = mc[i];
swp = lst[c][s];
lst[c][ps] = swp;
lst[c][s] = mc[i];
mc[i]->sequence = s;
swp->sequence = ps;
}
......@@ -2497,7 +2502,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for (int i = 0; i < count; ++i) {
mainGame->dField.MoveCard(mc[i], 10);
for (cit = mc[i]->overlayed.begin(); cit != mc[i]->overlayed.end(); ++cit)
for (auto cit = mc[i]->overlayed.begin(); cit != mc[i]->overlayed.end(); ++cit)
mainGame->dField.MoveCard(*cit, 10);
}
mainGame->WaitFrameSignal(11);
......
......@@ -1522,7 +1522,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
str.append(formatBuffer);
}
}
for(std::map<int, int>::iterator ctit = mcard->counters.begin(); ctit != mcard->counters.end(); ++ctit) {
for(auto ctit = mcard->counters.begin(); ctit != mcard->counters.end(); ++ctit) {
myswprintf(formatBuffer, L"\n[%ls]: %d", dataManager.GetCounterName(ctit->first), ctit->second);
str.append(formatBuffer);
}
......
......@@ -444,6 +444,7 @@ namespace ygo {
break;
}
case MSG_SHUFFLE_SET_CARD: {
pbuf++;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset);
......
......@@ -934,14 +934,21 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
break;
}
case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
if(loc == LOCATION_MZONE) {
RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
}
else {
RefreshSzone(0, 0x181fff, 0);
RefreshSzone(1, 0x181fff, 0);
}
break;
}
case MSG_NEW_TURN: {
......
......@@ -458,6 +458,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
break;
}
case MSG_SHUFFLE_SET_CARD: {
pbuf++;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset);
......
......@@ -890,6 +890,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break;
}
case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
......@@ -898,8 +899,13 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(players[3]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
if(loc == LOCATION_MZONE) {
RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
} else {
RefreshSzone(0, 0x181fff, 0);
RefreshSzone(1, 0x181fff, 0);
}
break;
}
case MSG_NEW_TURN: {
......
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