(svn r26130) -Codechange: add some guards against using invalid image indices

This commit is contained in:
rubidium
2013-11-26 16:08:58 +00:00
parent f84b67ea73
commit a498a56573
7 changed files with 87 additions and 6 deletions

View File

@@ -29,6 +29,15 @@
static const int VEHICLE_PROFIT_MIN_AGE = DAYS_IN_YEAR * 2; ///< Only vehicles older than this have a meaningful profit.
static const Money VEHICLE_PROFIT_THRESHOLD = 10000; ///< Threshold for a vehicle to be considered making good profit.
/**
* Helper to check whether an image index is valid for a particular vehicle.
* @param <T> The type of vehicle.
* @param image_index The image index to check.
* @return True iff the image index is valid.
*/
template <VehicleType T>
bool IsValidImageIndex(uint8 image_index);
typedef Vehicle *VehicleFromPosProc(Vehicle *v, void *data);
void VehicleServiceInDepot(Vehicle *v);