mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
added new options to limit merc salary increases on level up:
MERC_LEVEL_UP_MAXIMUM_SALARY_INCREASE_DAILY MERC_LEVEL_UP_MAXIMUM_SALARY_INCREASE_WEEKLY MERC_LEVEL_UP_MAXIMUM_SALARY_INCREASE_BIWEEKLY git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9387 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1117,6 +1117,9 @@ void LoadGameExternalOptions()
|
||||
|
||||
//tais: percentage that the merc's salary rises when he/she levels up
|
||||
gGameExternalOptions.gMercLevelUpSalaryIncreasePercentage = (FLOAT)iniReader.ReadInteger("Financial Settings","MERC_LEVEL_UP_SALARY_INCREASE_PERCENTAGE",25, 0, 1000);
|
||||
gGameExternalOptions.uMaxMercSalaryIncreaseDaily = (UINT32)iniReader.ReadUINT32("Financial Settings","MERC_LEVEL_UP_MAXIMUM_SALARY_INCREASE_DAILY", 100000, 0, 100000);
|
||||
gGameExternalOptions.uMaxMercSalaryIncreaseWeekly = (UINT32)iniReader.ReadUINT32("Financial Settings","MERC_LEVEL_UP_MAXIMUM_SALARY_INCREASE_WEEKLY", 100000, 0, 100000);
|
||||
gGameExternalOptions.uMaxMercSalaryIncreaseBiweekly = (UINT32)iniReader.ReadUINT32("Financial Settings","MERC_LEVEL_UP_MAXIMUM_SALARY_INCREASE_BIWEEKLY", 100000, 0, 100000);
|
||||
|
||||
// Flugente: mine income can depend on the number or workers we have
|
||||
gGameExternalOptions.fMineRequiresWorkers = iniReader.ReadBoolean( "Financial Settings", "MINE_REQUIRES_WORKERS", FALSE );
|
||||
|
||||
@@ -1409,6 +1409,9 @@ typedef struct
|
||||
BOOLEAN ubShowSuppressionScaleAsterisk;
|
||||
|
||||
FLOAT gMercLevelUpSalaryIncreasePercentage;
|
||||
UINT32 uMaxMercSalaryIncreaseDaily;
|
||||
UINT32 uMaxMercSalaryIncreaseWeekly;
|
||||
UINT32 uMaxMercSalaryIncreaseBiweekly;
|
||||
|
||||
// Flugente: mine income can depend on the number or workers we have
|
||||
BOOLEAN fMineRequiresWorkers;
|
||||
|
||||
+10
-8
@@ -836,11 +836,11 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta
|
||||
// increase all salaries and medical deposits, once for each level gained
|
||||
for (uiLevelCnt = 0; uiLevelCnt < (UINT32) sPtsChanged; ++uiLevelCnt)
|
||||
{
|
||||
pProfile->sSalary = (INT16) CalcNewSalary(pProfile->sSalary, fChangeTypeIncrease, MAX_DAILY_SALARY);
|
||||
pProfile->uiWeeklySalary = CalcNewSalary(pProfile->uiWeeklySalary, fChangeTypeIncrease, MAX_LARGE_SALARY);
|
||||
pProfile->uiBiWeeklySalary = CalcNewSalary(pProfile->uiBiWeeklySalary, fChangeTypeIncrease, MAX_LARGE_SALARY);
|
||||
pProfile->sTrueSalary = (INT16) CalcNewSalary(pProfile->sTrueSalary, fChangeTypeIncrease, MAX_DAILY_SALARY);
|
||||
pProfile->sMedicalDepositAmount = (INT16) CalcNewSalary(pProfile->sMedicalDepositAmount, fChangeTypeIncrease, MAX_DAILY_SALARY);
|
||||
pProfile->sSalary = (INT16) CalcNewSalary(pProfile->sSalary, fChangeTypeIncrease, MAX_DAILY_SALARY, gGameExternalOptions.uMaxMercSalaryIncreaseDaily);
|
||||
pProfile->uiWeeklySalary = CalcNewSalary(pProfile->uiWeeklySalary, fChangeTypeIncrease, MAX_LARGE_SALARY, gGameExternalOptions.uMaxMercSalaryIncreaseWeekly);
|
||||
pProfile->uiBiWeeklySalary = CalcNewSalary(pProfile->uiBiWeeklySalary, fChangeTypeIncrease, MAX_LARGE_SALARY, gGameExternalOptions.uMaxMercSalaryIncreaseBiweekly);
|
||||
pProfile->sTrueSalary = (INT16) CalcNewSalary(pProfile->sTrueSalary, fChangeTypeIncrease, MAX_DAILY_SALARY, gGameExternalOptions.uMaxMercSalaryIncreaseDaily);
|
||||
pProfile->sMedicalDepositAmount = (INT16) CalcNewSalary(pProfile->sMedicalDepositAmount, fChangeTypeIncrease, MAX_DAILY_SALARY, gGameExternalOptions.uMaxMercSalaryIncreaseDaily);
|
||||
|
||||
//if (pSoldier != NULL)
|
||||
// DON'T increase the *effective* medical deposit, it's already been paid out
|
||||
@@ -1094,10 +1094,10 @@ void HandleAnyStatChangesAfterAttack( void )
|
||||
}
|
||||
|
||||
|
||||
UINT32 CalcNewSalary(UINT32 uiOldSalary, BOOLEAN fIncrease, UINT32 uiMaxLimit)
|
||||
UINT32 CalcNewSalary(UINT32 uiOldSalary, BOOLEAN fIncrease, UINT32 uiMaxLimit, UINT32 uiIncreaseCap)
|
||||
{
|
||||
UINT32 uiNewSalary;
|
||||
FLOAT SalaryMultiplier = (FLOAT) ((gGameExternalOptions.gMercLevelUpSalaryIncreasePercentage / 100) + 1);
|
||||
UINT32 uiNewSalary = 0;
|
||||
const FLOAT SalaryMultiplier = (FLOAT) ((gGameExternalOptions.gMercLevelUpSalaryIncreasePercentage / 100) + 1);
|
||||
|
||||
// if he was working for free, it's still free!
|
||||
if (uiOldSalary == 0)
|
||||
@@ -1117,6 +1117,8 @@ UINT32 CalcNewSalary(UINT32 uiOldSalary, BOOLEAN fIncrease, UINT32 uiMaxLimit)
|
||||
// round it off to a reasonable multiple
|
||||
uiNewSalary = RoundOffSalary(uiNewSalary);
|
||||
|
||||
uiNewSalary = min(uiNewSalary, uiOldSalary + uiIncreaseCap);
|
||||
|
||||
// let's set some reasonable limits here, lest it get silly one day
|
||||
if (uiNewSalary > uiMaxLimit)
|
||||
uiNewSalary = uiMaxLimit;
|
||||
|
||||
Reference in New Issue
Block a user