Update to 1.10.0
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -131,7 +131,7 @@ void ScriptConfig::AddRandomDeviation()
|
||||
{
|
||||
for (ScriptConfigItemList::const_iterator it = this->GetConfigList()->begin(); it != this->GetConfigList()->end(); it++) {
|
||||
if ((*it).random_deviation != 0) {
|
||||
this->SetSetting((*it).name, InteractiveRandomRange((*it).random_deviation * 2) - (*it).random_deviation + this->GetSetting((*it).name));
|
||||
this->SetSetting((*it).name, InteractiveRandomRange((*it).random_deviation * 2 + 1) - (*it).random_deviation + this->GetSetting((*it).name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user