diff options
author | rubidium <rubidium@openttd.org> | 2013-11-26 16:08:58 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-11-26 16:08:58 +0000 |
commit | d2ba772f6a9e6339b28faf62c3163d33de1498b3 (patch) | |
tree | 19e25a79a8dbe70c7eb21455984c401f72531068 /src/vehicle_func.h | |
parent | 7abe85d72715f91ab309a3aaa18572a8964b189c (diff) | |
download | openttd-d2ba772f6a9e6339b28faf62c3163d33de1498b3.tar.xz |
(svn r26130) -Codechange: add some guards against using invalid image indices
Diffstat (limited to 'src/vehicle_func.h')
-rw-r--r-- | src/vehicle_func.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vehicle_func.h b/src/vehicle_func.h index 758ad8305..757f1b6e6 100644 --- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -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); |