Add AI/GS methods to get inflation factors

See: #415
pull/428/head
Jonathan G Rennison 2 years ago
parent 4049cb1407
commit 81291c4ffc

@ -95,5 +95,20 @@
<div class="methodtext">Checks whether the given road type is buildable by towns.</div>
</div>
</div>
<h3>Inflation: GSInflation Class and AIInflation Class</h3>
<div class="indent">
<h4>Static Public Member Functions:</h4>
<div class="indent">
<div class="code">static int64 GetPriceFactor ()</div>
<div class="methodtext">Get the inflation factor for prices.</div>
<div class="methodtext">Returns the inflation factor as a fixed point value (16 bits).</div>
</div>
<div class="indent">
<div class="code">static int64 GetPaymentFactor ()</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>
</div>
</body>
</html>

@ -175,6 +175,7 @@ add_files(
script_industrylist.hpp
script_industrytype.hpp
script_industrytypelist.hpp
script_inflation.hpp
script_info_docs.hpp
script_infrastructure.hpp
script_list.hpp
@ -246,6 +247,7 @@ add_files(
script_industrylist.cpp
script_industrytype.cpp
script_industrytypelist.cpp
script_inflation.cpp
script_infrastructure.cpp
script_list.cpp
script_log.cpp

@ -0,0 +1,24 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file script_inflation.cpp Implementation of ScriptInflation. */
#include "../../stdafx.h"
#include "script_inflation.hpp"
#include "../../economy_func.h"
#include "../../safeguards.h"
/* static */ int64 ScriptInflation::GetPriceFactor()
{
return _economy.inflation_prices;
}
/* static */ int64 ScriptInflation::GetPaymentFactor()
{
return _economy.inflation_payment;
}

@ -0,0 +1,35 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file script_inflation.hpp Inflation related code. */
#ifndef SCRIPT_INFLATION_HPP
#define SCRIPT_INFLATION_HPP
#include "script_object.hpp"
/**
* Class that handles inflation related functions.
* @api ai game
*
*/
class ScriptInflation : public ScriptObject {
public:
/**
* Get the inflation factor for prices.
* @return Inflation factor, 16 bit fixed point.
*/
static int64 GetPriceFactor();
/**
* Get the inflation factor for payments.
* @return Inflation factor, 16 bit fixed point.
*/
static int64 GetPaymentFactor();
};
#endif /* SCRIPT_INFLATION_HPP */
Loading…
Cancel
Save