Mercurial > hg > openttd
comparison src/vehicle_gui.cpp @ 9413:512ea64da840 draft
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 29 May 2008 15:13:28 +0000 |
parents | bbf7586724f4 |
children | 6a031a5f7412 |
comparison
equal
deleted
inserted
replaced
9412:a9c6a921f0aa | 9413:512ea64da840 |
---|---|
1216 } | 1216 } |
1217 } | 1217 } |
1218 | 1218 |
1219 void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type) | 1219 void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type) |
1220 { | 1220 { |
1221 /* If _settings.gui.advanced_vehicle_list > 1, display the Advanced list | 1221 /* If _settings_client.gui.advanced_vehicle_list > 1, display the Advanced list |
1222 * if _settings.gui.advanced_vehicle_list == 1, display Advanced list only for local player | 1222 * if _settings_client.gui.advanced_vehicle_list == 1, display Advanced list only for local player |
1223 * if _ctrl_pressed, do the opposite action (Advanced list x Normal list) | 1223 * if _ctrl_pressed, do the opposite action (Advanced list x Normal list) |
1224 */ | 1224 */ |
1225 | 1225 |
1226 if ((_settings.gui.advanced_vehicle_list > (uint)(player != _local_player)) != _ctrl_pressed) { | 1226 if ((_settings_client.gui.advanced_vehicle_list > (uint)(player != _local_player)) != _ctrl_pressed) { |
1227 ShowPlayerGroup(player, vehicle_type); | 1227 ShowPlayerGroup(player, vehicle_type); |
1228 } else { | 1228 } else { |
1229 ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0); | 1229 ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0); |
1230 } | 1230 } |
1231 } | 1231 } |
1407 /** Checks whether service interval is enabled for the vehicle. */ | 1407 /** Checks whether service interval is enabled for the vehicle. */ |
1408 static bool IsVehicleServiceIntervalEnabled(const VehicleType vehicle_type) | 1408 static bool IsVehicleServiceIntervalEnabled(const VehicleType vehicle_type) |
1409 { | 1409 { |
1410 switch (vehicle_type) { | 1410 switch (vehicle_type) { |
1411 default: NOT_REACHED(); | 1411 default: NOT_REACHED(); |
1412 case VEH_TRAIN: return _settings.vehicle.servint_trains != 0; break; | 1412 case VEH_TRAIN: return _settings_game.vehicle.servint_trains != 0; break; |
1413 case VEH_ROAD: return _settings.vehicle.servint_roadveh != 0; break; | 1413 case VEH_ROAD: return _settings_game.vehicle.servint_roadveh != 0; break; |
1414 case VEH_SHIP: return _settings.vehicle.servint_ships != 0; break; | 1414 case VEH_SHIP: return _settings_game.vehicle.servint_ships != 0; break; |
1415 case VEH_AIRCRAFT: return _settings.vehicle.servint_aircraft != 0; break; | 1415 case VEH_AIRCRAFT: return _settings_game.vehicle.servint_aircraft != 0; break; |
1416 } | 1416 } |
1417 return false; // kill a compiler warning | 1417 return false; // kill a compiler warning |
1418 } | 1418 } |
1419 | 1419 |
1420 /** | 1420 /** |
1482 case VEH_TRAIN: | 1482 case VEH_TRAIN: |
1483 SetDParam(2, v->GetDisplayMaxSpeed()); | 1483 SetDParam(2, v->GetDisplayMaxSpeed()); |
1484 SetDParam(1, v->u.rail.cached_power); | 1484 SetDParam(1, v->u.rail.cached_power); |
1485 SetDParam(0, v->u.rail.cached_weight); | 1485 SetDParam(0, v->u.rail.cached_weight); |
1486 SetDParam(3, v->u.rail.cached_max_te / 1000); | 1486 SetDParam(3, v->u.rail.cached_max_te / 1000); |
1487 DrawString(2, 25, (_settings.vehicle.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ? | 1487 DrawString(2, 25, (_settings_game.vehicle.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ? |
1488 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE : | 1488 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE : |
1489 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING); | 1489 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING); |
1490 break; | 1490 break; |
1491 | 1491 |
1492 case VEH_ROAD: | 1492 case VEH_ROAD: |
1510 DrawString(2, 45, _vehicle_translation_table[VST_VEHICLE_RELIABILITY_BREAKDOWNS][v->type], TC_FROMSTRING); | 1510 DrawString(2, 45, _vehicle_translation_table[VST_VEHICLE_RELIABILITY_BREAKDOWNS][v->type], TC_FROMSTRING); |
1511 | 1511 |
1512 /* Draw service interval text */ | 1512 /* Draw service interval text */ |
1513 SetDParam(0, v->service_interval); | 1513 SetDParam(0, v->service_interval); |
1514 SetDParam(1, v->date_of_last_service); | 1514 SetDParam(1, v->date_of_last_service); |
1515 DrawString(13, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings.vehicle.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING); | 1515 DrawString(13, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings_game.vehicle.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING); |
1516 | 1516 |
1517 switch (v->type) { | 1517 switch (v->type) { |
1518 case VEH_TRAIN: | 1518 case VEH_TRAIN: |
1519 DrawVehicleDetails(v, 2, 57, this->vscroll.pos, this->vscroll.cap, det_tab); | 1519 DrawVehicleDetails(v, 2, 57, this->vscroll.pos, this->vscroll.cap, det_tab); |
1520 break; | 1520 break; |
1949 } else { | 1949 } else { |
1950 str = STR_8861_STOPPED; | 1950 str = STR_8861_STOPPED; |
1951 } | 1951 } |
1952 } else { | 1952 } else { |
1953 SetDParam(0, v->GetDisplaySpeed()); | 1953 SetDParam(0, v->GetDisplaySpeed()); |
1954 str = STR_TRAIN_STOPPING + _settings.gui.vehicle_speed; | 1954 str = STR_TRAIN_STOPPING + _settings_client.gui.vehicle_speed; |
1955 } | 1955 } |
1956 } else { // no train | 1956 } else { // no train |
1957 str = STR_8861_STOPPED; | 1957 str = STR_8861_STOPPED; |
1958 } | 1958 } |
1959 } else { // vehicle is in a "normal" state, show current order | 1959 } else { // vehicle is in a "normal" state, show current order |
1960 switch (v->current_order.GetType()) { | 1960 switch (v->current_order.GetType()) { |
1961 case OT_GOTO_STATION: { | 1961 case OT_GOTO_STATION: { |
1962 SetDParam(0, v->current_order.GetDestination()); | 1962 SetDParam(0, v->current_order.GetDestination()); |
1963 SetDParam(1, v->GetDisplaySpeed()); | 1963 SetDParam(1, v->GetDisplaySpeed()); |
1964 str = STR_HEADING_FOR_STATION + _settings.gui.vehicle_speed; | 1964 str = STR_HEADING_FOR_STATION + _settings_client.gui.vehicle_speed; |
1965 } break; | 1965 } break; |
1966 | 1966 |
1967 case OT_GOTO_DEPOT: { | 1967 case OT_GOTO_DEPOT: { |
1968 if (v->type == VEH_AIRCRAFT) { | 1968 if (v->type == VEH_AIRCRAFT) { |
1969 /* Aircrafts always go to a station, even if you say depot */ | 1969 /* Aircrafts always go to a station, even if you say depot */ |
1973 Depot *depot = GetDepot(v->current_order.GetDestination()); | 1973 Depot *depot = GetDepot(v->current_order.GetDestination()); |
1974 SetDParam(0, depot->town_index); | 1974 SetDParam(0, depot->town_index); |
1975 SetDParam(1, v->GetDisplaySpeed()); | 1975 SetDParam(1, v->GetDisplaySpeed()); |
1976 } | 1976 } |
1977 if ((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) { | 1977 if ((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) { |
1978 str = _heading_for_depot_strings[v->type] + _settings.gui.vehicle_speed; | 1978 str = _heading_for_depot_strings[v->type] + _settings_client.gui.vehicle_speed; |
1979 } else { | 1979 } else { |
1980 str = _heading_for_depot_service_strings[v->type] + _settings.gui.vehicle_speed; | 1980 str = _heading_for_depot_service_strings[v->type] + _settings_client.gui.vehicle_speed; |
1981 } | 1981 } |
1982 } break; | 1982 } break; |
1983 | 1983 |
1984 case OT_LOADING: | 1984 case OT_LOADING: |
1985 str = STR_882F_LOADING_UNLOADING; | 1985 str = STR_882F_LOADING_UNLOADING; |
1986 break; | 1986 break; |
1987 | 1987 |
1988 case OT_GOTO_WAYPOINT: { | 1988 case OT_GOTO_WAYPOINT: { |
1989 assert(v->type == VEH_TRAIN); | 1989 assert(v->type == VEH_TRAIN); |
1990 SetDParam(0, v->current_order.GetDestination()); | 1990 SetDParam(0, v->current_order.GetDestination()); |
1991 str = STR_HEADING_FOR_WAYPOINT + _settings.gui.vehicle_speed; | 1991 str = STR_HEADING_FOR_WAYPOINT + _settings_client.gui.vehicle_speed; |
1992 SetDParam(1, v->GetDisplaySpeed()); | 1992 SetDParam(1, v->GetDisplaySpeed()); |
1993 break; | 1993 break; |
1994 } | 1994 } |
1995 | 1995 |
1996 case OT_LEAVESTATION: | 1996 case OT_LEAVESTATION: |
2000 } | 2000 } |
2001 /* fall-through if aircraft. Does this even happen? */ | 2001 /* fall-through if aircraft. Does this even happen? */ |
2002 | 2002 |
2003 default: | 2003 default: |
2004 if (v->num_orders == 0) { | 2004 if (v->num_orders == 0) { |
2005 str = STR_NO_ORDERS + _settings.gui.vehicle_speed; | 2005 str = STR_NO_ORDERS + _settings_client.gui.vehicle_speed; |
2006 SetDParam(0, v->GetDisplaySpeed()); | 2006 SetDParam(0, v->GetDisplaySpeed()); |
2007 } else { | 2007 } else { |
2008 str = STR_EMPTY; | 2008 str = STR_EMPTY; |
2009 } | 2009 } |
2010 break; | 2010 break; |