From d17469bc7ac822827f2923bb73c3b083dcb754b7 Mon Sep 17 00:00:00 2001 From: mateuszb Date: Sat, 1 Aug 2009 12:54:05 +0000 Subject: [PATCH] * small memory leak fixed * minor changes --- client/CBattleInterface.cpp | 48 +++++------------------------------ client/CCreatureAnimation.cpp | 14 +++++----- client/CPlayerInterface.cpp | 1 - 3 files changed, 13 insertions(+), 50 deletions(-) diff --git a/client/CBattleInterface.cpp b/client/CBattleInterface.cpp index e703afc04..c8fab4fa3 100644 --- a/client/CBattleInterface.cpp +++ b/client/CBattleInterface.cpp @@ -2009,54 +2009,18 @@ void CBattleInterface::attackingShowHelper() // TODO: see comment above if (attackingInfo->sh == -1) attackingInfo->sh = CGI->soundh->playSound(aStack.creature->sounds.attack); + + std::map 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()) { - switch(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; - } + type = dirToType[ BattleInfo::mutualPosition(aStack.position + attackingInfo->posShiftDueToDist, attackingInfo->dest) ]; //attack direction } else //else for if(aStack.creature->isDoubleWide()) { - switch(BattleInfo::mutualPosition(aStack.position, 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; - } + type = BattleInfo::mutualPosition(aStack.position, attackingInfo->dest); } + creAnims[attackingInfo->ID]->setType(type); } } else if(attackingInfo->frame == (attackingInfo->maxframe - 1)) diff --git a/client/CCreatureAnimation.cpp b/client/CCreatureAnimation.cpp index 421658487..ce1805404 100644 --- a/client/CCreatureAnimation.cpp +++ b/client/CCreatureAnimation.cpp @@ -283,13 +283,13 @@ CCreatureAnimation::~CCreatureAnimation() } inline void CCreatureAnimation::putPixel( - SDL_Surface * dest, - const int & ftcp, - const BMPPalette & color, - const unsigned char & palc, - const bool & yellowBorder, - const bool & blueBorder, - const unsigned char & animCount + SDL_Surface * dest, + const int & ftcp, + const BMPPalette & color, + const unsigned char & palc, + const bool & yellowBorder, + const bool & blueBorder, + const unsigned char & animCount ) const { if(palc!=0) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index f1579651d..cac3bc31a 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1719,7 +1719,6 @@ void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop) //redraw minimap if owner changed if(sop->what == 1) { - adventureInt->minimap.initFlaggableObjs(); const CGObjectInstance * obj = cb->getObjectInfo(sop->id); std::set pos = obj->getBlockedPos(); for(std::set::const_iterator it = pos.begin(); it != pos.end(); ++it)