Codechange: Template script command calls.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "../../strings_func.h"
|
||||
#include "../../station_base.h"
|
||||
#include "../../landscape.h"
|
||||
#include "../../town_cmd.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
@@ -51,7 +52,7 @@
|
||||
}
|
||||
EnforcePrecondition(false, IsValidTown(town_id));
|
||||
|
||||
return ScriptObject::DoCommand(0, town_id, 0, CMD_RENAME_TOWN, text);
|
||||
return ScriptObject::Command<CMD_RENAME_TOWN>::Do(0, town_id, 0, text != nullptr ? std::string{ text } : std::string{});
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTown::SetText(TownID town_id, Text *text)
|
||||
@@ -65,7 +66,7 @@
|
||||
}
|
||||
EnforcePrecondition(false, IsValidTown(town_id));
|
||||
|
||||
return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, 0, CMD_TOWN_SET_TEXT, encoded_text);
|
||||
return ScriptObject::Command<CMD_TOWN_SET_TEXT>::Do(::Town::Get(town_id)->xy, town_id, 0, encoded_text != nullptr ? std::string{ encoded_text } : std::string{});
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptTown::GetPopulation(TownID town_id)
|
||||
@@ -133,7 +134,7 @@
|
||||
EnforcePrecondition(false, IsValidTown(town_id));
|
||||
EnforcePrecondition(false, ScriptCargo::IsValidTownEffect(towneffect_id));
|
||||
|
||||
return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id | (towneffect_id << 16), goal, CMD_TOWN_CARGO_GOAL);
|
||||
return ScriptObject::Command<CMD_TOWN_CARGO_GOAL>::Do(::Town::Get(town_id)->xy, town_id | (towneffect_id << 16), goal, {});
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptTown::GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id)
|
||||
@@ -176,7 +177,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, growth_rate, CMD_TOWN_GROWTH_RATE);
|
||||
return ScriptObject::Command<CMD_TOWN_GROWTH_RATE>::Do(::Town::Get(town_id)->xy, town_id, growth_rate, {});
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptTown::GetGrowthRate(TownID town_id)
|
||||
@@ -266,7 +267,7 @@
|
||||
EnforcePrecondition(false, IsValidTown(town_id));
|
||||
EnforcePrecondition(false, IsActionAvailable(town_id, town_action));
|
||||
|
||||
return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, town_action, CMD_DO_TOWN_ACTION);
|
||||
return ScriptObject::Command<CMD_DO_TOWN_ACTION>::Do(::Town::Get(town_id)->xy, town_id, town_action, {});
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTown::ExpandTown(TownID town_id, int houses)
|
||||
@@ -275,7 +276,7 @@
|
||||
EnforcePrecondition(false, IsValidTown(town_id));
|
||||
EnforcePrecondition(false, houses > 0);
|
||||
|
||||
return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, houses, CMD_EXPAND_TOWN);
|
||||
return ScriptObject::Command<CMD_EXPAND_TOWN>::Do(::Town::Get(town_id)->xy, town_id, houses, {});
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTown::FoundTown(TileIndex tile, TownSize size, bool city, RoadLayout layout, Text *name)
|
||||
@@ -305,7 +306,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
return ScriptObject::DoCommand(tile, size | (city ? 1 << 2 : 0) | layout << 3, townnameparts, CMD_FOUND_TOWN, text);
|
||||
return ScriptObject::Command<CMD_FOUND_TOWN>::Do(tile, size | (city ? 1 << 2 : 0) | layout << 3, townnameparts, text != nullptr ? std::string{ text } : std::string{});
|
||||
}
|
||||
|
||||
/* static */ ScriptTown::TownRating ScriptTown::GetRating(TownID town_id, ScriptCompany::CompanyID company_id)
|
||||
@@ -360,7 +361,7 @@
|
||||
uint16 p2 = 0;
|
||||
memcpy(&p2, &new_rating, sizeof(p2));
|
||||
|
||||
return ScriptObject::DoCommand(0, town_id | (company_id << 16), p2, CMD_TOWN_RATING);
|
||||
return ScriptObject::Command<CMD_TOWN_RATING>::Do(0, town_id | (company_id << 16), p2, {});
|
||||
}
|
||||
|
||||
/* static */ int ScriptTown::GetAllowedNoise(TownID town_id)
|
||||
|
Reference in New Issue
Block a user