(svn r8621) -Codechange: assigned new numbers to the VEH_(type) enum so that VEH_Train is 0, VEH_Road is 1 and so on
This means that "v->type" can be used as array indexes instead of VehTypeToIndex() (or "v->type - VEH_Train/0x10 as the code still used in some places) Surprisingly this can be done without changing the savegame format
This commit is contained in:
@@ -160,10 +160,10 @@ void AssignOrder(Order *order, Order data)
|
||||
*/
|
||||
static void DeleteOrderWarnings(const Vehicle* v)
|
||||
{
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_TOO_FEW_ORDERS + (v->type - VEH_Train) * 4);
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_VOID_ORDER + (v->type - VEH_Train) * 4);
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_DUPLICATE_ENTRY + (v->type - VEH_Train) * 4);
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_INVALID_ENTRY + (v->type - VEH_Train) * 4);
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_TOO_FEW_ORDERS + v->type * 4);
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_VOID_ORDER + v->type * 4);
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_DUPLICATE_ENTRY + v->type * 4);
|
||||
DeleteVehicleNews(v->index, STR_TRAIN_HAS_INVALID_ENTRY + v->type * 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -1005,7 +1005,7 @@ void CheckOrders(const Vehicle* v)
|
||||
/* We don't have a problem */
|
||||
if (problem_type < 0) return;
|
||||
|
||||
message = STR_TRAIN_HAS_TOO_FEW_ORDERS + ((v->type - VEH_Train) << 2) + problem_type;
|
||||
message = STR_TRAIN_HAS_TOO_FEW_ORDERS + (v->type << 2) + problem_type;
|
||||
//DEBUG(misc, 3, "Triggered News Item for vehicle %d", v->index);
|
||||
|
||||
SetDParam(0, v->unitnumber);
|
||||
|
Reference in New Issue
Block a user