Files
@ r15899:3bbe04d427d2
Branch filter:
Location: cpp/openttd-patchpack/source/src/vehicle_type.h - annotation
r15899:3bbe04d427d2
2.8 KiB
text/x-c
(svn r20593) -Fix: (rlongago, r20547): long ago the service interval was int16, after which is got converted to Date except in the order backup. Much later I copied the savegame snippets from a vehicle and applied that on the order backup. Presto, reading/writing 32 bits (of Date) into 16 bits of ancient style service interval. That would then "spoil" the name pointer and that eventually crashes OpenTTD as it's likely to be an invalid pointer.
r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r15882:30fbd9be7c68 r8108:1d5bdeea7e20 r12513:4e8212c376c5 r8108:1d5bdeea7e20 r12513:4e8212c376c5 r12513:4e8212c376c5 r12513:4e8212c376c5 r12513:4e8212c376c5 r12513:4e8212c376c5 r12513:4e8212c376c5 r8108:1d5bdeea7e20 r12513:4e8212c376c5 r8108:1d5bdeea7e20 r14900:c679fdaeebe6 r15027:bb71fdfcc554 r12016:12cc374b77e8 r12016:12cc374b77e8 r8108:1d5bdeea7e20 r8108:1d5bdeea7e20 r11980:193f7a6b6e37 r11980:193f7a6b6e37 r11980:193f7a6b6e37 r11980:193f7a6b6e37 r12109:90df01928018 r12109:90df01928018 r8108:1d5bdeea7e20 r8144:1432edd15267 r8144:1432edd15267 r8144:1432edd15267 r8144:1432edd15267 r8144:1432edd15267 r15882:30fbd9be7c68 r8144:1432edd15267 r8551:25fc15391278 r15173:a59afd6301a6 r13823:717ccb00ab59 r8551:25fc15391278 r8551:25fc15391278 r8551:25fc15391278 r8551:25fc15391278 r11363:6906c490a00e r11363:6906c490a00e r8891:a036f0390625 r8891:a036f0390625 r8891:a036f0390625 r8891:a036f0390625 r8891:a036f0390625 r8891:a036f0390625 r8891:a036f0390625 r8891:a036f0390625 r15173:a59afd6301a6 r15173:a59afd6301a6 r9913:5ef437117969 r14396:0e22f6ee524f r14396:0e22f6ee524f r14396:0e22f6ee524f r14396:0e22f6ee524f r10901:d21ccd8648fa r10901:d21ccd8648fa r8108:1d5bdeea7e20 | /* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file vehicle_type.h Types related to vehicles. */
#ifndef VEHICLE_TYPE_H
#define VEHICLE_TYPE_H
#include "core/enum_type.hpp"
typedef uint32 VehicleID;
/** Available vehicle types. */
enum VehicleType {
VEH_TRAIN, ///< %Train vehicle type.
VEH_ROAD, ///< Road vehicle type.
VEH_SHIP, ///< %Ship vehicle type.
VEH_AIRCRAFT, ///< %Aircraft vehicle type.
VEH_EFFECT, ///< Effect vehicle type (smoke, explosions, sparks, bubbles)
VEH_DISASTER, ///< Disaster vehicle type.
VEH_END,
VEH_INVALID = 0xFF, ///< Non-existing type of vehicle.
};
DECLARE_POSTFIX_INCREMENT(VehicleType)
template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID, 3> {};
/** It needs to be 8bits, because we save and load it as such */
typedef SimpleTinyEnumT<VehicleType, byte> VehicleTypeByte;
struct Vehicle;
struct Train;
struct RoadVehicle;
struct Ship;
struct Aircraft;
struct EffectVehicle;
struct DisasterVehicle;
struct BaseVehicle
{
VehicleTypeByte type; ///< Type of vehicle
};
static const VehicleID INVALID_VEHICLE = 0xFFFFF; ///< Constant representing a non-existing vehicle.
/** Pathfinding option states */
enum VehiclePathFinders {
VPF_OPF = 0, ///< The Original PathFinder (only for ships)
VPF_NPF = 1, ///< New PathFinder
VPF_YAPF = 2, ///< Yet Another PathFinder
};
/* Flags to add to p2 for goto depot commands
* Note: bits 8-10 are used for VLW flags */
enum DepotCommand {
DEPOT_SERVICE = (1 << 0), ///< The vehicle will leave the depot right after arrival (serivce only)
DEPOT_MASS_SEND = (1 << 1), ///< Tells that it's a mass send to depot command (type in VLW flag)
DEPOT_DONT_CANCEL = (1 << 2), ///< Don't cancel current goto depot command if any
DEPOT_LOCATE_HANGAR = (1 << 3), ///< Find another airport if the target one lacks a hangar
DEPOT_COMMAND_MASK = 0xF,
};
static const uint MAX_LENGTH_VEHICLE_NAME_BYTES = 31; ///< The maximum length of a vehicle name in bytes including '\0'
static const uint MAX_LENGTH_VEHICLE_NAME_PIXELS = 150; ///< The maximum length of a vehicle name in pixels
/** Vehicle acceleration models. */
enum AccelerationModel {
AM_ORIGINAL,
AM_REALISTIC,
};
#endif /* VEHICLE_TYPE_H */
|