1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- fixes for gcc-4.7

- added missing virtual destructors (new warning from gcc)
This commit is contained in:
Ivan Savenko 2012-04-08 10:34:23 +00:00
parent d9064f4f7d
commit f426a48d09
13 changed files with 37 additions and 19 deletions

View File

@ -16,6 +16,10 @@
#include "FuzzyLite.h" #include "FuzzyLite.h"
#include <limits> #include <limits>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include "FunctionTerm.h" #include "FunctionTerm.h"
namespace fl { namespace fl {

View File

@ -824,7 +824,7 @@ void VCAI::showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *do
status.addQuery(); status.addQuery();
//you can't request action from action-response thread //you can't request action from action-response thread
requestActionASAP([=,this]() requestActionASAP([=]()
{ {
pickBestCreatures (down, up); pickBestCreatures (down, up);
onEnd(); onEnd();
@ -2837,4 +2837,4 @@ void SectorMap::makeParentBFS(crint3 source)
unsigned char & SectorMap::retreiveTile(crint3 pos) unsigned char & SectorMap::retreiveTile(crint3 pos)
{ {
return retreiveTileN(sector, pos); return retreiveTileN(sector, pos);
} }

View File

@ -141,7 +141,7 @@ class bmap : public std::map<KeyT, ValT>
public: public:
const ValT & operator[](KeyT key) const const ValT & operator[](KeyT key) const
{ {
return find(key)->second; return this->find(key)->second;
} }
ValT & operator[](KeyT key) ValT & operator[](KeyT key)
{ {

View File

@ -28,6 +28,7 @@ public:
virtual bool init()=0; //to be called - if returned false, call again until returns true virtual bool init()=0; //to be called - if returned false, call again until returns true
virtual void nextFrame()=0; //call every new frame virtual void nextFrame()=0; //call every new frame
virtual void endAnim(); //to be called mostly internally; in this class it removes animation from pendingAnims list virtual void endAnim(); //to be called mostly internally; in this class it removes animation from pendingAnims list
virtual ~CBattleAnimation(){};
bool isEarliest(bool perStackConcurrency); //determines if this animation is earliest of all bool isEarliest(bool perStackConcurrency); //determines if this animation is earliest of all
@ -83,6 +84,7 @@ public:
void endAnim(); void endAnim();
CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner); CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner);
virtual ~CDefenceAnimation(){};
}; };
class CDummyAnimation : public CBattleAnimation class CDummyAnimation : public CBattleAnimation
@ -96,6 +98,7 @@ public:
void endAnim(); void endAnim();
CDummyAnimation(CBattleInterface * _owner, int howManyFrames); CDummyAnimation(CBattleInterface * _owner, int howManyFrames);
virtual ~CDummyAnimation(){}
}; };
/// Hand-to-hand attack /// Hand-to-hand attack
@ -107,6 +110,7 @@ public:
void endAnim(); void endAnim();
CMeleeAttackAnimation(CBattleInterface * _owner, const CStack * attacker, BattleHex _dest, const CStack * _attacked); CMeleeAttackAnimation(CBattleInterface * _owner, const CStack * attacker, BattleHex _dest, const CStack * _attacked);
virtual ~CMeleeAttackAnimation(){};
}; };
/// Move animation of a creature /// Move animation of a creature
@ -127,6 +131,7 @@ public:
void endAnim(); void endAnim();
CMovementAnimation(CBattleInterface *_owner, const CStack *_stack, std::vector<BattleHex> _destTiles, int _distance); CMovementAnimation(CBattleInterface *_owner, const CStack *_stack, std::vector<BattleHex> _destTiles, int _distance);
virtual ~CMovementAnimation(){};
}; };
/// Move end animation of a creature /// Move end animation of a creature
@ -140,6 +145,7 @@ public:
void endAnim(); void endAnim();
CMovementEndAnimation(CBattleInterface * _owner, const CStack * _stack, BattleHex destTile); CMovementEndAnimation(CBattleInterface * _owner, const CStack * _stack, BattleHex destTile);
virtual ~CMovementEndAnimation(){};
}; };
/// Move start animation of a creature /// Move start animation of a creature
@ -151,6 +157,7 @@ public:
void endAnim(); void endAnim();
CMovementStartAnimation(CBattleInterface * _owner, const CStack * _stack); CMovementStartAnimation(CBattleInterface * _owner, const CStack * _stack);
virtual ~CMovementStartAnimation(){};
}; };
/// Class responsible for animation of stack chaning direction (left <-> right) /// Class responsible for animation of stack chaning direction (left <-> right)
@ -169,6 +176,7 @@ public:
void endAnim(); void endAnim();
CReverseAnimation(CBattleInterface * _owner, const CStack * stack, BattleHex dest, bool _priority); CReverseAnimation(CBattleInterface * _owner, const CStack * stack, BattleHex dest, bool _priority);
virtual ~CReverseAnimation(){};
}; };
/// Small struct which contains information about the position and the velocity of a projectile /// Small struct which contains information about the position and the velocity of a projectile
@ -200,6 +208,7 @@ public:
//last two params only for catapult attacks //last two params only for catapult attacks
CShootingAnimation(CBattleInterface * _owner, const CStack * attacker, BattleHex _dest, CShootingAnimation(CBattleInterface * _owner, const CStack * attacker, BattleHex _dest,
const CStack * _attacked, bool _catapult = false, int _catapultDmg = 0); const CStack * _attacked, bool _catapult = false, int _catapultDmg = 0);
virtual ~CShootingAnimation(){};
}; };
/// This class manages a spell effect animation /// This class manages a spell effect animation
@ -218,4 +227,5 @@ public:
CSpellEffectAnimation(CBattleInterface * _owner, ui32 _effect, BattleHex _destTile, int _dx = 0, int _dy = 0, bool _Vflip = false); CSpellEffectAnimation(CBattleInterface * _owner, ui32 _effect, BattleHex _destTile, int _dx = 0, int _dy = 0, bool _Vflip = false);
CSpellEffectAnimation(CBattleInterface * _owner, std::string _customAnim, int _x, int _y, int _dx = 0, int _dy = 0, bool _Vflip = false); CSpellEffectAnimation(CBattleInterface * _owner, std::string _customAnim, int _x, int _y, int _dx = 0, int _dy = 0, bool _Vflip = false);
}; virtual ~CSpellEffectAnimation(){};
};

View File

@ -2018,7 +2018,7 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
if(creAnims.find(ID) == creAnims.end()) //eg. for summoned but not yet handled stacks if(creAnims.find(ID) == creAnims.end()) //eg. for summoned but not yet handled stacks
return; return;
const CCreature *creature = stack->getCreature(); const CCreature *creature = stack->getCreature();
SDL_Rect unitRect = {creAnims[ID]->pos.x, creAnims[ID]->pos.y, int16_t(creAnims[ID]->fullWidth), int16_t(creAnims[ID]->fullHeight)}; SDL_Rect unitRect = {creAnims[ID]->pos.x, creAnims[ID]->pos.y, uint16_t(creAnims[ID]->fullWidth), uint16_t(creAnims[ID]->fullHeight)};
int animType = creAnims[ID]->getType(); int animType = creAnims[ID]->getType();
@ -2672,10 +2672,10 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
else else
{ {
//needed for genie, otherwise covered by battleCan*CastThisSpell //needed for genie, otherwise covered by battleCan*CastThisSpell
if(!shere if( !shere
|| !shere->alive() || !shere->alive()
|| spellSelMode == HOSTILE_CREATURE && shere->owner == sactive->owner || (spellSelMode == HOSTILE_CREATURE && shere->owner == sactive->owner)
|| spellSelMode == FRIENDLY_CREATURE && shere->owner != sactive->owner) || (spellSelMode == FRIENDLY_CREATURE && shere->owner != sactive->owner))
{ {
isCastingPossible = false; isCastingPossible = false;
} }
@ -3033,6 +3033,7 @@ BattleHex CBattleInterface::fromWhichHexAttack(BattleHex myNumber)
break; break;
} }
} }
return -1;
} }
std::string CBattleInterface::SiegeHelper::townTypeInfixes[GameConstants::F_NUMBER] = {"CS", "RM", "TW", "IN", "NC", "DN", "ST", "FR", "EL"}; std::string CBattleInterface::SiegeHelper::townTypeInfixes[GameConstants::F_NUMBER] = {"CS", "RM", "TW", "IN", "NC", "DN", "ST", "FR", "EL"};

View File

@ -56,8 +56,8 @@ class CBattleObstacle
struct StackAttackedInfo struct StackAttackedInfo
{ {
const CStack * defender; //attacked stack const CStack * defender; //attacked stack
int dmg; //damage dealt unsigned int dmg; //damage dealt
int amountKilled; //how many creatures in stack has been killed unsigned int amountKilled; //how many creatures in stack has been killed
const CStack * attacker; //attacking stack const CStack * attacker; //attacking stack
bool byShooting; //if true, stack has been attacked by shooting bool byShooting; //if true, stack has been attacked by shooting
bool killed; //if true, stack has been killed bool killed; //if true, stack has been killed

View File

@ -513,8 +513,8 @@ void CCastleBuildings::checkRules()
static const AnimRule animRule[2] = static const AnimRule animRule[2] =
{ {
{5, 21, 4, 10, -1, 0, 10}, //Mana Vortex, Dungeon {5, 21, 4, 10, size_t(-1), 0, 10}, //Mana Vortex, Dungeon
{0, 6, 8, 1, -1, 0, 1} //Shipyard, Castle {0, 6, 8, 1, size_t(-1), 0, 1} //Shipyard, Castle
}; };
for (size_t i=0; i<2; i++) for (size_t i=0; i<2; i++)

View File

@ -101,6 +101,8 @@ public:
//TODO: replace with something better //TODO: replace with something better
virtual bool prepareMessage(std::string &text, CComponent **comp)=0; virtual bool prepareMessage(std::string &text, CComponent **comp)=0;
virtual ~IInfoBoxData(){};
}; };
class InfoBoxAbstractHeroData : public IInfoBoxData class InfoBoxAbstractHeroData : public IInfoBoxData

View File

@ -751,7 +751,7 @@ void CComponent::init(Etype Type, int Subtype, int Val)
if(!img) if(!img)
{ {
free = false; free = false;
if(type == Component::BUILDING) if(type == CComponent::building)
setSurface(graphics->buildingPics[subtype],val); setSurface(graphics->buildingPics[subtype],val);
} }
SDL_Surface * temp = this->getImg(); SDL_Surface * temp = this->getImg();

View File

@ -84,6 +84,7 @@ static CApplier<CBaseForGSApply> *applierGs = NULL;
class IObjectCaller class IObjectCaller
{ {
public: public:
virtual ~IObjectCaller(){};
virtual void preInit()=0; virtual void preInit()=0;
virtual void postInit()=0; virtual void postInit()=0;
}; };

View File

@ -407,7 +407,7 @@ public:
bool isVisible(const CGObjectInstance *obj, int player); bool isVisible(const CGObjectInstance *obj, int player);
CGameState(); //c-tor CGameState(); //c-tor
~CGameState(); //d-tor virtual ~CGameState(); //d-tor
void getNeighbours(const TerrainTile &srct, int3 tile, std::vector<int3> &vec, const boost::logic::tribool &onLand, bool limitCoastSailing); void getNeighbours(const TerrainTile &srct, int3 tile, std::vector<int3> &vec, const boost::logic::tribool &onLand, bool limitCoastSailing);
int getMovementCost(const CGHeroInstance *h, const int3 &src, const int3 &dest, int remainingMovePoints=-1, bool checkLast=true); int getMovementCost(const CGHeroInstance *h, const int3 &src, const int3 &dest, int remainingMovePoints=-1, bool checkLast=true);
int getDate(int mode=0) const; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month int getDate(int mode=0) const; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month

View File

@ -316,7 +316,7 @@ class CBasicPointerSaver
{ {
public: public:
virtual void savePtr(CSaverBase &ar, const void *data) const =0; virtual void savePtr(CSaverBase &ar, const void *data) const =0;
~CBasicPointerSaver(){} virtual ~CBasicPointerSaver(){}
}; };
template <typename Serializer, typename T> class CPointerSaver : public CBasicPointerSaver template <typename Serializer, typename T> class CPointerSaver : public CBasicPointerSaver
@ -910,7 +910,7 @@ public:
bool isOpen() const; bool isOpen() const;
template<class T> template<class T>
CConnection &operator&(const T&); CConnection &operator&(const T&);
~CConnection(void); virtual ~CConnection(void);
CPack *retreivePack(); //gets from server next pack (allocates it with new) CPack *retreivePack(); //gets from server next pack (allocates it with new)
void sendPackToServer(const CPack &pack, ui8 player, ui32 requestID); void sendPackToServer(const CPack &pack, ui8 player, ui32 requestID);

View File

@ -47,7 +47,7 @@ namespace vstd
explicit unlock_guard(Mutex& m_): explicit unlock_guard(Mutex& m_):
m(&m_) m(&m_)
{ {
unlock(*m); this->unlock(*m);
} }
unlock_guard() unlock_guard()
@ -69,7 +69,7 @@ namespace vstd
~unlock_guard() ~unlock_guard()
{ {
if(m) if(m)
lock(*m); this->lock(*m);
} }
}; };