mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
Proper handling of cursor.
This commit is contained in:
parent
f1f416c890
commit
27a82af24c
@ -2028,21 +2028,19 @@ void CBattleInterface::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
|||||||
{
|
{
|
||||||
if(!vstd::contains(occupyableHexes, myNumber) || activeStack->coversPos(myNumber))
|
if(!vstd::contains(occupyableHexes, myNumber) || activeStack->coversPos(myNumber))
|
||||||
{
|
{
|
||||||
const CStack *shere = curInt->cb->battleGetStackByPos(myNumber);
|
const CStack *shere = curInt->cb->battleGetStackByPos(myNumber, false);
|
||||||
const CStack *sactive = activeStack;
|
const CStack *sactive = activeStack;
|
||||||
if(shere)
|
if(shere)
|
||||||
{
|
{
|
||||||
if(shere->owner == curInt->playerID) //our stack
|
if(shere->owner == curInt->playerID) //our stack
|
||||||
|
{
|
||||||
|
if (shere->alive())
|
||||||
{
|
{
|
||||||
if(sactive->hasBonusOfType(Bonus::HEALER))
|
if(sactive->hasBonusOfType(Bonus::HEALER))
|
||||||
{
|
{
|
||||||
//display the possibility to heal this creature
|
//display the possibility to heal this creature
|
||||||
CCS->curh->changeGraphic(1,17);
|
CCS->curh->changeGraphic(1,17);
|
||||||
}
|
}
|
||||||
else if (sactive->hasBonusOfType(Bonus::DAEMON_SUMMONING))
|
|
||||||
{
|
|
||||||
CCS->curh->changeGraphic(3, 0);
|
|
||||||
}
|
|
||||||
else if (stackCanCastSpell && spellSelMode > STACK_SPELL_CANCELLED) //player did not decide to cancel this spell
|
else if (stackCanCastSpell && spellSelMode > STACK_SPELL_CANCELLED) //player did not decide to cancel this spell
|
||||||
{
|
{
|
||||||
//spellDestSelectMode
|
//spellDestSelectMode
|
||||||
@ -2070,8 +2068,13 @@ void CBattleInterface::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
|||||||
creAnims[shere->ID]->playOnce(CCreatureAnim::MOUSEON);
|
creAnims[shere->ID]->playOnce(CCreatureAnim::MOUSEON);
|
||||||
lastMouseHoveredStackAnimationTime = curTime;
|
lastMouseHoveredStackAnimationTime = curTime;
|
||||||
}
|
}
|
||||||
mouseHoveredStack = shere->ID;
|
} //end of alive
|
||||||
|
else if (sactive->hasBonusOfType(Bonus::DAEMON_SUMMONING) && sactive->casts)
|
||||||
|
{
|
||||||
|
CCS->curh->changeGraphic(3, 0);
|
||||||
}
|
}
|
||||||
|
mouseHoveredStack = shere->ID; //for dead also?
|
||||||
|
} //not our stack
|
||||||
else if(curInt->cb->battleCanShoot(activeStack,myNumber)) //we can shoot enemy
|
else if(curInt->cb->battleCanShoot(activeStack,myNumber)) //we can shoot enemy
|
||||||
{
|
{
|
||||||
if(curInt->cb->battleHasDistancePenalty(activeStack, myNumber) ||
|
if(curInt->cb->battleHasDistancePenalty(activeStack, myNumber) ||
|
||||||
@ -3504,7 +3507,7 @@ void CBattleInterface::activateStack()
|
|||||||
bSurrender->block(curInt->cb->battleGetSurrenderCost() < 0);
|
bSurrender->block(curInt->cb->battleGetSurrenderCost() < 0);
|
||||||
|
|
||||||
//set casting flag to true if creature can use it to not check it every time
|
//set casting flag to true if creature can use it to not check it every time
|
||||||
if (s->casts && s->hasBonus(Selector::type(Bonus::SPELLCASTER) || Selector::type(Bonus::DAEMON_SUMMONING)))
|
if (s->casts && s->hasBonus(Selector::type(Bonus::SPELLCASTER)))
|
||||||
{
|
{
|
||||||
stackCanCastSpell = true;
|
stackCanCastSpell = true;
|
||||||
|
|
||||||
@ -3516,6 +3519,8 @@ void CBattleInterface::activateStack()
|
|||||||
if (stackSpells.size())
|
if (stackSpells.size())
|
||||||
creatureSpellToCast = stackSpells[111 % stackSpells.size()]; //TODO: randomize? weighted chance?
|
creatureSpellToCast = stackSpells[111 % stackSpells.size()]; //TODO: randomize? weighted chance?
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
stackCanCastSpell = false;
|
||||||
|
|
||||||
GH.fakeMouseMove();
|
GH.fakeMouseMove();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user