mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
* when active stack is killed by spell, game behaves properly
This commit is contained in:
@@ -1870,7 +1870,7 @@ void CBattleInterface::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
|||||||
console->whoSetAlter = 0;
|
console->whoSetAlter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( sactive->hasFeatureOfType(StackFeature::CATAPULT) && isCatapultAttackable(myNumber) ) //catapulting
|
else if( sactive && sactive->hasFeatureOfType(StackFeature::CATAPULT) && isCatapultAttackable(myNumber) ) //catapulting
|
||||||
{
|
{
|
||||||
CGI->curh->changeGraphic(1,16);
|
CGI->curh->changeGraphic(1,16);
|
||||||
console->alterTxt = "";
|
console->alterTxt = "";
|
||||||
@@ -1887,20 +1887,23 @@ void CBattleInterface::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
|||||||
{
|
{
|
||||||
//setting console text and cursor
|
//setting console text and cursor
|
||||||
const CStack *sactive = LOCPLINT->cb->battleGetStackByID(activeStack);
|
const CStack *sactive = LOCPLINT->cb->battleGetStackByID(activeStack);
|
||||||
char buf[500];
|
if(sactive) //there can be a moment when stack is dead ut next is not yet activated
|
||||||
if(LOCPLINT->cb->battleGetStackByID(activeStack)->hasFeatureOfType(StackFeature::FLYING))
|
|
||||||
{
|
{
|
||||||
CGI->curh->changeGraphic(1,2);
|
char buf[500];
|
||||||
sprintf(buf, CGI->generaltexth->allTexts[295].c_str(), sactive->amount == 1 ? sactive->creature->nameSing.c_str() : sactive->creature->namePl.c_str());
|
if(sactive->hasFeatureOfType(StackFeature::FLYING))
|
||||||
}
|
{
|
||||||
else
|
CGI->curh->changeGraphic(1,2);
|
||||||
{
|
sprintf(buf, CGI->generaltexth->allTexts[295].c_str(), sactive->amount == 1 ? sactive->creature->nameSing.c_str() : sactive->creature->namePl.c_str());
|
||||||
CGI->curh->changeGraphic(1,1);
|
}
|
||||||
sprintf(buf, CGI->generaltexth->allTexts[294].c_str(), sactive->amount == 1 ? sactive->creature->nameSing.c_str() : sactive->creature->namePl.c_str());
|
else
|
||||||
}
|
{
|
||||||
|
CGI->curh->changeGraphic(1,1);
|
||||||
|
sprintf(buf, CGI->generaltexth->allTexts[294].c_str(), sactive->amount == 1 ? sactive->creature->nameSing.c_str() : sactive->creature->namePl.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
console->alterTxt = buf;
|
console->alterTxt = buf;
|
||||||
console->whoSetAlter = 0;
|
console->whoSetAlter = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -443,7 +443,7 @@ askInterfaceForMove:
|
|||||||
sas.stack = next->ID;
|
sas.stack = next->ID;
|
||||||
sendAndApply(&sas);
|
sendAndApply(&sas);
|
||||||
boost::unique_lock<boost::mutex> lock(battleMadeAction.mx);
|
boost::unique_lock<boost::mutex> lock(battleMadeAction.mx);
|
||||||
while(!battleMadeAction.data && !battleResult.get()) //active stack hasn't made its action and battle is still going
|
while(next->alive() && (!battleMadeAction.data && !battleResult.get())) //active stack hasn't made its action and battle is still going
|
||||||
battleMadeAction.cond.wait(lock);
|
battleMadeAction.cond.wait(lock);
|
||||||
battleMadeAction.data = false;
|
battleMadeAction.data = false;
|
||||||
}
|
}
|
||||||
@@ -3163,6 +3163,10 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendAndApply(&EndAction());
|
sendAndApply(&EndAction());
|
||||||
|
if( !gs->curB->getStack(gs->curB->activeStack, false)->alive() )
|
||||||
|
{
|
||||||
|
battleMadeAction.setn(true);
|
||||||
|
}
|
||||||
checkForBattleEnd(gs->curB->stacks);
|
checkForBattleEnd(gs->curB->stacks);
|
||||||
if(battleResult.get())
|
if(battleResult.get())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user