1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Little more development for duel mode.

This commit is contained in:
Michał W. Urbańczyk
2010-12-23 00:33:48 +00:00
parent cde0e8933f
commit 2fe8b07f4f
9 changed files with 112 additions and 51 deletions

View File

@@ -481,41 +481,19 @@ void GarrisonDialog::applyCl(CClient *cl)
void BattleStart::applyCl( CClient *cl )
{
CPlayerInterface * att, * def;
if(vstd::contains(cl->playerint, info->side1) && cl->playerint[info->side1]->human)
att = static_cast<CPlayerInterface*>( cl->playerint[info->side1] );
else
att = NULL;
if(vstd::contains(cl->playerint, info->side2) && cl->playerint[info->side2]->human)
def = static_cast<CPlayerInterface*>( cl->playerint[info->side2] );
else
def = NULL;
new CBattleInterface(info->belligerents[0], info->belligerents[1], info->heroes[0], info->heroes[1], genRect(600, 800, (conf.cc.resx - 800)/2, (conf.cc.resy - 600)/2), att, def);
if(vstd::contains(cl->playerint,info->side1))
cl->playerint[info->side1]->battleStart(info->belligerents[0], info->belligerents[1], info->tile, info->heroes[0], info->heroes[1], 0);
if(vstd::contains(cl->playerint,info->side2))
cl->playerint[info->side2]->battleStart(info->belligerents[0], info->belligerents[1], info->tile, info->heroes[0], info->heroes[1], 1);
cl->battleStarted(info);
}
void BattleNextRound::applyFirstCl(CClient *cl)
{
if(cl->playerint.find(GS(cl)->curB->side1) != cl->playerint.end())
cl->playerint[GS(cl)->curB->side1]->battleNewRoundFirst(round);
if(cl->playerint.find(GS(cl)->curB->side2) != cl->playerint.end())
cl->playerint[GS(cl)->curB->side2]->battleNewRoundFirst(round);
INTERFACE_CALL_IF_PRESENT(GS(cl)->curB->side1,battleNewRoundFirst,round);
INTERFACE_CALL_IF_PRESENT(GS(cl)->curB->side2,battleNewRoundFirst,round);
}
void BattleNextRound::applyCl( CClient *cl )
{
if(cl->playerint.find(GS(cl)->curB->side1) != cl->playerint.end())
cl->playerint[GS(cl)->curB->side1]->battleNewRound(round);
if(cl->playerint.find(GS(cl)->curB->side2) != cl->playerint.end())
cl->playerint[GS(cl)->curB->side2]->battleNewRound(round);
INTERFACE_CALL_IF_PRESENT(GS(cl)->curB->side1,battleNewRound,round);
INTERFACE_CALL_IF_PRESENT(GS(cl)->curB->side2,battleNewRound,round);
}
void BattleSetActiveStack::applyCl( CClient *cl )