Bläddra i källkod

Growing stacks will now properly display rough numbers.
By this occasion enabled power rating feature. Hope you like it :)

DjWarmonger 15 år sedan
förälder
incheckning
963c93551f
2 ändrade filer med 15 tillägg och 7 borttagningar
  1. 14 6
      hch/CObjectHandler.cpp
  2. 1 1
      hch/CObjectHandler.h

+ 14 - 6
hch/CObjectHandler.cpp

@@ -2376,13 +2376,18 @@ void CTownBonus::onHeroVisit (const CGHeroInstance * h) const
 			cb->setObjProperty (town->id, 13, id); //then it must be garrisoned hero
 			cb->setObjProperty (town->id, 13, id); //then it must be garrisoned hero
 	}
 	}
 }
 }
-/*const std::string & CGCreature::getHoverText() const
+const std::string & CGCreature::getHoverText() const
 {
 {
-	hoverName = VLC->generaltexth->names[ID];
-	hoverName += "\n Power rating: ";
+	MetaString ms;
+	int pom = slots.find(0)->second.getQuantityID();
+	pom = 174 + 3*pom + 1;
+	ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID);
+	ms.toString(hoverName);
+
+	hoverName += "\n\n Threat: ";
 	float ratio = ((float)getArmyStrength() / cb->getSelectedHero(cb->getCurrentPlayer())->getTotalStrength());
 	float ratio = ((float)getArmyStrength() / cb->getSelectedHero(cb->getCurrentPlayer())->getTotalStrength());
 	if (ratio < 0.1) hoverName += "Effortless";
 	if (ratio < 0.1) hoverName += "Effortless";
-	else if (ratio < 0.3) hoverName += "Very Weak";
+	else if (ratio < 0.25) hoverName += "Very Weak";
 	else if (ratio < 0.6) hoverName += "Weak";
 	else if (ratio < 0.6) hoverName += "Weak";
 	else if (ratio < 0.9) hoverName += "A bit weaker";
 	else if (ratio < 0.9) hoverName += "A bit weaker";
 	else if (ratio < 1.1) hoverName += "Equal";
 	else if (ratio < 1.1) hoverName += "Equal";
@@ -2394,7 +2399,7 @@ void CTownBonus::onHeroVisit (const CGHeroInstance * h) const
 	else if (ratio < 20) hoverName += "Deadly";
 	else if (ratio < 20) hoverName += "Deadly";
 	else hoverName += "Impossible";
 	else hoverName += "Impossible";
 	return hoverName;
 	return hoverName;
-}*/
+}
 void CGCreature::onHeroVisit( const CGHeroInstance * h ) const
 void CGCreature::onHeroVisit( const CGHeroInstance * h ) const
 {
 {
 	int action = takenAction(h);
 	int action = takenAction(h);
@@ -2450,12 +2455,14 @@ void CGCreature::endBattle( BattleResult *result ) const
 		//		killedAmount += i->second;
 		//		killedAmount += i->second;
 		//cb->setAmount(id, slots.find(0)->second.second - killedAmount);	
 		//cb->setAmount(id, slots.find(0)->second.second - killedAmount);	
 
 
+		/*
 		MetaString ms;
 		MetaString ms;
 		int pom = slots.find(0)->second.getQuantityID();
 		int pom = slots.find(0)->second.getQuantityID();
 		pom = 174 + 3*pom + 1;
 		pom = 174 + 3*pom + 1;
 		ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID);
 		ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID);
 		cb->setHoverName(id,&ms);
 		cb->setHoverName(id,&ms);
 		cb->setObjProperty(id, 11, slots.begin()->second.count * 1000);
 		cb->setObjProperty(id, 11, slots.begin()->second.count * 1000);
+		*/
 	}
 	}
 }
 }
 
 
@@ -2489,13 +2496,14 @@ void CGCreature::initObj()
 			amount = c.ammMax;
 			amount = c.ammMax;
 		else
 		else
 			amount = c.ammMin + (ran() % (c.ammMax - c.ammMin));
 			amount = c.ammMin + (ran() % (c.ammMax - c.ammMin));
-
+	/*
 	MetaString ms;
 	MetaString ms;
 	int pom = slots.find(0)->second.getQuantityID();
 	int pom = slots.find(0)->second.getQuantityID();
 	pom = 174 + 3*pom + 1;
 	pom = 174 + 3*pom + 1;
 	ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID);
 	ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID);
 	ms.toString(hoverName);
 	ms.toString(hoverName);
 	temppower = slots[0].count * 1000;
 	temppower = slots[0].count * 1000;
+	*/
 }
 }
 void CGCreature::newTurn() const
 void CGCreature::newTurn() const
 {//Works only for stacks of single type of size up to 2 millions
 {//Works only for stacks of single type of size up to 2 millions

+ 1 - 1
hch/CObjectHandler.h

@@ -624,7 +624,7 @@ public:
 
 
 	void fight(const CGHeroInstance *h) const;
 	void fight(const CGHeroInstance *h) const;
 	void onHeroVisit(const CGHeroInstance * h) const;
 	void onHeroVisit(const CGHeroInstance * h) const;
-	//const std::string & getHoverText() const;
+	const std::string & getHoverText() const;
 
 
 	void flee( const CGHeroInstance * h ) const;
 	void flee( const CGHeroInstance * h ) const;
 	void endBattle(BattleResult *result) const;
 	void endBattle(BattleResult *result) const;