1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00

Rewrote CCreature::estimateCreatureCount to fix a compile warning.

This commit is contained in:
Frank Zago 2011-08-27 02:15:58 +00:00
parent cb66e1b69b
commit 866d1c6e2a
2 changed files with 7 additions and 24 deletions

View File

@ -77,31 +77,14 @@ int CCreature::getQuantityID(const int & quantity)
return 8;
}
int CCreature::estimateCreatureCount(int countID)
int CCreature::estimateCreatureCount(unsigned int countID)
{
switch(countID)
{
case 0:
return 3;
case 1:
return 8;
case 2:
return 15;
case 3:
return 35;
case 4:
return 75;
case 5:
return 175;
case 6:
return 375;
case 7:
return 750;
case 8:
return 2500;
default:
static const int creature_count[] = { 3, 8, 15, 35, 75, 175, 375, 750, 2500 };
if (countID > 8)
assert("Wrong countID!");
}
return creature_count[countID];
}
bool CCreature::isDoubleWide() const

View File

@ -58,7 +58,7 @@ public:
bool isEvil () const;
si32 maxAmount(const std::vector<si32> &res) const; //how many creatures can be bought
static int getQuantityID(const int & quantity); //0 - a few, 1 - several, 2 - pack, 3 - lots, 4 - horde, 5 - throng, 6 - swarm, 7 - zounds, 8 - legion
static int estimateCreatureCount(int countID); //reverse version of above function, returns middle of range
static int estimateCreatureCount(unsigned int countID); //reverse version of above function, returns middle of range
bool isMyUpgrade(const CCreature *anotherCre) const;
bool valid() const;