Loading

Paste #pztziyhiv

  1. /******************************/
  2.    ENGINES.H
  3. /******************************/
  4. /**
  5.  * Writes the properties of a road vehicle into the RoadVehicleInfo struct.
  6.  * @see RoadVehicleInfo
  7.  * @param a image_index
  8.  * @param b cost_factor
  9.  * @param c running_cost
  10.  * @param d sound effect
  11.  * @param e max_speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
  12.  * @param f capacity (persons, bags, tons, pieces, items, cubic metres, ...)
  13.  * @param g weight (1/4 ton)
  14.  * @param h power (10 hp)
  15.  * @param i roadtype
  16.  * Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
  17.  * Air drag value depends on the top speed of the vehicle.
  18.  */
  19. #define ROV(a, b, c, d, e, f, g, h, i) { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT, 0, i }
  20. #define R ROADTYPE_ROAD
  21. #define T ROADTYPE_TRAM
  22. static const RoadVehicleInfo _orig_road_vehicle_info[] = {
  23.     /*    image_index       sfx                                 max_speed    power
  24.      *    |    cost_factor  |                                   |   capacity |  roadtype
  25.      *    |    |    running_cost                                |   |    weight |
  26.      *    |    |    |       |                                   |   |    |   |  |*/
  27.     ROV(  0, 120,  91, SND_19_BUS_START_PULL_AWAY,            112, 31,  42,  9, R), //  0 MPS Regal Bus
  28.  
  29.  
  30. /******************************/
  31.    ENGINE_TYPE.H
  32. /******************************/
  33.  
  34. /** Information about a road vehicle. */
  35. struct RoadVehicleInfo {
  36.     byte image_index;
  37.     byte cost_factor;
  38.     byte running_cost;
  39.     Price running_cost_class;
  40.     SoundID sfx;
  41.     uint16 max_speed;        ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
  42.     byte capacity;
  43.     uint8 weight;            ///< Weight in 1/4t units
  44.     uint8 power;             ///< Power in 10hp units
  45.     uint8 tractive_effort;   ///< Coefficient of tractive effort
  46.     uint8 air_drag;          ///< Coefficient of air drag
  47.     byte visual_effect;      ///< Bitstuffed NewGRF visual effect data
  48.     byte shorten_factor;     ///< length on main map for this type is 8 - shorten_factor
  49.     RoadTypeByte roadtype;
  50. };
  51.  
  52.  
  53. /******************************/
  54.    NEWGRF.CPP
  55. /******************************/
  56.  
  57.         EngineInfo *ei = &e->info;
  58.         RoadVehicleInfo *rvi = &e->u.road;
  59.         rvi->roadtype = ROADTYPE_ROAD; // default <- get from proper newgrfspec

Comments