Move the modifyResources function into the body of loadPowerGenFunction on account that it is only ever called from there.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6669 4a71c877-e1ca-e34f-864e-861f7616d084
master
Freddie Witherden 2009-02-21 15:58:03 +00:00
parent b3ea581e61
commit c5f23a0739
3 changed files with 18 additions and 24 deletions

View File

@ -782,7 +782,24 @@ static BOOL loadPowerGenFunction(const char *pData)
if(bMultiPlayer)
{
modifyResources(psFunction);
switch(game.power)
{
// Multiply by 3/4
case LEV_LOW:
psFunction->powerMultiplier *= 3;
psFunction->powerMultiplier /= 4;
break;
// No change
case LEV_MED:
break;
// Multiply by 5/4
case LEV_HI:
psFunction->powerMultiplier *= 5;
psFunction->powerMultiplier /= 4;
break;
default:
break;
}
}

View File

@ -326,24 +326,3 @@ void setupNewPlayer(UDWORD dpid, UDWORD player)
ssprintf(buf, _("%s is Joining the Game"), getPlayerName(player));
addConsoleMessage(buf,DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
}
// ////////////////////////////////////////////////////////////////////////////
// reduce the amount of oil that can be extracted.
void modifyResources(POWER_GEN_FUNCTION* psFunction)
{
switch(game.power)
{
case LEV_LOW:
psFunction->powerMultiplier = psFunction->powerMultiplier * 3/4 ; // careful with the brackets! (do mul before div)
break;
case LEV_MED:
psFunction->powerMultiplier = psFunction->powerMultiplier * 1;
break;
case LEV_HI:
psFunction->powerMultiplier = psFunction->powerMultiplier * 5/4 ;
break;
default:
break;
}
return;
}

View File

@ -194,8 +194,6 @@ extern BOOL sendPing (void); // allow game to request pings.
extern BOOL ForceDroidSync(const DROID* droidToSend);
// multijoin
extern void modifyResources (POWER_GEN_FUNCTION* psFunction);
extern BOOL sendReseachStatus (STRUCTURE *psBuilding ,UDWORD index, UBYTE player, BOOL bStart);
extern void displayAIMessage (char *pStr, SDWORD from, SDWORD to); //make AI process a message