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

- fixed some extra warnings. Mostly harmless.

NOTE: Please check changes in BattleState.cpp and GameHandler.cpp for possible bugs
This commit is contained in:
Ivan Savenko 2012-05-28 19:29:32 +00:00
parent 61ccabde53
commit faaf799d95
18 changed files with 24 additions and 24 deletions

View File

@ -15,7 +15,7 @@
#define MIN_AI_STRENGHT (0.5f) //lower when combat AI gets smarter #define MIN_AI_STRENGHT (0.5f) //lower when combat AI gets smarter
class BankConfig; struct BankConfig;
class FuzzyEngine; class FuzzyEngine;
class InputLVar; class InputLVar;
class CGTownInstance; class CGTownInstance;

View File

@ -11,7 +11,7 @@ class CAdventureMapButton;
class CHighlightableButton; class CHighlightableButton;
class CHighlightableButtonsGroup; class CHighlightableButtonsGroup;
class CLabel; class CLabel;
class BattleResult; struct BattleResult;
class CStack; class CStack;
/* /*

View File

@ -749,7 +749,7 @@ void CompImage::BlitBlock(ui8 type, ui8 size, ui8 *&data, ui8 *&dest, ui8 alpha)
for (size_t i=0; i<size; i++) for (size_t i=0; i<size; i++)
{ {
SDL_Color col = palette[*(data++)]; SDL_Color col = palette[*(data++)];
col.unused = (ui32)col.unused*(255-alpha)/255; col.unused = (ui32)col.unused*alpha/255;
ColorPutter<bpp, 1>::PutColorAlpha(dest, col); ColorPutter<bpp, 1>::PutColorAlpha(dest, col);
} }
return; return;

View File

@ -19,7 +19,7 @@ class CCreature;
class CStackInstance; class CStackInstance;
class CCommanderInstance; class CCommanderInstance;
class CStack; class CStack;
class ArtifactLocation; struct ArtifactLocation;
class CCreatureArtifactInstance; class CCreatureArtifactInstance;
class CAdventureMapButton; class CAdventureMapButton;
class CBonusItem; class CBonusItem;

View File

@ -305,13 +305,13 @@ void CHeroWindow::questlog()
void CHeroWindow::commanderWindow() void CHeroWindow::commanderWindow()
{ {
//TODO: allow equipping commander artifacts by drag / drop //TODO: allow equipping commander artifacts by drag / drop
bool artSelected = false; //bool artSelected = false;
const CArtifactsOfHero::SCommonPart *commonInfo = artSets.front()->commonInfo; const CArtifactsOfHero::SCommonPart *commonInfo = artSets.front()->commonInfo;
if (const CArtifactInstance *art = commonInfo->src.art) if (const CArtifactInstance *art = commonInfo->src.art)
{ {
const CGHeroInstance *srcHero = commonInfo->src.AOH->getHero(); const CGHeroInstance *srcHero = commonInfo->src.AOH->getHero();
artSelected = true; //artSelected = true;
int freeSlot = art->firstAvailableSlot (curHero->commander); int freeSlot = art->firstAvailableSlot (curHero->commander);
if (freeSlot < ArtifactPosition::COMMANDER_AFTER_LAST) //we don't want to put it in commander's backpack! if (freeSlot < ArtifactPosition::COMMANDER_AFTER_LAST) //we don't want to put it in commander's backpack!
{ {

View File

@ -1554,7 +1554,7 @@ CChatBox::CChatBox(const Rect &rect)
inputBox->used &= ~KEYBOARD; inputBox->used &= ~KEYBOARD;
chatHistory = new CTextBox("", Rect(0, 0, rect.w, rect.h - height), 1); chatHistory = new CTextBox("", Rect(0, 0, rect.w, rect.h - height), 1);
SDL_Color green = {0,252,0}; SDL_Color green = {0,252,0, SDL_ALPHA_OPAQUE};
chatHistory->color = green; chatHistory->color = green;
} }

View File

@ -896,7 +896,7 @@ void CSDL_Ext::setPlayerColor(SDL_Surface * sur, ui8 player)
tlog3 << "Warning, setPlayerColor called on not 8bpp surface!\n"; tlog3 << "Warning, setPlayerColor called on not 8bpp surface!\n";
} }
const TColorPutter CSDL_Ext::getPutterFor(SDL_Surface * const &dest, int incrementing) TColorPutter CSDL_Ext::getPutterFor(SDL_Surface * const &dest, int incrementing)
{ {
#define CASE_BPP(BytesPerPixel) \ #define CASE_BPP(BytesPerPixel) \
case BytesPerPixel: \ case BytesPerPixel: \
@ -920,7 +920,7 @@ case BytesPerPixel: \
} }
const TColorPutterAlpha CSDL_Ext::getPutterAlphaFor(SDL_Surface * const &dest, int incrementing) TColorPutterAlpha CSDL_Ext::getPutterAlphaFor(SDL_Surface * const &dest, int incrementing)
{ {
switch(dest->format->BytesPerPixel) switch(dest->format->BytesPerPixel)
{ {

View File

@ -133,8 +133,8 @@ namespace CSDL_Ext
Uint8 *getPxPtr(const SDL_Surface * const &srf, const int x, const int y); Uint8 *getPxPtr(const SDL_Surface * const &srf, const int x, const int y);
const TColorPutter getPutterFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1 TColorPutter getPutterFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1
const TColorPutterAlpha getPutterAlphaFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1 TColorPutterAlpha getPutterAlphaFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1
BlitterWithRotationVal getBlitterWithRotation(SDL_Surface *dest); BlitterWithRotationVal getBlitterWithRotation(SDL_Surface *dest);
BlitterWithRotationVal getBlitterWithRotationAndAlpha(SDL_Surface *dest); BlitterWithRotationVal getBlitterWithRotationAndAlpha(SDL_Surface *dest);

View File

@ -3064,7 +3064,7 @@ const CGHeroInstance * CStack::getMyHero() const
else //we are attached directly? else //we are attached directly?
BOOST_FOREACH(const CBonusSystemNode *n, getParentNodes()) BOOST_FOREACH(const CBonusSystemNode *n, getParentNodes())
if(n->getNodeType() == HERO) if(n->getNodeType() == HERO)
dynamic_cast<const CGHeroInstance *>(n); dynamic_cast<const CGHeroInstance *>(n);//FIXME: unused result. Missing return?
return NULL; return NULL;
} }

View File

@ -1520,7 +1520,7 @@ void CGameState::init(StartInfo * si)
for(std::map<ui8, PlayerState>::iterator k=players.begin(); k!=players.end(); ++k) for(std::map<ui8, PlayerState>::iterator k=players.begin(); k!=players.end(); ++k)
{ {
if(k->first==-1 || k->first==255) if(k->first==255)
continue; continue;
//init visiting and garrisoned heroes //init visiting and garrisoned heroes

View File

@ -858,7 +858,7 @@ void CBonusSystemNode::exportBonuses()
exportBonus(b); exportBonus(b);
} }
const ui8 CBonusSystemNode::getNodeType() const ui8 CBonusSystemNode::getNodeType() const
{ {
return nodeType; return nodeType;
} }

View File

@ -591,7 +591,7 @@ public:
BonusList &getBonusList(); BonusList &getBonusList();
const BonusList &getBonusList() const; const BonusList &getBonusList() const;
BonusList &getExportedBonusList(); BonusList &getExportedBonusList();
const ui8 getNodeType() const; ui8 getNodeType() const;
void setNodeType(ui8 type); void setNodeType(ui8 type);
const TNodesVector &getParentNodes() const; const TNodesVector &getParentNodes() const;
const TNodesVector &getChildrenNodes() const; const TNodesVector &getChildrenNodes() const;

View File

@ -443,7 +443,7 @@ int CBattleInfoCallback::battleGetMoatDmg()
return 0; return 0;
} }
CGameState *const CPrivilagedInfoCallback::gameState () CGameState * CPrivilagedInfoCallback::gameState ()
{ {
return gs; return gs;
} }

View File

@ -245,7 +245,7 @@ public:
class DLL_LINKAGE CPrivilagedInfoCallback : public CGameInfoCallback class DLL_LINKAGE CPrivilagedInfoCallback : public CGameInfoCallback
{ {
public: public:
CGameState *const gameState (); CGameState * gameState ();
void getFreeTiles (std::vector<int3> &tiles) const; //used for random spawns void getFreeTiles (std::vector<int3> &tiles) const; //used for random spawns
void getTilesInRange(boost::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, int player=-1, int mode=0) const; //mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only unrevealed void getTilesInRange(boost::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, int player=-1, int mode=0) const; //mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only unrevealed
void getAllTiles (boost::unordered_set<int3, ShashInt3> &tiles, int player=-1, int level=-1, int surface=0) const; //returns all tiles on given level (-1 - both levels, otherwise number of level); surface: 0 - land and water, 1 - only land, 2 - only water void getAllTiles (boost::unordered_set<int3, ShashInt3> &tiles, int player=-1, int level=-1, int surface=0) const; //returns all tiles on given level (-1 - both levels, otherwise number of level); surface: 0 - land and water, 1 - only land, 2 - only water

View File

@ -1200,7 +1200,7 @@ DLL_LINKAGE void BattleSpellCast::applyGs( CGameState *gs )
vstd::amax(h->mana, 0); vstd::amax(h->mana, 0);
if (enemy && manaGained) if (enemy && manaGained)
enemy->mana += manaGained; enemy->mana += manaGained;
if (side >= 0 && side < 2) if (side < 2)
{ {
gs->curB->castSpells[side]++; gs->curB->castSpells[side]++;
} }

View File

@ -16,7 +16,7 @@ class int3
public: public:
si32 x,y,z; si32 x,y,z;
inline int3():x(0),y(0),z(0){}; //c-tor, x/y/z initialized to 0 inline int3():x(0),y(0),z(0){}; //c-tor, x/y/z initialized to 0
inline int3(const si32 & X, const si32 & Y, const si32 & Z):x(X),y(Y),z(Z){}; //c-tor inline int3(const si32 X, const si32 Y, const si32 Z):x(X),y(Y),z(Z){}; //c-tor
inline int3(const int3 & val) : x(val.x), y(val.y), z(val.z){} //copy c-tor inline int3(const int3 & val) : x(val.x), y(val.y), z(val.z){} //copy c-tor
inline int3 operator=(const int3 & val) {x = val.x; y = val.y; z = val.z; return *this;} //assignemt operator inline int3 operator=(const int3 & val) {x = val.x; y = val.y; z = val.z; return *this;} //assignemt operator
~int3() {} // d-tor - does nothing ~int3() {} // d-tor - does nothing

View File

@ -1517,7 +1517,7 @@ void CGameHandler::run(bool resume)
for(; i != gs->players.end(); i++) for(; i != gs->players.end(); i++)
{ {
if((i->second.towns.size()==0 && i->second.heroes.size()==0) if((i->second.towns.size()==0 && i->second.heroes.size()==0)
|| i->second.color<0 //|| i->second.color<0 //FIXME: color is unsigned. Redundant or incorrect check?
|| i->first>=GameConstants::PLAYER_LIMIT || i->first>=GameConstants::PLAYER_LIMIT
|| i->second.status) || i->second.status)
{ {
@ -4984,7 +4984,7 @@ void CGameHandler::checkLossVictory( ui8 player )
} }
} }
void CGameHandler::getLossVicMessage( ui8 player, ui8 standard, bool victory, InfoWindow &out ) const void CGameHandler::getLossVicMessage( ui8 player, si8 standard, bool victory, InfoWindow &out ) const
{ {
// const PlayerState *p = gs->getPlayer(player); // const PlayerState *p = gs->getPlayer(player);
// if(!p->human) // if(!p->human)
@ -4994,7 +4994,7 @@ void CGameHandler::getLossVicMessage( ui8 player, ui8 standard, bool victory, In
if(victory) if(victory)
{ {
if(standard < 0) //not std loss if(standard > 0) //not std loss
{ {
switch(gs->map->victoryCondition.condition) switch(gs->map->victoryCondition.condition)
{ {
@ -5055,7 +5055,7 @@ void CGameHandler::getLossVicMessage( ui8 player, ui8 standard, bool victory, In
} }
else else
{ {
if(standard < 0) //not std loss if(standard > 0) //not std loss
{ {
switch(gs->map->lossCondition.typeOfLossCon) switch(gs->map->lossCondition.typeOfLossCon)
{ {

View File

@ -107,7 +107,7 @@ public:
void runBattle(); void runBattle();
void checkLossVictory(ui8 player); void checkLossVictory(ui8 player);
void winLoseHandle(ui8 players=255); //players: bit field - colours of players to be checked; default: all void winLoseHandle(ui8 players=255); //players: bit field - colours of players to be checked; default: all
void getLossVicMessage(ui8 player, ui8 standard, bool victory, InfoWindow &out) const; void getLossVicMessage(ui8 player, si8 standard, bool victory, InfoWindow &out) const;
////used only in endBattle - don't touch elsewhere ////used only in endBattle - don't touch elsewhere
boost::function<void(BattleResult*)> * battleEndCallback; boost::function<void(BattleResult*)> * battleEndCallback;