* Add a check for the special case of a commander playing in multiplayer (it needs less kills to achieve ranks then); I missed this when replaceing the specialized version of getDroidLevel for commanders

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1831 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-06-06 13:44:52 +00:00
parent cc5de7ec37
commit 2adc6e3515
3 changed files with 15 additions and 1 deletions

View File

@ -169,6 +169,11 @@ void cmdDroidMultiExpBoost(BOOL bDoit)
bMultiExpBoost = bDoit;
}
BOOL cmdGetDroidMultiExpBoost()
{
return bMultiExpBoost;
}
// get the maximum group size for a command droid
unsigned int cmdDroidMaxGroup(DROID *psCommander)
{

View File

@ -77,6 +77,8 @@ extern void cmdSelectSubDroids(DROID *psDroid);
// note that commander experience should be increased
extern void cmdDroidMultiExpBoost(BOOL bDoit);
// check whether commander experience should be increased
extern BOOL cmdGetDroidMultiExpBoost(void);
#endif

View File

@ -4253,15 +4253,22 @@ UDWORD getDroidLevel(DROID *psDroid)
static const unsigned int lastRank = sizeof(arrRank) / sizeof(struct rankMap);
bool isCommander = (psDroid->droidType == DROID_COMMAND ||
psDroid->droidType == DROID_SENSOR) ? true : false;
unsigned int numKills = psDroid->numKills;
unsigned int i;
// Commanders don't need as much kills for ranks in multiplayer
if (isCommander && cmdGetDroidMultiExpBoost())
{
numKills *= 2;
}
// Search through the array of ranks until one is found
// which requires more kills than the droid has.
// Then fall back to the previous rank.
for (i = 1; i != lastRank; ++i)
{
unsigned int requiredKills = isCommander ? arrRank[i].commanderKills : arrRank[i].kills;
if (psDroid->numKills < requiredKills)
if (numKills < requiredKills)
{
return i - 1;
}