Merge branch 'infrastructure_sharing-sx' into jgrpp

# Conflicts:
#	src/settings_type.h
#	src/table/settings.ini
This commit is contained in:
Jonathan G Rennison 2016-02-25 22:31:36 +00:00
commit 7bc407e2f8
6 changed files with 20 additions and 0 deletions

View File

@ -658,6 +658,7 @@ uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPaymen
uint VehicleCargoList::Truncate(uint max_move)
{
max_move = min(this->count, max_move);
if (max_move > this->ActionCount(MTA_KEEP)) this->KeepAll();
this->PopCargo(CargoRemoval<VehicleCargoList>(this, max_move));
return max_move;
}

View File

@ -1265,6 +1265,9 @@ STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :When enabled, i
STR_CONFIG_SETTING_SHIP_COLLISION_AVOIDANCE :Ships avoid collisions: {STRING2}
STR_CONFIG_SETTING_SHIP_COLLISION_AVOIDANCE_HELPTEXT :When enabled, ships try to avoid passing through each other. Requires 90° turns to be forbidden.
STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY :Trains from different companies may not crash into each other: {STRING2}
STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY_HELPTEXT :This setting is primarily to prevent untrusted players deliberately causing crashes involving other companies' trains in multi-player rail infrastructure sharing games.
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :Airports never expire: {STRING2}
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :Enabling this setting makes each airport type stay available forever after its introduction

View File

@ -1724,6 +1724,7 @@ static SettingsContainer &GetSettingsTree()
disasters->Add(new SettingEntry("difficulty.vehicle_breakdowns"));
disasters->Add(new SettingEntry("vehicle.improved_breakdowns"));
disasters->Add(new SettingEntry("vehicle.plane_crashes"));
disasters->Add(new SettingEntry("vehicle.no_train_crash_other_company"));
}
SettingsPage *genworld = main->Add(new SettingsPage(STR_CONFIG_SETTING_GENWORLD));

View File

@ -514,6 +514,7 @@ struct VehicleSettings {
bool pay_for_repair; ///< pay for repairing vehicle
uint8 repair_cost; ///< cost of repairing vehicle
bool ship_collision_avoidance; ///< ships try to avoid colliding with each other
bool no_train_crash_other_company; ///< trains cannot crash with trains from other companies
};
/** Settings related to the economy. */

View File

@ -1289,6 +1289,15 @@ strhelp = STR_CONFIG_SETTING_SHIP_COLLISION_AVOIDANCE_HELPTEXT
patxname = ""ship_collision_avoidance.vehicle.ship_collision_avoidance""
cat = SC_BASIC
[SDT_BOOL]
base = GameSettings
var = vehicle.no_train_crash_other_company
def = false
str = STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY
strhelp = STR_CONFIG_SETTING_NO_TRAIN_CRASH_OTHER_COMPANY_HELPTEXT
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.vehicle.no_train_crash_other_company""
; station.join_stations
[SDT_NULL]
length = 1

View File

@ -3298,6 +3298,11 @@ static Vehicle *FindTrainCollideEnum(Vehicle *v, void *data)
/* not a train or in depot */
if (v->type != VEH_TRAIN || Train::From(v)->track == TRACK_BIT_DEPOT) return NULL;
if (_settings_game.vehicle.no_train_crash_other_company) {
/* do not crash into trains of another company. */
if (v->owner != tcc->v->owner) return NULL;
}
/* get first vehicle now to make most usual checks faster */
Train *coll = Train::From(v)->First();