@@ -109,6 +109,16 @@
|
|||||||
<div class="methodtext">Get the inflation factor for payments.</div>
|
<div class="methodtext">Get the inflation factor for payments.</div>
|
||||||
<div class="methodtext">Returns the inflation factor as a fixed point value (16 bits).</div>
|
<div class="methodtext">Returns the inflation factor as a fixed point value (16 bits).</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="indent">
|
||||||
|
<div class="code">static bool SetPriceFactor (int64 factor)</div>
|
||||||
|
<div class="methodtext">Set the inflation factor for prices (GS only).</div>
|
||||||
|
<div class="methodtext">The inflation factor is a fixed point value (16 bits).</div>
|
||||||
|
</div>
|
||||||
|
<div class="indent">
|
||||||
|
<div class="code">static bool SetPaymentFactor (int64 factor)</div>
|
||||||
|
<div class="methodtext">Set the inflation factor for payments (GS only).</div>
|
||||||
|
<div class="methodtext">The inflation factor is a fixed point value (16 bits).</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -9,7 +9,10 @@
|
|||||||
|
|
||||||
#include "../../stdafx.h"
|
#include "../../stdafx.h"
|
||||||
#include "script_inflation.hpp"
|
#include "script_inflation.hpp"
|
||||||
|
#include "script_error.hpp"
|
||||||
#include "../../economy_func.h"
|
#include "../../economy_func.h"
|
||||||
|
#include "../../cheat_type.h"
|
||||||
|
#include "../../command_type.h"
|
||||||
|
|
||||||
#include "../../safeguards.h"
|
#include "../../safeguards.h"
|
||||||
|
|
||||||
@@ -22,3 +25,17 @@
|
|||||||
{
|
{
|
||||||
return _economy.inflation_payment;
|
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);
|
||||||
|
}
|
||||||
|
@@ -30,6 +30,22 @@ public:
|
|||||||
* @return Inflation factor, 16 bit fixed point.
|
* @return Inflation factor, 16 bit fixed point.
|
||||||
*/
|
*/
|
||||||
static int64 GetPaymentFactor();
|
static int64 GetPaymentFactor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the inflation factor for prices.
|
||||||
|
* @param factor Inflation factor, 16 bit fixed point.
|
||||||
|
* @return True, if the inflation factor was changed.
|
||||||
|
* @api -ai
|
||||||
|
*/
|
||||||
|
static bool SetPriceFactor(int64 factor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the inflation factor for payments.
|
||||||
|
* @param factor Inflation factor, 16 bit fixed point.
|
||||||
|
* @return True, if the inflation factor was changed.
|
||||||
|
* @api -ai
|
||||||
|
*/
|
||||||
|
static bool SetPaymentFactor(int64 factor);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SCRIPT_INFLATION_HPP */
|
#endif /* SCRIPT_INFLATION_HPP */
|
||||||
|
Reference in New Issue
Block a user