# engine_type.h

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef ENGINE_TYPE_H
    00013 #define ENGINE_TYPE_H
    00014
    00015 #include "economy_type.h"
    00016 #include "rail_type.h"
    00017 #include "cargo_type.h"
    00018 #include "date_type.h"
    00019 #include "sound_type.h"
    00020 #include "strings_type.h"
    00021
    00022 typedef uint16 EngineID;
    00023
    00024 struct Engine;
    00025
    00026 enum RailVehicleTypes {
    00027   RAILVEH_SINGLEHEAD,
    00028   RAILVEH_MULTIHEAD,
    00029   RAILVEH_WAGON,
    00030 };
    00031
    00032 enum EngineClass {
    00033   EC_STEAM,
    00034   EC_DIESEL,
    00035   EC_ELECTRIC,
    00036   EC_MONORAIL,
    00037   EC_MAGLEV,
    00038 };
    00039
    00040 struct RailVehicleInfo {
    00041   byte image_index;
    00042   RailVehicleTypes railveh_type;
    00043   byte cost_factor;
    00044   RailTypeByte railtype;
    00045   uint16 max_speed;
    00046   uint16 power;
    00047   uint16 weight;
    00048   byte running_cost;
    00049   Price running_cost_class;
    00050   EngineClass engclass;
    00051   byte capacity;
    00052   byte ai_passenger_only;
    00053   uint16 pow_wag_power;
    00054   byte pow_wag_weight;
    00055   byte visual_effect;
    00056   byte shorten_factor;
    00057   byte tractive_effort;
    00058   byte air_drag;
    00059   byte user_def_data;
    00060 };
    00061
    00062 struct ShipVehicleInfo {
    00063   byte image_index;
    00064   byte cost_factor;
    00065   uint16 max_speed;
    00066   uint16 capacity;
    00067   byte running_cost;
    00068   SoundID sfx;
    00069   bool old_refittable;
    00070   byte visual_effect;
    00071 };
    00072
    00073 /* AircraftVehicleInfo subtypes, bitmask type.
    00074  * If bit 0 is 0 then it is a helicopter, otherwise it is a plane
    00075  * in which case bit 1 tells us whether it's a big(fast) plane or not */
    00076 enum AircraftSubTypeBits {
    00077   AIR_HELI = 0,
    00078   AIR_CTOL = 1,
    00079   AIR_FAST = 2
    00080 };
    00081
    00082 struct AircraftVehicleInfo {
    00083   byte image_index;
    00084   byte cost_factor;
    00085   byte running_cost;
    00086   byte subtype;
    00087   SoundID sfx;
    00088   byte acceleration;
    00089   uint16 max_speed;
    00090   byte mail_capacity;
    00091   uint16 passenger_capacity;
    00092 };
    00093
    00094 struct RoadVehicleInfo {
    00095   byte image_index;
    00096   byte cost_factor;
    00097   byte running_cost;
    00098   Price running_cost_class;
    00099   SoundID sfx;
    00100   uint16 max_speed;
    00101   byte capacity;
    00102   uint8 weight;
    00103   uint8 power;
    00104   uint8 tractive_effort;
    00105   uint8 air_drag;
    00106   byte visual_effect;
    00107 };
    00108
    00113 struct EngineInfo {
    00114   Date base_intro;
    00115   Year lifelength;
    00116   Year base_life;
    00117   byte decay_speed;
    00118   byte load_amount;
    00119   byte climates;
    00120   CargoID cargo_type;
    00121   uint32 refit_mask;
    00122   byte refit_cost;
    00123   byte misc_flags;
    00124   byte callback_mask;
    00125   int8 retire_early;
    00126   StringID string_id;
    00127 };
    00128
    00132 enum EngineMiscFlags {
    00133   EF_RAIL_TILTS = 0,
    00134   EF_ROAD_TRAM  = 0,
    00135   EF_USES_2CC   = 1,
    00136   EF_RAIL_IS_MU = 2,
    00137   EF_RAIL_FLIPS = 3,
    00138 };
    00139
    00143 enum EngineFlags {
    00144   ENGINE_AVAILABLE         = 1,
    00145   ENGINE_EXCLUSIVE_PREVIEW = 2,
    00146   ENGINE_OFFER_WINDOW_OPEN = 4,
    00147 };
    00148
    00149 static const uint NUM_VEHICLE_TYPES             =   6;
    00150 static const uint MAX_LENGTH_ENGINE_NAME_CHARS  =  32;
    00151 static const uint MAX_LENGTH_ENGINE_NAME_PIXELS = 160;
    00152
    00153 static const EngineID INVALID_ENGINE = 0xFFFF;
    00154
    00155 #endif /* ENGINE_TYPE_H */