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

* (hopefully) fixed battle interface in hotseat mode

* fixed a bug when defending player (human) attacks in battle with two-hex unit from top-right or bottom-right direction
This commit is contained in:
mateuszb
2010-02-19 16:02:34 +00:00
parent 80d42a5313
commit d53e4d7c1a
9 changed files with 307 additions and 193 deletions

View File

@@ -19,6 +19,9 @@
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
#include <boost/thread/shared_mutex.hpp>
#include "CConfigHandler.h"
#include "SDL_Extensions.h"
#include "CBattleInterface.h"
//macro to avoid code duplication - calls given method with given arguments if interface for specific player is present
#define INTERFACE_CALL_IF_PRESENT(player,function,...) \
@@ -405,6 +408,20 @@ 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->army1, &info->army2, 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->army1, &info->army2, info->tile, info->heroes[0], info->heroes[1], 0);