2008-03-28 18:00:38 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-03-28 18:00:38 +00:00
|
|
|
/** @file engine_type.h Types related to engines. */
|
|
|
|
|
|
|
|
#ifndef ENGINE_TYPE_H
|
|
|
|
#define ENGINE_TYPE_H
|
|
|
|
|
|
|
|
#include "rail_type.h"
|
|
|
|
#include "cargo_type.h"
|
|
|
|
#include "vehicle_type.h"
|
|
|
|
#include "gfx_type.h"
|
|
|
|
#include "date_type.h"
|
|
|
|
#include "sound_type.h"
|
2008-09-30 20:51:04 +00:00
|
|
|
#include "company_type.h"
|
2008-03-28 18:00:38 +00:00
|
|
|
#include "strings_type.h"
|
|
|
|
|
|
|
|
typedef uint16 EngineID;
|
|
|
|
|
2008-04-29 21:31:29 +00:00
|
|
|
struct Engine;
|
|
|
|
|
2008-03-28 18:00:38 +00:00
|
|
|
enum RailVehicleTypes {
|
|
|
|
RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive
|
|
|
|
RAILVEH_MULTIHEAD, ///< indicates a combination of two locomotives
|
|
|
|
RAILVEH_WAGON, ///< simple wagon, not motorized
|
|
|
|
};
|
|
|
|
|
|
|
|
enum EngineClass {
|
|
|
|
EC_STEAM,
|
|
|
|
EC_DIESEL,
|
|
|
|
EC_ELECTRIC,
|
|
|
|
EC_MONORAIL,
|
|
|
|
EC_MAGLEV,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RailVehicleInfo {
|
|
|
|
byte image_index;
|
|
|
|
RailVehicleTypes railveh_type;
|
2008-08-15 17:54:43 +00:00
|
|
|
byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices.
|
2008-03-28 18:00:38 +00:00
|
|
|
RailTypeByte railtype;
|
|
|
|
uint16 max_speed;
|
2008-07-26 22:00:59 +00:00
|
|
|
uint16 power; ///< Power of engine; For multiheaded engines the sum of both engine powers.
|
|
|
|
uint16 weight; ///< Weight of vehicle; For multiheaded engines the weight of each single engine.
|
|
|
|
byte running_cost; ///< Running cost of engine; For multiheaded engines the sum of both running costs.
|
2008-03-28 18:00:38 +00:00
|
|
|
byte running_cost_class;
|
|
|
|
EngineClass engclass; ///< Class of engine for this vehicle
|
2008-07-26 22:00:59 +00:00
|
|
|
byte capacity; ///< Cargo capacity of vehicle; For multiheaded engines the capacity of each single engine.
|
2009-03-25 14:03:29 +00:00
|
|
|
byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only
|
|
|
|
uint16 pow_wag_power; ///< Extra power applied to consist if wagon should be powered
|
|
|
|
byte pow_wag_weight; ///< Extra weight applied to consist if wagon should be powered
|
|
|
|
byte visual_effect; ///< Bitstuffed NewGRF visual effect data
|
|
|
|
byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor
|
|
|
|
byte tractive_effort; ///< Tractive effort coefficient
|
|
|
|
byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
|
2008-03-28 18:00:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ShipVehicleInfo {
|
|
|
|
byte image_index;
|
2008-08-15 17:54:43 +00:00
|
|
|
byte cost_factor;
|
2008-03-28 18:00:38 +00:00
|
|
|
uint16 max_speed;
|
|
|
|
uint16 capacity;
|
|
|
|
byte running_cost;
|
2009-05-17 17:17:48 +00:00
|
|
|
SoundID sfx;
|
2008-03-28 18:00:38 +00:00
|
|
|
bool refittable;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* AircraftVehicleInfo subtypes, bitmask type.
|
|
|
|
* If bit 0 is 0 then it is a helicopter, otherwise it is a plane
|
|
|
|
* in which case bit 1 tells us whether it's a big(fast) plane or not */
|
|
|
|
enum {
|
|
|
|
AIR_HELI = 0,
|
|
|
|
AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes
|
|
|
|
AIR_FAST = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AircraftVehicleInfo {
|
|
|
|
byte image_index;
|
2008-08-15 17:54:43 +00:00
|
|
|
byte cost_factor;
|
2008-03-28 18:00:38 +00:00
|
|
|
byte running_cost;
|
|
|
|
byte subtype;
|
2009-05-17 17:17:48 +00:00
|
|
|
SoundID sfx;
|
2008-03-28 18:00:38 +00:00
|
|
|
byte acceleration;
|
|
|
|
uint16 max_speed;
|
|
|
|
byte mail_capacity;
|
|
|
|
uint16 passenger_capacity;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RoadVehicleInfo {
|
|
|
|
byte image_index;
|
2008-08-15 17:54:43 +00:00
|
|
|
byte cost_factor;
|
2008-03-28 18:00:38 +00:00
|
|
|
byte running_cost;
|
|
|
|
byte running_cost_class;
|
2009-05-17 17:17:48 +00:00
|
|
|
SoundID sfx;
|
2009-01-06 14:45:38 +00:00
|
|
|
uint16 max_speed; ///< Maximum speed in mph/3.2 units
|
2008-03-28 18:00:38 +00:00
|
|
|
byte capacity;
|
2009-02-02 21:52:34 +00:00
|
|
|
uint8 weight; ///< Weight in 1/4t units
|
|
|
|
uint8 power; ///< Power in 10hp units
|
|
|
|
uint8 tractive_effort; ///< Coefficient of tractive effort
|
|
|
|
uint8 air_drag; ///< Coefficient of air drag
|
2008-03-28 18:00:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Information about a vehicle
|
|
|
|
* @see table/engines.h
|
|
|
|
*/
|
|
|
|
struct EngineInfo {
|
|
|
|
Date base_intro;
|
|
|
|
Year lifelength;
|
|
|
|
Year base_life;
|
2008-06-05 12:08:20 +00:00
|
|
|
byte decay_speed;
|
2008-03-28 18:00:38 +00:00
|
|
|
byte load_amount;
|
|
|
|
byte climates;
|
2009-08-17 18:33:48 +00:00
|
|
|
CargoID cargo_type;
|
2008-03-28 18:00:38 +00:00
|
|
|
uint32 refit_mask;
|
|
|
|
byte refit_cost;
|
|
|
|
byte misc_flags;
|
2009-09-14 12:22:57 +00:00
|
|
|
byte callback_mask; ///< Bitmask of vehicle callbacks that have to be called
|
2008-03-28 18:00:38 +00:00
|
|
|
int8 retire_early; ///< Number of years early to retire vehicle
|
|
|
|
StringID string_id; ///< Default name of engine
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* EngineInfo.misc_flags is a bitmask, with the following values
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves
|
|
|
|
EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle
|
|
|
|
EF_USES_2CC = 1, ///< Vehicle uses two company colours
|
|
|
|
EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU)
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Engine.flags is a bitmask, with the following values.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
ENGINE_AVAILABLE = 1, ///< This vehicle is available to everyone.
|
2008-09-30 20:39:50 +00:00
|
|
|
ENGINE_EXCLUSIVE_PREVIEW = 2, ///< This vehicle is in the exclusive preview stage, either being used or being offered to a company.
|
|
|
|
ENGINE_OFFER_WINDOW_OPEN = 4, ///< The exclusive offer window is currently open for a company.
|
2008-03-28 18:00:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2008-08-13 06:05:01 +00:00
|
|
|
NUM_VEHICLE_TYPES = 6,
|
|
|
|
MAX_LENGTH_ENGINE_NAME_BYTES = 31, ///< The maximum length of an engine name in bytes including '\0'
|
|
|
|
MAX_LENGTH_ENGINE_NAME_PIXELS = 160, ///< The maximum length of an engine name in pixels
|
2008-03-28 18:00:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const EngineID INVALID_ENGINE = 0xFFFF;
|
|
|
|
|
|
|
|
#endif /* ENGINE_TYPE_H */
|