Update to 1.10.2
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "OpenTTD NoAI API"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NAME = "OpenTTD AI API"
|
||||
PROJECT_NUMBER = $(VERSION)
|
||||
OUTPUT_DIRECTORY = ../../../docs/aidocs/
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "OpenTTD Game API"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NAME = "OpenTTD GameScript API"
|
||||
PROJECT_NUMBER = $(VERSION)
|
||||
OUTPUT_DIRECTORY = ../../../docs/gamedocs/
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*
|
||||
* \b 1.10.0
|
||||
*
|
||||
* This version is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li AIGroup::SetPrimaryColour
|
||||
* \li AIGroup::SetSecondaryColour
|
||||
|
||||
@@ -46,6 +46,8 @@ void SQGSEngine_Register(Squirrel *engine)
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsArticulated, "IsArticulated", 2, ".i");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPlaneType, "GetPlaneType", 2, ".i");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaximumOrderDistance, "GetMaximumOrderDistance", 2, ".i");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::EnableForCompany, "EnableForCompany", 3, ".ii");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::DisableForCompany, "DisableForCompany", 3, ".ii");
|
||||
|
||||
SQGSEngine.PostRegister(engine);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ void SQGSTown_Register(Squirrel *engine)
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::ExpandTown, "ExpandTown", 3, ".ii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::FoundTown, "FoundTown", 6, ".iibi.");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRating, "GetRating", 3, ".ii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetDetailedRating, "GetDetailedRating", 3, ".ii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::ChangeRating, "ChangeRating", 4, ".iii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetAllowedNoise, "GetAllowedNoise", 2, ".i");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRoadLayout, "GetRoadLayout", 2, ".i");
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SAVE_PRESET, "WC_SAVE_PRESET");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FRAMERATE_DISPLAY, "WC_FRAMERATE_DISPLAY");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FRAMETIME_GRAPH, "WC_FRAMETIME_GRAPH");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SCREENSHOT, "WC_SCREENSHOT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INVALID, "WC_INVALID");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::TC_BLUE, "TC_BLUE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::TC_SILVER, "TC_SILVER");
|
||||
@@ -588,6 +589,8 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IV_DISPLAY, "WID_IV_DISPLAY");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_DROPDOWN_ORDER, "WID_ID_DROPDOWN_ORDER");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_DROPDOWN_CRITERIA, "WID_ID_DROPDOWN_CRITERIA");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_FILTER_BY_ACC_CARGO, "WID_ID_FILTER_BY_ACC_CARGO");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_FILTER_BY_PROD_CARGO, "WID_ID_FILTER_BY_PROD_CARGO");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_INDUSTRY_LIST, "WID_ID_INDUSTRY_LIST");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_SCROLLBAR, "WID_ID_SCROLLBAR");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_CAPTION, "WID_IC_CAPTION");
|
||||
@@ -636,6 +639,7 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BACKGROUND, "WID_TT_BACKGROUND");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_SCROLLING_TEXT, "WID_A_SCROLLING_TEXT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_WEBSITE, "WID_A_WEBSITE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_COPYRIGHT, "WID_A_COPYRIGHT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_CAPTION, "WID_QS_CAPTION");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_TEXT, "WID_QS_TEXT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_WARNING, "WID_QS_WARNING");
|
||||
@@ -1028,6 +1032,12 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_LT_OFF, "WID_BROS_LT_OFF");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_LT_ON, "WID_BROS_LT_ON");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_INFO, "WID_BROS_INFO");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE, "WID_SC_TAKE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_ZOOMIN, "WID_SC_TAKE_ZOOMIN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_DEFAULTZOOM, "WID_SC_TAKE_DEFAULTZOOM");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_WORLD, "WID_SC_TAKE_WORLD");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_HEIGHTMAP, "WID_SC_TAKE_HEIGHTMAP");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_MINIMAP, "WID_SC_TAKE_MINIMAP");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BACKGROUND, "WID_GO_BACKGROUND");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_CURRENCY_DROPDOWN, "WID_GO_CURRENCY_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_DISTANCE_DROPDOWN, "WID_GO_DISTANCE_DROPDOWN");
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*
|
||||
* \b 1.10.0
|
||||
*
|
||||
* This version is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li GSVehicle::BuildVehicleWithRefit
|
||||
* \li GSVehicle::GetBuildWithRefitCapacity
|
||||
@@ -25,6 +23,8 @@
|
||||
* \li GSRoad::RoadVehHasPowerOnRoad
|
||||
* \li GSRoad::ConvertRoadType
|
||||
* \li GSRoad::GetMaxSpeed
|
||||
* \li GSEngine::EnableForCompany
|
||||
* \li GSEngine::DisableForCompany
|
||||
*
|
||||
* \b 1.9.0
|
||||
*
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
/* static */ ScriptCompany::CompanyID ScriptCompany::ResolveCompanyID(ScriptCompany::CompanyID company)
|
||||
{
|
||||
if (company == COMPANY_SELF) {
|
||||
if (!::Company::IsValidID((::CompanyID)_current_company)) return COMPANY_INVALID;
|
||||
if (!::Company::IsValidID(_current_company)) return COMPANY_INVALID;
|
||||
return (CompanyID)((byte)_current_company);
|
||||
}
|
||||
|
||||
return ::Company::IsValidID((::CompanyID)company) ? company : COMPANY_INVALID;
|
||||
return ::Company::IsValidID(company) ? company : COMPANY_INVALID;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::IsMine(ScriptCompany::CompanyID company)
|
||||
@@ -116,9 +116,9 @@
|
||||
if (quarter > EARLIEST_QUARTER) return -1;
|
||||
|
||||
if (quarter == CURRENT_QUARTER) {
|
||||
return ::Company::Get((::CompanyID)company)->cur_economy.income;
|
||||
return ::Company::Get(company)->cur_economy.income;
|
||||
}
|
||||
return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].income;
|
||||
return ::Company::Get(company)->old_economy[quarter - 1].income;
|
||||
}
|
||||
|
||||
/* static */ Money ScriptCompany::GetQuarterlyExpenses(ScriptCompany::CompanyID company, uint32 quarter)
|
||||
@@ -128,9 +128,9 @@
|
||||
if (quarter > EARLIEST_QUARTER) return -1;
|
||||
|
||||
if (quarter == CURRENT_QUARTER) {
|
||||
return ::Company::Get((::CompanyID)company)->cur_economy.expenses;
|
||||
return ::Company::Get(company)->cur_economy.expenses;
|
||||
}
|
||||
return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].expenses;
|
||||
return ::Company::Get(company)->old_economy[quarter - 1].expenses;
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptCompany::GetQuarterlyCargoDelivered(ScriptCompany::CompanyID company, uint32 quarter)
|
||||
@@ -140,9 +140,9 @@
|
||||
if (quarter > EARLIEST_QUARTER) return -1;
|
||||
|
||||
if (quarter == CURRENT_QUARTER) {
|
||||
return ::Company::Get((::CompanyID)company)->cur_economy.delivered_cargo.GetSum<OverflowSafeInt<int32, INT32_MAX, INT32_MIN> >();
|
||||
return ::Company::Get(company)->cur_economy.delivered_cargo.GetSum<OverflowSafeInt<int32, INT32_MAX, INT32_MIN> >();
|
||||
}
|
||||
return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].delivered_cargo.GetSum<OverflowSafeInt<int32, INT32_MAX, INT32_MIN> >();
|
||||
return ::Company::Get(company)->old_economy[quarter - 1].delivered_cargo.GetSum<OverflowSafeInt<int32, INT32_MAX, INT32_MIN> >();
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptCompany::GetQuarterlyPerformanceRating(ScriptCompany::CompanyID company, uint32 quarter)
|
||||
@@ -152,7 +152,7 @@
|
||||
if (quarter > EARLIEST_QUARTER) return -1;
|
||||
if (quarter == CURRENT_QUARTER) return -1;
|
||||
|
||||
return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].performance_history;
|
||||
return ::Company::Get(company)->old_economy[quarter - 1].performance_history;
|
||||
}
|
||||
|
||||
/* static */ Money ScriptCompany::GetQuarterlyCompanyValue(ScriptCompany::CompanyID company, uint32 quarter)
|
||||
@@ -162,9 +162,9 @@
|
||||
if (quarter > EARLIEST_QUARTER) return -1;
|
||||
|
||||
if (quarter == CURRENT_QUARTER) {
|
||||
return ::CalculateCompanyValue(::Company::Get((::CompanyID)company));
|
||||
return ::CalculateCompanyValue(::Company::Get(company));
|
||||
}
|
||||
return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].company_value;
|
||||
return ::Company::Get(company)->old_economy[quarter - 1].company_value;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
company = ResolveCompanyID(company);
|
||||
if (company == COMPANY_INVALID) return -1;
|
||||
|
||||
return ::Company::Get((CompanyID)company)->money;
|
||||
return ::Company::Get(company)->money;
|
||||
}
|
||||
|
||||
/* static */ Money ScriptCompany::GetLoanAmount()
|
||||
@@ -250,7 +250,7 @@
|
||||
company = ResolveCompanyID(company);
|
||||
if (company == COMPANY_INVALID) return INVALID_TILE;
|
||||
|
||||
TileIndex loc = ::Company::Get((CompanyID)company)->location_of_HQ;
|
||||
TileIndex loc = ::Company::Get(company)->location_of_HQ;
|
||||
return (loc == 0) ? INVALID_TILE : loc;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
company = ResolveCompanyID(company);
|
||||
if (company == COMPANY_INVALID) return false;
|
||||
|
||||
return ::Company::Get((CompanyID)company)->settings.engine_renew;
|
||||
return ::Company::Get(company)->settings.engine_renew;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::SetAutoRenewMonths(int16 months)
|
||||
@@ -277,7 +277,7 @@
|
||||
company = ResolveCompanyID(company);
|
||||
if (company == COMPANY_INVALID) return 0;
|
||||
|
||||
return ::Company::Get((CompanyID)company)->settings.engine_renew_months;
|
||||
return ::Company::Get(company)->settings.engine_renew_months;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::SetAutoRenewMoney(Money money)
|
||||
@@ -292,7 +292,7 @@
|
||||
company = ResolveCompanyID(company);
|
||||
if (company == COMPANY_INVALID) return 0;
|
||||
|
||||
return ::Company::Get((CompanyID)company)->settings.engine_renew_money;
|
||||
return ::Company::Get(company)->settings.engine_renew_money;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::SetPrimaryLiveryColour(LiveryScheme scheme, Colours colour)
|
||||
|
||||
@@ -276,3 +276,25 @@
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool ScriptEngine::EnableForCompany(EngineID engine_id, ScriptCompany::CompanyID company)
|
||||
{
|
||||
company = ScriptCompany::ResolveCompanyID(company);
|
||||
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsValidEngine(engine_id));
|
||||
EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
|
||||
|
||||
return ScriptObject::DoCommand(0, engine_id, (uint32)company | (1 << 31), CMD_ENGINE_CTRL);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptEngine::DisableForCompany(EngineID engine_id, ScriptCompany::CompanyID company)
|
||||
{
|
||||
company = ScriptCompany::ResolveCompanyID(company);
|
||||
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsValidEngine(engine_id));
|
||||
EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
|
||||
|
||||
return ScriptObject::DoCommand(0, engine_id, company, CMD_ENGINE_CTRL);
|
||||
}
|
||||
|
||||
@@ -287,6 +287,29 @@ public:
|
||||
* @see ScriptOrder::GetOrderDistance
|
||||
*/
|
||||
static uint GetMaximumOrderDistance(EngineID engine_id);
|
||||
|
||||
/**
|
||||
* Allows a company to use an engine before its intro date or after retirement.
|
||||
* @param engine_id The engine to enable.
|
||||
* @param company_id The company to allow using the engine.
|
||||
* @pre IsValidEngine(engine_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company_id) != ScriptCompany::COMPANY_INVALID.
|
||||
* @return True if the action succeeded.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool EnableForCompany(EngineID engine_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
/**
|
||||
* Forbids a company to use an engine before its natural retirement.
|
||||
* @param engine_id The engine to disable.
|
||||
* @param company_id The company to forbid using the engine.
|
||||
* @pre IsValidEngine(engine_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company_id) != ScriptCompany::COMPANY_INVALID.
|
||||
* @return True if the action succeeded.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool DisableForCompany(EngineID engine_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
};
|
||||
|
||||
#endif /* SCRIPT_ENGINE_HPP */
|
||||
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
/** Miscellaneous flags for Script settings. */
|
||||
enum ScriptConfigFlags {
|
||||
CONFIG_NONE, ///< Normal setting.
|
||||
CONFIG_RANDOM, ///< When randomizing the Script, pick any value between min_value and max_value.
|
||||
CONFIG_RANDOM, ///< When randomizing the Script, pick any value between min_value and max_value (inclusive).
|
||||
CONFIG_BOOLEAN, ///< This value is a boolean (either 0 (false) or 1 (true) ).
|
||||
CONFIG_INGAME, ///< This setting can be changed while the Script is running.
|
||||
CONFIG_DEVELOPER, ///< This setting will only be visible when the Script development tools are active.
|
||||
@@ -230,8 +230,8 @@ public:
|
||||
* - custom_value The default value if the custom difficulty level
|
||||
* is selected. Required.
|
||||
* - random_deviation If this property has a nonzero value, then the
|
||||
* actual value of the setting in game will be
|
||||
* user_configured_value + random(-random_deviation, random_deviation).
|
||||
* actual value of the setting in game will be randomized in the range
|
||||
* [user_configured_value - random_deviation, user_configured_value + random_deviation] (inclusive).
|
||||
* Not allowed if the CONFIG_RANDOM flag is set, otherwise optional.
|
||||
* - step_size The increase/decrease of the value every time the user
|
||||
* clicks one of the up/down arrow buttons. Optional, default is 1.
|
||||
|
||||
@@ -62,11 +62,11 @@
|
||||
DiagDirection to_other_tile = ::DiagdirBetweenTiles(t2, t1);
|
||||
|
||||
/* Determine the reachable tracks from the shared edge */
|
||||
TrackBits gtts1 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t1, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
|
||||
TrackBits gtts1 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t1, TRANSPORT_WATER, 0, ReverseDiagDir(to_other_tile))) & ::DiagdirReachesTracks(to_other_tile);
|
||||
if (gtts1 == TRACK_BIT_NONE) return false;
|
||||
|
||||
to_other_tile = ReverseDiagDir(to_other_tile);
|
||||
TrackBits gtts2 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t2, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
|
||||
TrackBits gtts2 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t2, TRANSPORT_WATER, 0, ReverseDiagDir(to_other_tile))) & ::DiagdirReachesTracks(to_other_tile);
|
||||
|
||||
return gtts2 != TRACK_BIT_NONE;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
|
||||
}
|
||||
} else if (st->ship_station.tile != INVALID_TILE) {
|
||||
TILE_AREA_LOOP(t, st->ship_station) {
|
||||
if (IsDockTile(t) && GetStationIndex(t) == st->index) return t;
|
||||
if (IsTileType(t, MP_STATION) && (IsDock(t) || IsOilRig(t)) && GetStationIndex(t) == st->index) return t;
|
||||
}
|
||||
} else if (st->bus_stops != nullptr) {
|
||||
return st->bus_stops->xy;
|
||||
|
||||
@@ -401,7 +401,7 @@ static bool NormaliseTileOffset(int32 *tile)
|
||||
if (::DistanceManhattan(tile, start) != 1 || ::DistanceManhattan(tile, end) != 1) return -1;
|
||||
|
||||
/* ROAD_NW ROAD_SW ROAD_SE ROAD_NE */
|
||||
static const TileIndexDiff neighbours[] = {::TileDiffXY(0, -1), ::TileDiffXY(1, 0), ::TileDiffXY(0, 1), ::TileDiffXY(-1, 0)};
|
||||
const TileIndexDiff neighbours[] = {::TileDiffXY(0, -1), ::TileDiffXY(1, 0), ::TileDiffXY(0, 1), ::TileDiffXY(-1, 0)};
|
||||
Array *existing = (Array*)alloca(sizeof(Array) + lengthof(neighbours) * sizeof(int32));
|
||||
existing->size = 0;
|
||||
|
||||
|
||||
@@ -79,6 +79,9 @@ ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID in
|
||||
|
||||
const Industry *i = ::Industry::Get(industry_id);
|
||||
|
||||
/* Check if this industry is only served by its neutral station */
|
||||
if (i->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) return;
|
||||
|
||||
/* Check if this industry accepts anything */
|
||||
{
|
||||
bool cargo_accepts = false;
|
||||
@@ -116,6 +119,9 @@ ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing(IndustryID in
|
||||
|
||||
const Industry *i = ::Industry::Get(industry_id);
|
||||
|
||||
/* Check if this industry is only served by its neutral station */
|
||||
if (i->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) return;
|
||||
|
||||
/* Check if this industry produces anything */
|
||||
bool cargo_produces = false;
|
||||
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
|
||||
|
||||
@@ -336,6 +336,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ int ScriptTown::GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return TOWN_RATING_INVALID;
|
||||
ScriptCompany::CompanyID company = ScriptCompany::ResolveCompanyID(company_id);
|
||||
if (company == ScriptCompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
|
||||
|
||||
const Town *t = ::Town::Get(town_id);
|
||||
return t->ratings[company];
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTown::ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, int delta)
|
||||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsValidTown(town_id));
|
||||
ScriptCompany::CompanyID company = ScriptCompany::ResolveCompanyID(company_id);
|
||||
EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
|
||||
|
||||
const Town *t = ::Town::Get(town_id);
|
||||
int16 new_rating = Clamp(t->ratings[company] + delta, RATING_MINIMUM, RATING_MAXIMUM);
|
||||
if (new_rating == t->ratings[company]) return false;
|
||||
|
||||
uint16 p2 = 0;
|
||||
memcpy(&p2, &new_rating, sizeof(p2));
|
||||
|
||||
return ScriptObject::DoCommand(0, town_id | (company_id << 16), p2, CMD_TOWN_RATING);
|
||||
}
|
||||
|
||||
/* static */ int ScriptTown::GetAllowedNoise(TownID town_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return -1;
|
||||
|
||||
@@ -423,6 +423,30 @@ public:
|
||||
*/
|
||||
static TownRating GetRating(TownID town_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
/**
|
||||
* Get the accurate rating of a company within a town.
|
||||
* @param town_id The town to get the rating for.
|
||||
* @param company_id The company to get the rating for.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID.
|
||||
* @return The rating as a number between -1000 (worst) and 1000 (best).
|
||||
* @api -ai
|
||||
*/
|
||||
static int GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
/**
|
||||
* Change the rating of a company within a town.
|
||||
* @param town_id The town to change the rating in.
|
||||
* @param company_id The company to change the rating for.
|
||||
* @param delta How much to change rating by (range -1000 to +1000).
|
||||
* @return True if the rating was changed.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID.
|
||||
* @pre no company mode in scope
|
||||
* @api -ai
|
||||
*/
|
||||
static bool ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, int delta);
|
||||
|
||||
/**
|
||||
* Get the maximum level of noise that still can be added by airports
|
||||
* before the town start to refuse building a new airport.
|
||||
|
||||
@@ -312,6 +312,10 @@ public:
|
||||
* @return The VehicleID of the new vehicle, or an invalid VehicleID when
|
||||
* it failed. Check the return value using IsValidVehicle. In test-mode
|
||||
* 0 is returned if it was successful; any other value indicates failure.
|
||||
* @note Unlike the GUI, wagons are not automatically attached to trains,
|
||||
* only to existing free wagons. This means that BuildVehicle can sometimes
|
||||
* return an ID indicating success, but IsValidVehicle check will
|
||||
* fail. You should use MoveWagon to attach free wagons to trains.
|
||||
* @note In Test Mode it means you can't assign orders yet to this vehicle,
|
||||
* as the vehicle isn't really built yet. Build it for real first before
|
||||
* assigning orders.
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "../../widgets/osk_widget.h"
|
||||
#include "../../widgets/rail_widget.h"
|
||||
#include "../../widgets/road_widget.h"
|
||||
#include "../../widgets/screenshot_widget.h"
|
||||
#include "../../widgets/settings_widget.h"
|
||||
#include "../../widgets/sign_widget.h"
|
||||
#include "../../widgets/smallmap_widget.h"
|
||||
@@ -775,6 +776,12 @@ public:
|
||||
*/
|
||||
WC_FRAMETIME_GRAPH = ::WC_FRAMETIME_GRAPH,
|
||||
|
||||
/**
|
||||
* Screenshot window; %Window numbers:
|
||||
* - 0 = #ScreenshotWidgets
|
||||
*/
|
||||
WC_SCREENSHOT = ::WC_SCREENSHOT,
|
||||
|
||||
WC_INVALID = ::WC_INVALID, ///< Invalid window.
|
||||
};
|
||||
|
||||
@@ -1516,6 +1523,8 @@ public:
|
||||
enum IndustryDirectoryWidgets {
|
||||
WID_ID_DROPDOWN_ORDER = ::WID_ID_DROPDOWN_ORDER, ///< Dropdown for the order of the sort.
|
||||
WID_ID_DROPDOWN_CRITERIA = ::WID_ID_DROPDOWN_CRITERIA, ///< Dropdown for the criteria of the sort.
|
||||
WID_ID_FILTER_BY_ACC_CARGO = ::WID_ID_FILTER_BY_ACC_CARGO, ///< Accepted cargo filter dropdown list.
|
||||
WID_ID_FILTER_BY_PROD_CARGO = ::WID_ID_FILTER_BY_PROD_CARGO, ///< Produced cargo filter dropdown list.
|
||||
WID_ID_INDUSTRY_LIST = ::WID_ID_INDUSTRY_LIST, ///< Industry list.
|
||||
WID_ID_SCROLLBAR = ::WID_ID_SCROLLBAR, ///< Scrollbar of the list.
|
||||
};
|
||||
@@ -1596,6 +1605,7 @@ public:
|
||||
enum AboutWidgets {
|
||||
WID_A_SCROLLING_TEXT = ::WID_A_SCROLLING_TEXT, ///< The actually scrolling text.
|
||||
WID_A_WEBSITE = ::WID_A_WEBSITE, ///< URL of OpenTTD website.
|
||||
WID_A_COPYRIGHT = ::WID_A_COPYRIGHT, ///< Copyright string
|
||||
};
|
||||
|
||||
/** Widgets of the #QueryStringWindow class. */
|
||||
@@ -2171,6 +2181,17 @@ public:
|
||||
WID_BROS_INFO = ::WID_BROS_INFO, ///< Station acceptance info.
|
||||
};
|
||||
|
||||
/* automatically generated from ../../widgets/screenshot_widget.h */
|
||||
/** Widgets of the #ScreenshotWindow class. */
|
||||
enum ScreenshotWindowWidgets {
|
||||
WID_SC_TAKE = ::WID_SC_TAKE, ///< Button for taking a normal screenshot
|
||||
WID_SC_TAKE_ZOOMIN = ::WID_SC_TAKE_ZOOMIN, ///< Button for taking a zoomed in screenshot
|
||||
WID_SC_TAKE_DEFAULTZOOM = ::WID_SC_TAKE_DEFAULTZOOM, ///< Button for taking a screenshot at normal zoom
|
||||
WID_SC_TAKE_WORLD = ::WID_SC_TAKE_WORLD, ///< Button for taking a screenshot of the whole world
|
||||
WID_SC_TAKE_HEIGHTMAP = ::WID_SC_TAKE_HEIGHTMAP, ///< Button for taking a heightmap "screenshot"
|
||||
WID_SC_TAKE_MINIMAP = ::WID_SC_TAKE_MINIMAP, ///< Button for taking a minimap screenshot
|
||||
};
|
||||
|
||||
/* automatically generated from ../../widgets/settings_widget.h */
|
||||
/** Widgets of the #GameOptionsWindow class. */
|
||||
enum GameOptionsWidgets {
|
||||
|
||||
@@ -193,6 +193,8 @@ namespace SQConvert {
|
||||
template <> inline int Return<ScriptWindow::BuildRoadDepotWidgets>(HSQUIRRELVM vm, ScriptWindow::BuildRoadDepotWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::BuildRoadStationWidgets GetParam(ForceType<ScriptWindow::BuildRoadStationWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::BuildRoadStationWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::BuildRoadStationWidgets>(HSQUIRRELVM vm, ScriptWindow::BuildRoadStationWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::ScreenshotWindowWidgets GetParam(ForceType<ScriptWindow::ScreenshotWindowWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::ScreenshotWindowWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::ScreenshotWindowWidgets>(HSQUIRRELVM vm, ScriptWindow::ScreenshotWindowWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::GameOptionsWidgets GetParam(ForceType<ScriptWindow::GameOptionsWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::GameOptionsWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::GameOptionsWidgets>(HSQUIRRELVM vm, ScriptWindow::GameOptionsWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::GameSettingsWidgets GetParam(ForceType<ScriptWindow::GameSettingsWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::GameSettingsWidgets)tmp; }
|
||||
|
||||
Reference in New Issue
Block a user