mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
* fix for bug 288 (and maybe other related bugs)
This commit is contained in:
parent
d037bec1be
commit
08c7541076
@ -786,10 +786,10 @@ bool CBattleAttack::checkInitialConditions()
|
||||
return isEarliest(false);
|
||||
}
|
||||
|
||||
CBattleAttack::CBattleAttack(CBattleInterface * _owner, int _stackID, int _dest)
|
||||
CBattleAttack::CBattleAttack(CBattleInterface * _owner, int _stackID, int _dest, int _attackedID)
|
||||
: CBattleStackAnimation(_owner, _stackID), dest(_dest)
|
||||
{
|
||||
attackedStack = LOCPLINT->cb->battleGetStackByPos(_dest, false);
|
||||
attackedStack = LOCPLINT->cb->battleGetStackByID(_attackedID, false);
|
||||
attackingStack = LOCPLINT->cb->battleGetStackByID(_stackID, false);
|
||||
|
||||
assert(attackingStack && "attackingStack is NULL in CBattleAttack::CBattleAttack !\n");
|
||||
@ -893,8 +893,8 @@ void CMeleeAttack::endAnim()
|
||||
delete this;
|
||||
}
|
||||
|
||||
CMeleeAttack::CMeleeAttack(CBattleInterface * _owner, int attacker, int _dest)
|
||||
: CBattleAttack(_owner, attacker, _dest)
|
||||
CMeleeAttack::CMeleeAttack(CBattleInterface * _owner, int attacker, int _dest, int _attackedID)
|
||||
: CBattleAttack(_owner, attacker, _dest, _attackedID)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1014,8 +1014,8 @@ void CShootingAnim::endAnim()
|
||||
delete this;
|
||||
}
|
||||
|
||||
CShootingAnim::CShootingAnim(CBattleInterface * _owner, int attacker, int _dest, bool _catapult, int _catapultDmg)
|
||||
: CBattleAttack(_owner, attacker, _dest), catapultDamage(_catapultDmg), catapult(_catapult)
|
||||
CShootingAnim::CShootingAnim(CBattleInterface * _owner, int attacker, int _dest, int _attackedID, bool _catapult, int _catapultDmg)
|
||||
: CBattleAttack(_owner, attacker, _dest, _attackedID), catapultDamage(_catapultDmg), catapult(_catapult)
|
||||
{
|
||||
if(catapult) //catapult attack
|
||||
{
|
||||
@ -2168,9 +2168,9 @@ void CBattleInterface::stacksAreAttacked(std::vector<SStackAttackedInfo> attacke
|
||||
}
|
||||
}
|
||||
|
||||
void CBattleInterface::stackAttacking(int ID, int dest)
|
||||
void CBattleInterface::stackAttacking(int ID, int dest, int attackedID)
|
||||
{
|
||||
addNewAnim(new CMeleeAttack(this, ID, dest));
|
||||
addNewAnim(new CMeleeAttack(this, ID, dest, attackedID));
|
||||
}
|
||||
|
||||
void CBattleInterface::newRound(int number)
|
||||
@ -2489,16 +2489,16 @@ void CBattleInterface::hexLclicked(int whichOne)
|
||||
}
|
||||
}
|
||||
|
||||
void CBattleInterface::stackIsShooting(int ID, int dest)
|
||||
void CBattleInterface::stackIsShooting(int ID, int dest, int attackedID)
|
||||
{
|
||||
addNewAnim(new CShootingAnim(this, ID, dest));
|
||||
addNewAnim(new CShootingAnim(this, ID, dest, attackedID));
|
||||
}
|
||||
|
||||
void CBattleInterface::stackIsCatapulting(const CatapultAttack & ca)
|
||||
{
|
||||
for(std::set< std::pair< std::pair< ui8, si16 >, ui8> >::const_iterator it = ca.attackedParts.begin(); it != ca.attackedParts.end(); ++it)
|
||||
{
|
||||
addNewAnim(new CShootingAnim(this, ca.attacker, it->first.second, true, it->second));
|
||||
addNewAnim(new CShootingAnim(this, ca.attacker, it->first.second, -1, true, it->second));
|
||||
|
||||
SDL_FreeSurface(siegeH->walls[it->first.first + 2]);
|
||||
siegeH->walls[it->first.first + 2] = BitmapHandler::loadBitmap(
|
||||
|
@ -188,7 +188,7 @@ public:
|
||||
bool checkInitialConditions();
|
||||
|
||||
|
||||
CBattleAttack(CBattleInterface * _owner, int _stackID, int _dest);
|
||||
CBattleAttack(CBattleInterface * _owner, int _stackID, int _dest, int _attackedID);
|
||||
};
|
||||
|
||||
class CMeleeAttack : public CBattleAttack
|
||||
@ -198,7 +198,7 @@ public:
|
||||
void nextFrame();
|
||||
void endAnim();
|
||||
|
||||
CMeleeAttack(CBattleInterface * _owner, int attacker, int _dest);
|
||||
CMeleeAttack(CBattleInterface * _owner, int attacker, int _dest, int _attackedID);
|
||||
};
|
||||
|
||||
class CShootingAnim : public CBattleAttack
|
||||
@ -211,7 +211,7 @@ public:
|
||||
void nextFrame();
|
||||
void endAnim();
|
||||
|
||||
CShootingAnim(CBattleInterface * _owner, int attacker, int _dest, bool _catapult = false, int _catapultDmg = 0); //last param only for catapult attacks
|
||||
CShootingAnim(CBattleInterface * _owner, int attacker, int _dest, int _attackedID, bool _catapult = false, int _catapultDmg = 0); //last param only for catapult attacks
|
||||
};
|
||||
|
||||
//end of battle animation handlers
|
||||
@ -475,10 +475,10 @@ public:
|
||||
void stackActivated(int number); //active stack has been changed
|
||||
void stackMoved(int number, int destHex, bool endMoving, int distance); //stack with id number moved to destHex
|
||||
void stacksAreAttacked(std::vector<SStackAttackedInfo> attackedInfos); //called when a certain amount of stacks has been attacked
|
||||
void stackAttacking(int ID, int dest); //called when stack with id ID is attacking something on hex dest
|
||||
void stackAttacking(int ID, int dest, int attackedID); //called when stack with id ID is attacking something on hex dest
|
||||
void newRound(int number); //caled when round is ended; number is the number of round
|
||||
void hexLclicked(int whichOne); //hex only call-in
|
||||
void stackIsShooting(int ID, int dest); //called when stack with id ID is shooting to hex dest
|
||||
void stackIsShooting(int ID, int dest, int attackedID); //called when stack with id ID is shooting to hex dest
|
||||
void stackIsCatapulting(const CatapultAttack & ca); //called when a stack is attacking walls
|
||||
void battleFinished(const BattleResult& br); //called when battle is finished - battleresult window should be printed
|
||||
const BattleResult * bresult; //result of a battle; if non-zero then display when all animations end
|
||||
|
@ -1146,10 +1146,10 @@ void CPlayerInterface::battleAttack(BattleAttack *ba)
|
||||
if(ba->shot())
|
||||
{
|
||||
for(std::set<BattleStackAttacked>::iterator i = ba->bsa.begin(); i != ba->bsa.end(); i++)
|
||||
battleInt->stackIsShooting(ba->stackAttacking,cb->battleGetPos(i->stackAttacked));
|
||||
battleInt->stackIsShooting(ba->stackAttacking,cb->battleGetPos(i->stackAttacked), i->stackAttacked);
|
||||
}
|
||||
else
|
||||
{
|
||||
{//WARNING: does not support multiple attacked creatures
|
||||
const CStack * attacker = cb->battleGetStackByID(ba->stackAttacking);
|
||||
int shift = 0;
|
||||
if(ba->counter() && BattleInfo::mutualPosition(curAction->destinationTile, attacker->position) < 0)
|
||||
@ -1159,7 +1159,7 @@ void CPlayerInterface::battleAttack(BattleAttack *ba)
|
||||
else
|
||||
shift = -1;
|
||||
}
|
||||
battleInt->stackAttacking( ba->stackAttacking, ba->counter() ? curAction->destinationTile + shift : curAction->additionalInfo );
|
||||
battleInt->stackAttacking( ba->stackAttacking, ba->counter() ? curAction->destinationTile + shift : curAction->additionalInfo, ba->bsa.begin()->stackAttacked );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user