mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Merge branch 'infrastructure_sharing-sx' into jgrpp
# Conflicts: # src/settings_gui.cpp # src/settings_type.h # src/table/company_settings.ini
This commit is contained in:
commit
1f5535c0b1
@ -1542,6 +1542,10 @@ STR_CONFIG_SETTING_SHARING_FEE_AIR :Terminal fee fo
|
||||
STR_CONFIG_SETTING_SHARING_PAYMENT_IN_DEBT :Allow companies in debt to pay sharing fees: {STRING2}
|
||||
STR_CONFIG_SETTING_SHARING_USED_BY_VEHICLES :Can't change this setting, vehicles are using shared infrastructure.
|
||||
STR_CONFIG_SETTING_SHARING_ORDERS_TO_OTHERS :Can't change this setting, vehicles have orders to destinations of others.
|
||||
STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_RAIL :Enable competitors to buy and renew trains in depots: {STRING2}
|
||||
STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_ROAD :Enable competitors to buy and renew road vehicles in depots: {STRING2}
|
||||
STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_WATER :Enable competitors to buy and renew ships in depots: {STRING2}
|
||||
STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_AIR :Enable competitors to buy and renew aircraft in hangars: {STRING2}
|
||||
|
||||
STR_CONFIG_SETTING_SERVINT_ISPERCENT :Service intervals are in percents: {STRING2}
|
||||
STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Choose whether servicing of vehicles is triggered by the time passed since last service or by reliability dropping by a certain percentage of the maximum reliability
|
||||
|
@ -1641,6 +1641,10 @@ static SettingsContainer &GetSettingsTree()
|
||||
company->Add(new SettingEntry("vehicle.auto_timetable_by_default"));
|
||||
company->Add(new SettingEntry("auto_timetable_separation_rate"));
|
||||
company->Add(new SettingEntry("order_occupancy_smoothness"));
|
||||
company->Add(new SettingEntry("company.infra_others_buy_in_depot[0]"));
|
||||
company->Add(new SettingEntry("company.infra_others_buy_in_depot[1]"));
|
||||
company->Add(new SettingEntry("company.infra_others_buy_in_depot[2]"));
|
||||
company->Add(new SettingEntry("company.infra_others_buy_in_depot[3]"));
|
||||
}
|
||||
|
||||
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
||||
|
@ -596,6 +596,7 @@ struct CompanySettings {
|
||||
VehicleDefaultSettings vehicle; ///< default settings for vehicles
|
||||
uint8 order_occupancy_smoothness; ///< percentage smoothness of occupancy measurement changes
|
||||
uint8 auto_timetable_separation_rate; ///< percentage of auto timetable separation change to apply
|
||||
bool infra_others_buy_in_depot[4]; ///< other companies can buy/autorenew in this companies depots (where infra sharing enabled)
|
||||
};
|
||||
|
||||
/** All settings together for the game. */
|
||||
|
@ -180,6 +180,38 @@ strval = STR_CONFIG_SETTING_PERCENTAGE
|
||||
cat = SC_EXPERT
|
||||
patxname = ""order_occupancy_smoothness""
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = infra_others_buy_in_depot[0]
|
||||
guiflags = SGF_PER_COMPANY
|
||||
def = false
|
||||
str = STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_RAIL
|
||||
patxname = ""infra_sharing.infra_others_buy_in_depot.rail""
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = infra_others_buy_in_depot[1]
|
||||
guiflags = SGF_PER_COMPANY
|
||||
def = false
|
||||
str = STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_ROAD
|
||||
patxname = ""infra_sharing.infra_others_buy_in_depot.road""
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = infra_others_buy_in_depot[2]
|
||||
guiflags = SGF_PER_COMPANY
|
||||
def = false
|
||||
str = STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_WATER
|
||||
patxname = ""infra_sharing.infra_others_buy_in_depot.water""
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = infra_others_buy_in_depot[3]
|
||||
guiflags = SGF_PER_COMPANY
|
||||
def = false
|
||||
str = STR_CONFIG_SETTING_INFRA_OTHERS_BUY_IN_DEPOT_AIR
|
||||
patxname = ""infra_sharing.infra_others_buy_in_depot.air""
|
||||
|
||||
[SDT_END]
|
||||
|
||||
|
||||
|
@ -719,7 +719,8 @@ static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const
|
||||
w->IsFreeWagon() && ///< A free wagon chain
|
||||
w->engine_type == e->index && ///< Same type
|
||||
w->First() != v && ///< Don't connect to ourself
|
||||
!(w->vehstatus & VS_CRASHED)) { ///< Not crashed/flooded
|
||||
!(w->vehstatus & VS_CRASHED) && ///< Not crashed/flooded
|
||||
w->owner == v->owner) { ///< Same owner
|
||||
DoCommand(0, v->index | 1 << 20, w->Last()->index, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
|
||||
break;
|
||||
}
|
||||
@ -735,7 +736,8 @@ static void NormalizeTrainVehInDepot(const Train *u)
|
||||
const Train *v;
|
||||
FOR_ALL_TRAINS(v) {
|
||||
if (v->IsFreeWagon() && v->tile == u->tile &&
|
||||
v->track == TRACK_BIT_DEPOT) {
|
||||
v->track == TRACK_BIT_DEPOT &&
|
||||
v->owner == u->owner) {
|
||||
if (DoCommand(0, v->index | 1 << 20, u->index, DC_EXEC,
|
||||
CMD_MOVE_RAIL_VEHICLE).Failed())
|
||||
break;
|
||||
@ -874,7 +876,7 @@ static Train *FindGoodVehiclePos(const Train *src)
|
||||
|
||||
Train *dst;
|
||||
FOR_ALL_TRAINS(dst) {
|
||||
if (dst->IsFreeWagon() && dst->tile == tile && !(dst->vehstatus & VS_CRASHED)) {
|
||||
if (dst->IsFreeWagon() && dst->tile == tile && !(dst->vehstatus & VS_CRASHED) && dst->owner == src->owner) {
|
||||
/* check so all vehicles in the line have the same engine. */
|
||||
Train *t = dst;
|
||||
while (t->engine_type == eng) {
|
||||
|
@ -88,9 +88,15 @@ static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID
|
||||
CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
/* Elementary check for valid location. */
|
||||
if (!IsDepotTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;
|
||||
if (!IsDepotTile(tile)) return CMD_ERROR;
|
||||
|
||||
VehicleType type = GetDepotVehicleType(tile);
|
||||
if (!IsTileOwner(tile, _current_company)) {
|
||||
if (!_settings_game.economy.infrastructure_sharing[type]) return CMD_ERROR;
|
||||
|
||||
const Company *c = Company::GetIfValid(GetTileOwner(tile));
|
||||
if (c == NULL || !c->settings.infra_others_buy_in_depot[type]) return CMD_ERROR;
|
||||
}
|
||||
|
||||
/* Validate the engine type. */
|
||||
EngineID eid = GB(p1, 0, 16);
|
||||
|
Loading…
Reference in New Issue
Block a user