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