Merge tag '1.11.0-beta1' into jgrpp
# Conflicts: # src/console_cmds.cpp # src/gfx_func.h # src/industry.h # src/lang/czech.txt # src/lang/estonian.txt # src/lang/german.txt # src/lang/indonesian.txt # src/lang/japanese.txt # src/lang/norwegian_bokmal.txt # src/lang/russian.txt # src/lang/slovak.txt # src/saveload/saveload.h # src/station_gui.cpp # src/town_gui.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/waypoint_gui.cpp
This commit is contained in:
@@ -30,11 +30,15 @@
|
||||
* \li GSIndustry::SetControlFlags
|
||||
* \li GSIndustry::SetExclusiveConsumer
|
||||
* \li GSIndustry::SetExclusiveSupplier
|
||||
* \li GSIndustry::SetText
|
||||
* \li GSStoryPage::MakePushButtonReference
|
||||
* \li GSStoryPage::MakeTileButtonReference
|
||||
* \li GSStoryPage::MakeVehicleButtonReference
|
||||
* \li GSPriorityQueue
|
||||
*
|
||||
* Other changes:
|
||||
* \li GSCompany::ChangeBankBalance takes one extra parameter to refer to a location to show text effect on
|
||||
*
|
||||
* \b 1.10.0
|
||||
*
|
||||
* API additions:
|
||||
|
@@ -226,17 +226,19 @@
|
||||
return GetLoanAmount() == loan;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type)
|
||||
/* static */ bool ScriptCompany::ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type, TileIndex tile)
|
||||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, expenses_type < (ExpensesType)::EXPENSES_END);
|
||||
EnforcePrecondition(false, (int64)delta >= INT32_MIN);
|
||||
EnforcePrecondition(false, (int64)delta <= INT32_MAX);
|
||||
EnforcePrecondition(false, tile == INVALID_TILE || ::IsValidTile(tile));
|
||||
|
||||
company = ResolveCompanyID(company);
|
||||
EnforcePrecondition(false, company != COMPANY_INVALID);
|
||||
|
||||
return ScriptObject::DoCommand(0, (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);
|
||||
/* Network commands only allow 0 to indicate invalid tiles, not INVALID_TILE */
|
||||
return ScriptObject::DoCommand(tile == INVALID_TILE ? 0 : tile , (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::BuildCompanyHQ(TileIndex tile)
|
||||
|
@@ -242,6 +242,7 @@ public:
|
||||
* @param company The company to change the bank balance of.
|
||||
* @param delta Amount of money to give or take from the bank balance. A positive value adds money to the bank balance.
|
||||
* @param expenses_type The account in the finances window that will register the cost.
|
||||
* @param tile The tile to show text effect on or ScriptMap::TILE_INVALID
|
||||
* @return True, if the bank balance was changed.
|
||||
* @game @pre No ScriptCompanyMode active in scope.
|
||||
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
@@ -250,7 +251,7 @@ public:
|
||||
* @note You need to create your own news message to inform about costs/gifts that you create using this command.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type);
|
||||
static bool ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type, TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get the income of the company in the given quarter.
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "script_map.hpp"
|
||||
#include "../../company_base.h"
|
||||
#include "../../industry.h"
|
||||
#include "../../string_func.h"
|
||||
#include "../../strings_func.h"
|
||||
#include "../../station_base.h"
|
||||
#include "../../newgrf_industries.h"
|
||||
@@ -47,6 +48,20 @@
|
||||
return GetString(STR_INDUSTRY_NAME);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptIndustry::SetText(IndustryID industry_id, Text *text)
|
||||
{
|
||||
CCountedPtr<Text> counter(text);
|
||||
|
||||
const char *encoded_text = nullptr;
|
||||
if (text != nullptr) {
|
||||
encoded_text = text->GetEncodedText();
|
||||
EnforcePreconditionEncodedText(false, encoded_text);
|
||||
}
|
||||
EnforcePrecondition(false, IsValidIndustry(industry_id));
|
||||
|
||||
return ScriptObject::DoCommand(0, industry_id, static_cast<uint32>(IndustryAction::SetText), CMD_INDUSTRY_CTRL, encoded_text);
|
||||
}
|
||||
|
||||
/* static */ ScriptIndustry::CargoAcceptState ScriptIndustry::IsCargoAccepted(IndustryID industry_id, CargoID cargo_id)
|
||||
{
|
||||
if (!IsValidIndustry(industry_id)) return CAS_NOT_ACCEPTED;
|
||||
|
@@ -81,6 +81,16 @@ public:
|
||||
*/
|
||||
static char *GetName(IndustryID industry_id);
|
||||
|
||||
/**
|
||||
* Set the custom text of an industry, shown in the GUI.
|
||||
* @param industry_id The industry to set the custom text of.
|
||||
* @param text The text to set it to (can be either a raw string, or a ScriptText object). If null is passed, the text will be removed.
|
||||
* @pre IsValidIndustry(industry_id).
|
||||
* @return True if the action succeeded.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool SetText(IndustryID industry_id, Text *text);
|
||||
|
||||
/**
|
||||
* See whether an industry currently accepts a certain cargo.
|
||||
* @param industry_id The index of the industry.
|
||||
|
Reference in New Issue
Block a user