mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
bugfixes
This commit is contained in:
parent
8e8066b4bd
commit
57238200e6
@ -41,8 +41,9 @@ public:
|
||||
} cmpst2 ;
|
||||
|
||||
CBattleInterface::CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, CGHeroInstance *hero1, CGHeroInstance *hero2)
|
||||
: printCellBorders(true), attackingHeroInstance(hero1), defendingHeroInstance(hero2), animCount(0), activeStack(-1), givenCommand(NULL), attackingInfo(NULL), myTurn(false), resWindow(NULL), showStackQueue(false), animSpeed(2), printStackRange(true)
|
||||
: printCellBorders(true), attackingHeroInstance(hero1), defendingHeroInstance(hero2), animCount(0), activeStack(-1), givenCommand(NULL), attackingInfo(NULL), myTurn(false), resWindow(NULL), showStackQueue(false), animSpeed(2), printStackRange(true), printMouseShadow(true)
|
||||
{
|
||||
strongInterest = true;
|
||||
givenCommand = new CondSh<BattleAction *>(NULL);
|
||||
//initializing armies
|
||||
this->army1 = army1;
|
||||
@ -585,7 +586,7 @@ bool CBattleInterface::reverseCreature(int number, int hex, bool wideTrick)
|
||||
void CBattleInterface::bOptionsf()
|
||||
{
|
||||
CGI->curh->changeGraphic(0,0);
|
||||
LOCPLINT->curint->deactivate();
|
||||
deactivate();
|
||||
|
||||
SDL_Rect temp_rect = genRect(431, 481, 160, 84);
|
||||
CBattleOptionsWindow * optionsWin = new CBattleOptionsWindow(temp_rect, this);
|
||||
@ -617,7 +618,7 @@ void CBattleInterface::bAutofightf()
|
||||
void CBattleInterface::bSpellf()
|
||||
{
|
||||
CGI->curh->changeGraphic(0,0);
|
||||
LOCPLINT->curint->deactivate();
|
||||
deactivate();
|
||||
|
||||
const CGHeroInstance * chi = NULL;
|
||||
if(attackingHeroInstance->tempOwner == LOCPLINT->playerID)
|
||||
@ -811,9 +812,9 @@ void CBattleInterface::stackMoved(int number, int destHex, bool endMoving)
|
||||
if((animCount+1)%(4/animSpeed)==0)
|
||||
creAnims[number]->incrementFrame();
|
||||
}
|
||||
activate();
|
||||
}
|
||||
creAnims[number]->setType(2); //resetting to default
|
||||
activate();
|
||||
CGI->curh->show();
|
||||
}
|
||||
|
||||
|
@ -1616,7 +1616,8 @@ void CPlayerInterface::handleMouseMotion(SDL_Event *sEvent)
|
||||
}
|
||||
for(int i=0; i<hlp.size();i++)
|
||||
hlp[i]->hover(true);
|
||||
for(std::list<MotionInterested*>::iterator i=motioninterested.begin(); i != motioninterested.end();i++)
|
||||
std::list<MotionInterested*> miCopy = motioninterested;
|
||||
for(std::list<MotionInterested*>::iterator i=miCopy.begin(); i != miCopy.end();i++)
|
||||
{
|
||||
if ((*i)->strongInterest || isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
@ -2073,7 +2074,7 @@ void CPlayerInterface::battleResultQuited()
|
||||
void CPlayerInterface::battleStackMoved(int ID, int dest)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
dynamic_cast<CBattleInterface*>(curint)->stackMoved(ID, dest,dest==curAction->destinationTile);
|
||||
dynamic_cast<CBattleInterface*>(curint)->stackMoved(ID, dest, dest==curAction->destinationTile);
|
||||
}
|
||||
void CPlayerInterface::battleAttack(BattleAttack *ba)
|
||||
{
|
||||
@ -2081,7 +2082,7 @@ void CPlayerInterface::battleAttack(BattleAttack *ba)
|
||||
if(ba->shot())
|
||||
dynamic_cast<CBattleInterface*>(curint)->stackIsShooting(ba->stackAttacking,cb->battleGetPos(ba->bsa.stackAttacked));
|
||||
else
|
||||
dynamic_cast<CBattleInterface*>(curint)->stackAttacking( ba->stackAttacking, cb->battleGetPos(ba->bsa.stackAttacked) );
|
||||
dynamic_cast<CBattleInterface*>(curint)->stackAttacking( ba->stackAttacking, curAction->additionalInfo );
|
||||
if(ba->killed())
|
||||
dynamic_cast<CBattleInterface*>(curint)->stackKilled(ba->bsa.stackAttacked, ba->bsa.damageAmount, ba->bsa.killedAmount, ba->stackAttacking, ba->shot());
|
||||
else
|
||||
|
@ -349,11 +349,11 @@ void CGameHandler::startBattle(CCreatureSet army1, CCreatureSet army2, int3 tile
|
||||
delete battleResult.data;
|
||||
|
||||
}
|
||||
void CGameHandler::prepareAttack(BattleAttack &bat, CStack *att, CStack *def, bool shooting)
|
||||
void CGameHandler::prepareAttack(BattleAttack &bat, CStack *att, CStack *def)
|
||||
{
|
||||
bat.stackAttacking = att->ID;
|
||||
bat.bsa.stackAttacked = def->ID;
|
||||
bat.bsa.damageAmount = BattleInfo::calculateDmg(att, def, gs->getHero(att->attackerOwned ? gs->curB->hero1 : gs->curB->hero2), gs->getHero(def->attackerOwned ? gs->curB->hero1 : gs->curB->hero2), shooting);//counting dealt damage
|
||||
bat.bsa.damageAmount = BattleInfo::calculateDmg(att, def, gs->getHero(att->attackerOwned ? gs->curB->hero1 : gs->curB->hero2), gs->getHero(def->attackerOwned ? gs->curB->hero1 : gs->curB->hero2), bat.shot());//counting dealt damage
|
||||
|
||||
//applying damages
|
||||
bat.bsa.killedAmount = bat.bsa.damageAmount / def->creature->hitPoints;
|
||||
@ -948,14 +948,14 @@ upgend:
|
||||
return;
|
||||
|
||||
BattleAttack bat;
|
||||
prepareAttack(bat,curStack,stackAtEnd,false);
|
||||
prepareAttack(bat,curStack,stackAtEnd);
|
||||
sendAndApply(&bat);
|
||||
//counterattack
|
||||
if(!vstd::contains(curStack->abilities,NO_ENEMY_RETALIATION)
|
||||
&& stackAtEnd->alive()
|
||||
&& stackAtEnd->counterAttacks ) //TODO: support for multiple retaliatons per turn
|
||||
{
|
||||
prepareAttack(bat,stackAtEnd,curStack,false);
|
||||
prepareAttack(bat,stackAtEnd,curStack);
|
||||
bat.flags |= 2;
|
||||
sendAndApply(&bat);
|
||||
}
|
||||
@ -965,7 +965,7 @@ upgend:
|
||||
&& stackAtEnd->alive() )
|
||||
{
|
||||
bat.flags = 0;
|
||||
prepareAttack(bat,curStack,stackAtEnd,false);
|
||||
prepareAttack(bat,curStack,stackAtEnd);
|
||||
sendAndApply(&bat);
|
||||
}
|
||||
sendDataToClients(ui16(3008)); //end movement and attack
|
||||
@ -981,13 +981,13 @@ upgend:
|
||||
*destStack= gs->curB->getStackT(ba.destinationTile);
|
||||
|
||||
BattleAttack bat;
|
||||
prepareAttack(bat,curStack,destStack,true);
|
||||
prepareAttack(bat,curStack,destStack);
|
||||
bat.flags |= 1;
|
||||
|
||||
if(vstd::contains(curStack->abilities,TWICE_ATTACK)
|
||||
&& curStack->alive())
|
||||
{
|
||||
prepareAttack(bat,curStack,destStack,true);
|
||||
prepareAttack(bat,curStack,destStack);
|
||||
sendAndApply(&bat);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class CGameHandler
|
||||
void giveSpells(const CGTownInstance *t, const CGHeroInstance *h);
|
||||
void moveStack(int stack, int dest);
|
||||
void startBattle(CCreatureSet army1, CCreatureSet army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, boost::function<void(BattleResult*)> cb); //use hero=NULL for no hero
|
||||
void prepareAttack(BattleAttack &bat, CStack *att, CStack *def, bool shooting); //if last parameter is true, attack is by shooting, if false it's a melee attack
|
||||
void prepareAttack(BattleAttack &bat, CStack *att, CStack *def); //if last parameter is true, attack is by shooting, if false it's a melee attack
|
||||
|
||||
void checkForBattleEnd( std::vector<CStack*> &stacks );
|
||||
void setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army1, CCreatureSet &army2, CGHeroInstance * hero1, CGHeroInstance * hero2 );
|
||||
|
Loading…
Reference in New Issue
Block a user