Add GS methods to set inflation factors

See: #415
This commit is contained in:
Jonathan G Rennison
2022-09-05 18:49:22 +01:00
parent 81291c4ffc
commit 4b9d5a437f
3 changed files with 43 additions and 0 deletions

View File

@@ -9,7 +9,10 @@
#include "../../stdafx.h"
#include "script_inflation.hpp"
#include "script_error.hpp"
#include "../../economy_func.h"
#include "../../cheat_type.h"
#include "../../command_type.h"
#include "../../safeguards.h"
@@ -22,3 +25,17 @@
{
return _economy.inflation_payment;
}
/* static */ bool ScriptInflation::SetPriceFactor(int64 factor)
{
EnforcePrecondition(false, factor >= 1 << 16 && factor <= (int64)MAX_INFLATION);
if ((uint64)factor == _economy.inflation_prices) return true;
return ScriptObject::DoCommand(0, CHT_INFLATION_COST, (uint32)factor, CMD_CHEAT_SETTING);
}
/* static */ bool ScriptInflation::SetPaymentFactor(int64 factor)
{
EnforcePrecondition(false, factor >= 1 << 16 && factor <= (int64)MAX_INFLATION);
if ((uint64)factor == _economy.inflation_payment) return true;
return ScriptObject::DoCommand(0, CHT_INFLATION_INCOME, (uint32)factor, CMD_CHEAT_SETTING);
}