mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
* small memory leak fixed
* minor changes
This commit is contained in:
@@ -2009,54 +2009,18 @@ void CBattleInterface::attackingShowHelper()
|
|||||||
// TODO: see comment above
|
// TODO: see comment above
|
||||||
if (attackingInfo->sh == -1)
|
if (attackingInfo->sh == -1)
|
||||||
attackingInfo->sh = CGI->soundh->playSound(aStack.creature->sounds.attack);
|
attackingInfo->sh = CGI->soundh->playSound(aStack.creature->sounds.attack);
|
||||||
|
|
||||||
|
std::map<int, int> dirToType = boost::assign::map_list_of (0, 11)(1, 11)(2, 12)(3, 13)(4, 13)(5, 12);
|
||||||
|
int type; //dependent on attack direction
|
||||||
if(aStack.creature->isDoubleWide())
|
if(aStack.creature->isDoubleWide())
|
||||||
{
|
{
|
||||||
switch(BattleInfo::mutualPosition(aStack.position+attackingInfo->posShiftDueToDist, attackingInfo->dest)) //attack direction
|
type = dirToType[ BattleInfo::mutualPosition(aStack.position + attackingInfo->posShiftDueToDist, attackingInfo->dest) ]; //attack direction
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
creAnims[attackingInfo->ID]->setType(11);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
creAnims[attackingInfo->ID]->setType(11);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
creAnims[attackingInfo->ID]->setType(12);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
creAnims[attackingInfo->ID]->setType(13);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
creAnims[attackingInfo->ID]->setType(13);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
creAnims[attackingInfo->ID]->setType(12);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else //else for if(aStack.creature->isDoubleWide())
|
else //else for if(aStack.creature->isDoubleWide())
|
||||||
{
|
{
|
||||||
switch(BattleInfo::mutualPosition(aStack.position, attackingInfo->dest)) //attack direction
|
type = BattleInfo::mutualPosition(aStack.position, attackingInfo->dest);
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
creAnims[attackingInfo->ID]->setType(11);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
creAnims[attackingInfo->ID]->setType(11);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
creAnims[attackingInfo->ID]->setType(12);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
creAnims[attackingInfo->ID]->setType(13);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
creAnims[attackingInfo->ID]->setType(13);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
creAnims[attackingInfo->ID]->setType(12);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
creAnims[attackingInfo->ID]->setType(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(attackingInfo->frame == (attackingInfo->maxframe - 1))
|
else if(attackingInfo->frame == (attackingInfo->maxframe - 1))
|
||||||
|
@@ -283,13 +283,13 @@ CCreatureAnimation::~CCreatureAnimation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void CCreatureAnimation::putPixel(
|
inline void CCreatureAnimation::putPixel(
|
||||||
SDL_Surface * dest,
|
SDL_Surface * dest,
|
||||||
const int & ftcp,
|
const int & ftcp,
|
||||||
const BMPPalette & color,
|
const BMPPalette & color,
|
||||||
const unsigned char & palc,
|
const unsigned char & palc,
|
||||||
const bool & yellowBorder,
|
const bool & yellowBorder,
|
||||||
const bool & blueBorder,
|
const bool & blueBorder,
|
||||||
const unsigned char & animCount
|
const unsigned char & animCount
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if(palc!=0)
|
if(palc!=0)
|
||||||
|
@@ -1719,7 +1719,6 @@ void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
|
|||||||
//redraw minimap if owner changed
|
//redraw minimap if owner changed
|
||||||
if(sop->what == 1)
|
if(sop->what == 1)
|
||||||
{
|
{
|
||||||
adventureInt->minimap.initFlaggableObjs();
|
|
||||||
const CGObjectInstance * obj = cb->getObjectInfo(sop->id);
|
const CGObjectInstance * obj = cb->getObjectInfo(sop->id);
|
||||||
std::set<int3> pos = obj->getBlockedPos();
|
std::set<int3> pos = obj->getBlockedPos();
|
||||||
for(std::set<int3>::const_iterator it = pos.begin(); it != pos.end(); ++it)
|
for(std::set<int3>::const_iterator it = pos.begin(); it != pos.end(); ++it)
|
||||||
|
Reference in New Issue
Block a user