Explorar o código

- fixed some extra warnings. Mostly harmless.
NOTE: Please check changes in BattleState.cpp and GameHandler.cpp for possible bugs

Ivan Savenko %!s(int64=13) %!d(string=hai) anos
pai
achega
faaf799d95

+ 1 - 1
AI/VCAI/Fuzzy.cpp

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

+ 1 - 1
client/BattleInterface/CBattleInterfaceClasses.h

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

+ 1 - 1
client/CAnimation.cpp

@@ -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++)
 			{
 				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);
 			}
 			return;

+ 1 - 1
client/CCreatureWindow.h

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

+ 2 - 2
client/CHeroWindow.cpp

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

+ 1 - 1
client/CPreGame.cpp

@@ -1554,7 +1554,7 @@ CChatBox::CChatBox(const Rect &rect)
 	inputBox->used &= ~KEYBOARD;
 	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;
 }
 

+ 2 - 2
client/UIFramework/SDL_Extensions.cpp

@@ -896,7 +896,7 @@ void CSDL_Ext::setPlayerColor(SDL_Surface * sur, ui8 player)
 		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)							\
 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)
 	{

+ 2 - 2
client/UIFramework/SDL_Extensions.h

@@ -133,8 +133,8 @@ namespace CSDL_Ext
 
 
 	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
-	const TColorPutterAlpha getPutterAlphaFor(SDL_Surface  * const &dest, int incrementing); //incrementing: -1, 0, 1
+	TColorPutter getPutterFor(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 getBlitterWithRotationAndAlpha(SDL_Surface *dest);
 

+ 1 - 1
lib/BattleState.cpp

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

+ 1 - 1
lib/CGameState.cpp

@@ -1520,7 +1520,7 @@ void CGameState::init(StartInfo * si)
 
 	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;
 
 		//init visiting and garrisoned heroes

+ 1 - 1
lib/HeroBonus.cpp

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

+ 1 - 1
lib/HeroBonus.h

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

+ 1 - 1
lib/IGameCallback.cpp

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

+ 1 - 1
lib/IGameCallback.h

@@ -245,7 +245,7 @@ public:
 class DLL_LINKAGE CPrivilagedInfoCallback : public CGameInfoCallback
 {
 public:
-	CGameState *const gameState ();
+	CGameState * gameState ();
 	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 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

+ 1 - 1
lib/NetPacksLib.cpp

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

+ 1 - 1
lib/int3.h

@@ -16,7 +16,7 @@ class int3
 public:
 	si32 x,y,z;
 	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 operator=(const int3 & val) {x = val.x; y = val.y; z = val.z; return *this;} //assignemt operator
 	~int3() {} // d-tor - does nothing

+ 4 - 4
server/CGameHandler.cpp

@@ -1517,7 +1517,7 @@ void CGameHandler::run(bool resume)
 		for(; i != gs->players.end(); i++)
 		{
 			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->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);
 // 	if(!p->human)
@@ -4994,7 +4994,7 @@ void CGameHandler::getLossVicMessage( ui8 player, ui8 standard, bool victory, In
 
 	if(victory)
 	{
-		if(standard < 0) //not std loss
+		if(standard > 0) //not std loss
 		{
 			switch(gs->map->victoryCondition.condition)
 			{
@@ -5055,7 +5055,7 @@ void CGameHandler::getLossVicMessage( ui8 player, ui8 standard, bool victory, In
 	}
 	else
 	{
-		if(standard < 0) //not std loss
+		if(standard > 0) //not std loss
 		{
 			switch(gs->map->lossCondition.typeOfLossCon)
 			{

+ 1 - 1
server/CGameHandler.h

@@ -107,7 +107,7 @@ public:
 	void runBattle();
 	void checkLossVictory(ui8 player);
 	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
 	boost::function<void(BattleResult*)> * battleEndCallback;