summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-05-26 21:59:49 +0000
committeryexo <yexo@openttd.org>2009-05-26 21:59:49 +0000
commit0d56cfabfa6b6553f02a701d3ec3d92cc7067b63 (patch)
treecbedc97360c42339860d6b03483900a203cf2ec3 /src/vehicle_gui.cpp
parentaa62ec0a1f7cc2416e0397eeccc90156d27b8b44 (diff)
downloadopenttd-0d56cfabfa6b6553f02a701d3ec3d92cc7067b63.tar.xz
(svn r16439) -Change: Make the default vehicle servicing settings company-based settings, so in a multiplayer game everyone can change them.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 455aed43a..2cea2dae3 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1389,14 +1389,15 @@ struct VehicleDetailsWindow : Window {
}
/** Checks whether service interval is enabled for the vehicle. */
- static bool IsVehicleServiceIntervalEnabled(const VehicleType vehicle_type)
+ static bool IsVehicleServiceIntervalEnabled(const VehicleType vehicle_type, CompanyID company_id)
{
+ const VehicleDefaultSettings *vds = &Company::Get(company_id)->settings.vehicle;
switch (vehicle_type) {
default: NOT_REACHED();
- case VEH_TRAIN: return _settings_game.vehicle.servint_trains != 0;
- case VEH_ROAD: return _settings_game.vehicle.servint_roadveh != 0;
- case VEH_SHIP: return _settings_game.vehicle.servint_ships != 0;
- case VEH_AIRCRAFT: return _settings_game.vehicle.servint_aircraft != 0;
+ case VEH_TRAIN: return vds->servint_trains != 0;
+ case VEH_ROAD: return vds->servint_roadveh != 0;
+ case VEH_SHIP: return vds->servint_ships != 0;
+ case VEH_AIRCRAFT: return vds->servint_aircraft != 0;
}
}
@@ -1445,7 +1446,7 @@ struct VehicleDetailsWindow : Window {
WIDGET_LIST_END);
/* Disable service-scroller when interval is set to disabled */
- this->SetWidgetsDisabledState(!IsVehicleServiceIntervalEnabled(v->type),
+ this->SetWidgetsDisabledState(!IsVehicleServiceIntervalEnabled(v->type, v->owner),
VLD_WIDGET_INCREASE_SERVICING_INTERVAL,
VLD_WIDGET_DECREASE_SERVICING_INTERVAL,
WIDGET_LIST_END);
@@ -1496,7 +1497,7 @@ struct VehicleDetailsWindow : Window {
/* Draw service interval text */
SetDParam(0, v->service_interval);
SetDParam(1, v->date_of_last_service);
- DrawString(13, this->width - 2, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings_game.vehicle.servint_ispercent ? STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT : STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS);
+ DrawString(13, this->width - 2, this->height - (v->type != VEH_TRAIN ? 11 : 23), Company::Get(v->owner)->settings.vehicle.servint_ispercent ? STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT : STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS);
switch (v->type) {
case VEH_TRAIN:
@@ -1537,7 +1538,7 @@ struct VehicleDetailsWindow : Window {
const Vehicle *v = Vehicle::Get(this->window_number);
mod = (widget == VLD_WIDGET_DECREASE_SERVICING_INTERVAL) ? -mod : mod;
- mod = GetServiceIntervalClamped(mod + v->service_interval);
+ mod = GetServiceIntervalClamped(mod + v->service_interval, v->owner);
if (mod == v->service_interval) return;
DoCommandP(v->tile, v->index, mod, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_SERVICING));