(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:
@@ -163,7 +163,7 @@ static inline EngineID GetFirstEngineOfType(byte type)
|
||||
{
|
||||
const EngineID start[] = {0, ROAD_ENGINES_INDEX, SHIP_ENGINES_INDEX, AIRCRAFT_ENGINES_INDEX};
|
||||
|
||||
return start[VehTypeToIndex(type)];
|
||||
return start[type];
|
||||
}
|
||||
|
||||
static inline EngineID GetLastEngineOfType(byte type)
|
||||
@@ -174,7 +174,7 @@ static inline EngineID GetLastEngineOfType(byte type)
|
||||
SHIP_ENGINES_INDEX + NUM_SHIP_ENGINES,
|
||||
AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES};
|
||||
|
||||
return end[VehTypeToIndex(type)];
|
||||
return end[type];
|
||||
}
|
||||
|
||||
VARDEF Engine _engines[TOTAL_NUM_ENGINES];
|
||||
|
Reference in New Issue
Block a user