summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-11-23 01:05:58 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commit13528bfcd0f11d738ec23409e26052e70dd233f6 (patch)
tree7f549fb59e365e6bc9b4a9f05b692ddbd94be38e /src/script/api
parent58cff7b081ce9ea4b5314cf8324ca60607389d15 (diff)
downloadopenttd-13528bfcd0f11d738ec23409e26052e70dd233f6.tar.xz
Codechange: Un-bitstuff all remaining commands.
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/script_company.cpp22
-rw-r--r--src/script/api/script_controller.cpp2
-rw-r--r--src/script/api/script_event_types.cpp2
-rw-r--r--src/script/api/script_game.cpp4
-rw-r--r--src/script/api/script_gamesettings.cpp2
-rw-r--r--src/script/api/script_group.cpp2
-rw-r--r--src/script/api/script_news.cpp2
-rw-r--r--src/script/api/script_subsidy.cpp2
8 files changed, 19 insertions, 19 deletions
diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp
index 1cc69bc93..6a06852da 100644
--- a/src/script/api/script_company.cpp
+++ b/src/script/api/script_company.cpp
@@ -52,7 +52,7 @@
EnforcePreconditionEncodedText(false, text);
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_COMPANY_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
- return ScriptObject::Command<CMD_RENAME_COMPANY>::Do(0, 0, 0, text);
+ return ScriptObject::Command<CMD_RENAME_COMPANY>::Do(text);
}
/* static */ char *ScriptCompany::GetName(ScriptCompany::CompanyID company)
@@ -73,7 +73,7 @@
EnforcePreconditionEncodedText(false, text);
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_PRESIDENT_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
- return ScriptObject::Command<CMD_RENAME_PRESIDENT>::Do(0, 0, 0, text);
+ return ScriptObject::Command<CMD_RENAME_PRESIDENT>::Do(text);
}
/* static */ char *ScriptCompany::GetPresidentName(ScriptCompany::CompanyID company)
@@ -101,7 +101,7 @@
GenderEthnicity ge = (GenderEthnicity)((gender == GENDER_FEMALE ? (1 << ::GENDER_FEMALE) : 0) | (::InteractiveRandom() & (1 << ETHNICITY_BLACK)));
RandomCompanyManagerFaceBits(cmf, ge, false);
- return ScriptObject::Command<CMD_SET_COMPANY_MANAGER_FACE>::Do(0, 0, cmf, {});
+ return ScriptObject::Command<CMD_SET_COMPANY_MANAGER_FACE>::Do(cmf);
}
/* static */ ScriptCompany::Gender ScriptCompany::GetPresidentGender(CompanyID company)
@@ -211,9 +211,9 @@
Money amount = abs(loan - GetLoanAmount());
if (loan > GetLoanAmount()) {
- return ScriptObject::Command<CMD_INCREASE_LOAN>::Do(0, amount >> 32, (amount & 0xFFFFFFFC) | 2, {});
+ return ScriptObject::Command<CMD_INCREASE_LOAN>::Do(LoanCommand::Amount, amount);
} else {
- return ScriptObject::Command<CMD_DECREASE_LOAN>::Do(0, amount >> 32, (amount & 0xFFFFFFFC) | 2, {});
+ return ScriptObject::Command<CMD_DECREASE_LOAN>::Do(LoanCommand::Amount, amount);
}
}
@@ -244,7 +244,7 @@
EnforcePrecondition(false, company != COMPANY_INVALID);
/* Network commands only allow 0 to indicate invalid tiles, not INVALID_TILE */
- return ScriptObject::Command<CMD_CHANGE_BANK_BALANCE>::Do(tile == INVALID_TILE ? (TileIndex)0U : tile, (uint32)(delta), company | expenses_type << 8, {});
+ return ScriptObject::Command<CMD_CHANGE_BANK_BALANCE>::Do(tile == INVALID_TILE ? (TileIndex)0U : tile, delta, (::CompanyID)company, (::ExpensesType)expenses_type);
}
/* static */ bool ScriptCompany::BuildCompanyHQ(TileIndex tile)
@@ -266,7 +266,7 @@
/* static */ bool ScriptCompany::SetAutoRenewStatus(bool autorenew)
{
- return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, autorenew ? 1 : 0, "company.engine_renew");
+ return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.engine_renew", autorenew ? 1 : 0);
}
/* static */ bool ScriptCompany::GetAutoRenewStatus(CompanyID company)
@@ -279,7 +279,7 @@
/* static */ bool ScriptCompany::SetAutoRenewMonths(int16 months)
{
- return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, months, "company.engine_renew_months");
+ return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.engine_renew_months", months);
}
/* static */ int16 ScriptCompany::GetAutoRenewMonths(CompanyID company)
@@ -294,7 +294,7 @@
{
EnforcePrecondition(false, money >= 0);
EnforcePrecondition(false, (int64)money <= UINT32_MAX);
- return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, money, "company.engine_renew_money");
+ return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.engine_renew_money", money);
}
/* static */ Money ScriptCompany::GetAutoRenewMoney(CompanyID company)
@@ -307,12 +307,12 @@
/* static */ bool ScriptCompany::SetPrimaryLiveryColour(LiveryScheme scheme, Colours colour)
{
- return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do(0, scheme, colour, {});
+ return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do((::LiveryScheme)scheme, true, (::Colours)colour);
}
/* static */ bool ScriptCompany::SetSecondaryLiveryColour(LiveryScheme scheme, Colours colour)
{
- return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do(0, scheme | 1 << 8, colour, {});
+ return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do((::LiveryScheme)scheme, false, (::Colours)colour);
}
/* static */ ScriptCompany::Colours ScriptCompany::GetPrimaryLiveryColour(ScriptCompany::LiveryScheme scheme)
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index 74a3ad3ea..232ce5a3b 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -60,7 +60,7 @@
ShowAIDebugWindow(ScriptObject::GetRootCompany());
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
- ScriptObject::Command<CMD_PAUSE>::Do(0, PM_PAUSED_NORMAL, 1, {});
+ ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_NORMAL, true);
}
}
diff --git a/src/script/api/script_event_types.cpp b/src/script/api/script_event_types.cpp
index e876febc2..e9349a035 100644
--- a/src/script/api/script_event_types.cpp
+++ b/src/script/api/script_event_types.cpp
@@ -117,7 +117,7 @@ bool ScriptEventEnginePreview::AcceptPreview()
bool ScriptEventCompanyAskMerger::AcceptMerger()
{
- return ScriptObject::Command<CMD_BUY_COMPANY>::Do(0, this->owner, 0, {});
+ return ScriptObject::Command<CMD_BUY_COMPANY>::Do((::CompanyID)this->owner);
}
ScriptEventAdminPort::ScriptEventAdminPort(const std::string &json) :
diff --git a/src/script/api/script_game.cpp b/src/script/api/script_game.cpp
index 9b40a1cd3..3df6aef15 100644
--- a/src/script/api/script_game.cpp
+++ b/src/script/api/script_game.cpp
@@ -18,12 +18,12 @@
/* static */ bool ScriptGame::Pause()
{
- return ScriptObject::Command<CMD_PAUSE>::Do(0, PM_PAUSED_GAME_SCRIPT, 1, {});
+ return ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_GAME_SCRIPT, true);
}
/* static */ bool ScriptGame::Unpause()
{
- return ScriptObject::Command<CMD_PAUSE>::Do(0, PM_PAUSED_GAME_SCRIPT, 0, {});
+ return ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_GAME_SCRIPT, false);
}
/* static */ bool ScriptGame::IsPaused()
diff --git a/src/script/api/script_gamesettings.cpp b/src/script/api/script_gamesettings.cpp
index 611b78b8b..2791aba00 100644
--- a/src/script/api/script_gamesettings.cpp
+++ b/src/script/api/script_gamesettings.cpp
@@ -38,7 +38,7 @@
if ((sd->flags & SF_NO_NETWORK_SYNC) != 0) return false;
- return ScriptObject::Command<CMD_CHANGE_SETTING>::Do(0, 0, value, sd->GetName());
+ return ScriptObject::Command<CMD_CHANGE_SETTING>::Do(sd->GetName(), value);
}
/* static */ bool ScriptGameSettings::IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type)
diff --git a/src/script/api/script_group.cpp b/src/script/api/script_group.cpp
index 5047dc5c0..dbf4c0280 100644
--- a/src/script/api/script_group.cpp
+++ b/src/script/api/script_group.cpp
@@ -130,7 +130,7 @@
{
if (HasWagonRemoval() == enable_removal) return true;
- return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, enable_removal ? 1 : 0, "company.renew_keep_length");
+ return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.renew_keep_length", enable_removal ? 1 : 0);
}
/* static */ bool ScriptGroup::HasWagonRemoval()
diff --git a/src/script/api/script_news.cpp b/src/script/api/script_news.cpp
index 7f46f5aa6..119cbc735 100644
--- a/src/script/api/script_news.cpp
+++ b/src/script/api/script_news.cpp
@@ -39,5 +39,5 @@
if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY;
if (ref_type == NR_NONE) reference = 0;
- return ScriptObject::Command<CMD_CUSTOM_NEWS_ITEM>::Do(0, type | (ref_type << 8) | (c << 16), reference, encoded);
+ return ScriptObject::Command<CMD_CUSTOM_NEWS_ITEM>::Do((::NewsType)type, (::NewsReferenceType)ref_type, (::CompanyID)c, reference, encoded);
}
diff --git a/src/script/api/script_subsidy.cpp b/src/script/api/script_subsidy.cpp
index 32962d158..5e1180d1b 100644
--- a/src/script/api/script_subsidy.cpp
+++ b/src/script/api/script_subsidy.cpp
@@ -39,7 +39,7 @@
EnforcePrecondition(false, (from_type == SPT_INDUSTRY && ScriptIndustry::IsValidIndustry(from_id)) || (from_type == SPT_TOWN && ScriptTown::IsValidTown(from_id)));
EnforcePrecondition(false, (to_type == SPT_INDUSTRY && ScriptIndustry::IsValidIndustry(to_id)) || (to_type == SPT_TOWN && ScriptTown::IsValidTown(to_id)));
- return ScriptObject::Command<CMD_CREATE_SUBSIDY>::Do(0, from_type | (from_id << 8) | (cargo_type << 24), to_type | (to_id << 8), {});
+ return ScriptObject::Command<CMD_CREATE_SUBSIDY>::Do(cargo_type, (::SourceType)from_type, from_id, (::SourceType)to_type, to_id);
}
/* static */ ScriptCompany::CompanyID ScriptSubsidy::GetAwardedTo(SubsidyID subsidy_id)