(svn r26567) -Cleanup: Remove unused StringID offset in orders check

This commit is contained in:
planetmaker 2014-05-06 20:53:08 +00:00
parent 34b1d89dbe
commit 68af7a843c
2 changed files with 10 additions and 16 deletions

View File

@ -810,14 +810,12 @@ STR_NEWS_ROAD_VEHICLE_IS_WAITING :{WHITE}{VEHICLE
STR_NEWS_SHIP_IS_WAITING :{WHITE}{VEHICLE} is waiting in depot STR_NEWS_SHIP_IS_WAITING :{WHITE}{VEHICLE} is waiting in depot
STR_NEWS_AIRCRAFT_IS_WAITING :{WHITE}{VEHICLE} is waiting in the aircraft hangar STR_NEWS_AIRCRAFT_IS_WAITING :{WHITE}{VEHICLE} is waiting in the aircraft hangar
# Start of order review system # Order review system / warnings
# DON'T ADD OR REMOVE LINES HERE
STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS :{WHITE}{VEHICLE} has too few orders in the schedule STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS :{WHITE}{VEHICLE} has too few orders in the schedule
STR_NEWS_VEHICLE_HAS_VOID_ORDER :{WHITE}{VEHICLE} has a void order STR_NEWS_VEHICLE_HAS_VOID_ORDER :{WHITE}{VEHICLE} has a void order
STR_NEWS_VEHICLE_HAS_DUPLICATE_ENTRY :{WHITE}{VEHICLE} has duplicate orders STR_NEWS_VEHICLE_HAS_DUPLICATE_ENTRY :{WHITE}{VEHICLE} has duplicate orders
STR_NEWS_VEHICLE_HAS_INVALID_ENTRY :{WHITE}{VEHICLE} has an invalid station in its orders STR_NEWS_VEHICLE_HAS_INVALID_ENTRY :{WHITE}{VEHICLE} has an invalid station in its orders
STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY :{WHITE}{VEHICLE} has an airport with a too short runway in its orders STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY :{WHITE}{VEHICLE} has an airport with a too short runway in its orders
# end of order system
STR_NEWS_VEHICLE_IS_GETTING_OLD :{WHITE}{VEHICLE} is getting old STR_NEWS_VEHICLE_IS_GETTING_OLD :{WHITE}{VEHICLE} is getting old
STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD :{WHITE}{VEHICLE} is getting very old STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD :{WHITE}{VEHICLE} is getting very old

View File

@ -1772,17 +1772,16 @@ void CheckOrders(const Vehicle *v)
/* Only check every 20 days, so that we don't flood the message log */ /* Only check every 20 days, so that we don't flood the message log */
if (v->owner == _local_company && v->day_counter % 20 == 0) { if (v->owner == _local_company && v->day_counter % 20 == 0) {
int n_st, problem_type = -1;
const Order *order; const Order *order;
int message = 0; StringID message = INVALID_STRING_ID;
/* Check the order list */ /* Check the order list */
n_st = 0; int n_st = 0;
FOR_VEHICLE_ORDERS(v, order) { FOR_VEHICLE_ORDERS(v, order) {
/* Dummy order? */ /* Dummy order? */
if (order->IsType(OT_DUMMY)) { if (order->IsType(OT_DUMMY)) {
problem_type = 1; message = STR_NEWS_VEHICLE_HAS_VOID_ORDER;
break; break;
} }
/* Does station have a load-bay for this vehicle? */ /* Does station have a load-bay for this vehicle? */
@ -1791,14 +1790,14 @@ void CheckOrders(const Vehicle *v)
n_st++; n_st++;
if (!CanVehicleUseStation(v, st)) { if (!CanVehicleUseStation(v, st)) {
problem_type = 3; message = STR_NEWS_VEHICLE_HAS_INVALID_ENTRY;
} else if (v->type == VEH_AIRCRAFT && } else if (v->type == VEH_AIRCRAFT &&
(AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) && (AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) &&
(st->airport.GetFTA()->flags & AirportFTAClass::SHORT_STRIP) && (st->airport.GetFTA()->flags & AirportFTAClass::SHORT_STRIP) &&
_settings_game.vehicle.plane_crashes != 0 && _settings_game.vehicle.plane_crashes != 0 &&
!_cheats.no_jetcrash.value && !_cheats.no_jetcrash.value &&
problem_type == -1) { message == INVALID_STRING_ID) {
problem_type = 4; message = STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY;
} }
} }
} }
@ -1808,22 +1807,19 @@ void CheckOrders(const Vehicle *v)
const Order *last = v->GetLastOrder(); const Order *last = v->GetLastOrder();
if (v->orders.list->GetFirstOrder()->Equals(*last)) { if (v->orders.list->GetFirstOrder()->Equals(*last)) {
problem_type = 2; message = STR_NEWS_VEHICLE_HAS_DUPLICATE_ENTRY;
} }
} }
/* Do we only have 1 station in our order list? */ /* Do we only have 1 station in our order list? */
if (n_st < 2 && problem_type == -1) problem_type = 0; if (n_st < 2 && message == INVALID_STRING_ID) message = STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS;
#ifndef NDEBUG #ifndef NDEBUG
if (v->orders.list != NULL) v->orders.list->DebugCheckSanity(); if (v->orders.list != NULL) v->orders.list->DebugCheckSanity();
#endif #endif
/* We don't have a problem */ /* We don't have a problem */
if (problem_type < 0) return; if (message == INVALID_STRING_ID) return;
message = STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS + problem_type;
//DEBUG(misc, 3, "Triggered News Item for vehicle %d", v->index);
SetDParam(0, v->index); SetDParam(0, v->index);
AddVehicleAdviceNewsItem(message, v->index); AddVehicleAdviceNewsItem(message, v->index);