Loading

Paste #pjwi4vlhg

  1. Index: source.list
  2. ===================================================================
  3. --- source.list (revision 22430)
  4. +++ source.list (working copy)
  5. @@ -302,6 +302,7 @@
  6.  rail_gui.h
  7.  rail_type.h
  8.  rev.h
  9. +road.h
  10.  road_cmd.h
  11.  road_func.h
  12.  road_gui.h
  13. @@ -659,6 +660,7 @@
  14.  table/pricebase.h
  15.  table/railtypes.h
  16.  table/road_land.h
  17. +table/roadtypes.h
  18.  table/roadveh_movement.h
  19.  ../objs/settings/table/settings.h
  20.  table/sprites.h
  21. Index: src/bridge_map.h
  22. ===================================================================
  23. --- src/bridge_map.h    (revision 22431)
  24. +++ src/bridge_map.h    (working copy)
  25. @@ -116,30 +116,30 @@
  26.     SetBit(_m[t].type, 2 + a);
  27.  }
  28.  
  29. -/**
  30. - * Set wether a bridge has a catenary or not.
  31. - * @param t the tile with the bridge
  32. - * @pre IsBridgeTile(t)
  33. - */
  34. -static inline void SetBridgeRoadTramCatenary(TileIndex t, bool b)
  35. -{
  36. -   assert(IsBridgeTile(t));
  37. -   SB(_m[t].m1, 7, 1, b ? 1 : 0);
  38. -}
  39. -
  40. -/**
  41. - * Checks if given bridge has catenary bit.
  42. - * @param t the bridge ramp tile
  43. - * @pre IsBridgeTile(t)
  44. - * @return True if bridge has catenary bit set
  45. - */
  46. -static inline bool HasBridgeRoadTramCatenary(TileIndex t)
  47. -{
  48. -   assert(IsBridgeTile(t));
  49. -   return GB(_m[t].m1, 7, 1) != 0;
  50. +/**
  51. + * Set wether a bridge has a catenary or not.
  52. + * @param t the tile with the bridge
  53. + * @pre IsBridgeTile(t)
  54. + */
  55. +static inline void SetBridgeRoadTramCatenary(TileIndex t, bool b)
  56. +{
  57. +   assert(IsBridgeTile(t));
  58. +   SB(_m[t].m1, 7, 1, b ? 1 : 0);
  59.  }
  60.  
  61.  /**
  62. + * Checks if given bridge has catenary bit.
  63. + * @param t the bridge ramp tile
  64. + * @pre IsBridgeTile(t)
  65. + * @return True if bridge has catenary bit set
  66. + */
  67. +static inline bool HasBridgeRoadTramCatenary(TileIndex t)
  68. +{
  69. +   assert(IsBridgeTile(t));
  70. +   return GB(_m[t].m1, 7, 1) != 0;
  71. +}
  72. +
  73. +/**
  74.   * Generic part to make a bridge ramp for both roads and rails.
  75.   * @param t          the tile to make a bridge ramp
  76.   * @param o          the new owner of the bridge ramp
  77. Index: src/engine_type.h
  78. ===================================================================
  79. --- src/engine_type.h   (revision 22430)
  80. +++ src/engine_type.h   (working copy)
  81. @@ -14,6 +14,7 @@
  82.  
  83.  #include "economy_type.h"
  84.  #include "rail_type.h"
  85. +#include "road_type.h"
  86.  #include "cargo_type.h"
  87.  #include "date_type.h"
  88.  #include "sound_type.h"
  89. @@ -123,6 +124,7 @@
  90.     uint8 air_drag;          ///< Coefficient of air drag
  91.     byte visual_effect;      ///< Bitstuffed NewGRF visual effect data
  92.     byte shorten_factor;     ///< length on main map for this type is 8 - shorten_factor
  93. +   RoadTypeByte roadtype;
  94.  };
  95.  
  96.  /**
  97. Index: src/lang/english.txt
  98. ===================================================================
  99. --- src/lang/english.txt    (revision 22430)
  100. +++ src/lang/english.txt    (working copy)
  101. @@ -2407,6 +2407,9 @@
  102.  STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD           :{BLACK}Toggle build/remove for road construction
  103.  STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS       :{BLACK}Toggle build/remove for tramway construction
  104.  
  105. +STR_ROAD_NAME_ROAD                                              :Road
  106. +STR_ROAD_NAME_TRAM                                              :Tramway
  107. +
  108.  # Road depot construction window
  109.  STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION                        :{WHITE}Road Depot Orientation
  110.  STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP                 :{BLACK}Select road vehicle depot orientation
  111. Index: src/road.cpp
  112. ===================================================================
  113. --- src/road.cpp    (revision 22430)
  114. +++ src/road.cpp    (working copy)
  115. @@ -152,3 +152,29 @@
  116.  
  117.     return rt;
  118.  }
  119. +
  120. +/**
  121. + * Get the road type for a given label.
  122. + * @param label the roadtype label.
  123. + * @param allow_alternate_labels Search in the alternate label lists as well.
  124. + * @return the roadtype.
  125. + */
  126. +RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels)
  127. +{
  128. +   /* Loop through each road type until the label is found */
  129. +   for (RoadType r = ROADTYPE_BEGIN; r != ROADTYPE_END; r++) {
  130. +       const RoadtypeInfo *rti = GetRoadTypeInfo(r);
  131. +       if (rti->label == label) return r;
  132. +   }
  133. +
  134. +   if (allow_alternate_labels) {
  135. +       /* Test if any road type defines the label as an alternate. */
  136. +       for (RoadType r = ROADTYPE_BEGIN; r != ROADTYPE_END; r++) {
  137. +           const RoadtypeInfo *rti = GetRoadTypeInfo(r);
  138. +           if (rti->alternate_labels.Contains(label)) return r;
  139. +       }
  140. +   }
  141. +
  142. +   /* No matching label was found, so it is invalid */
  143. +   return INVALID_ROADTYPE;
  144. +}
  145. Index: src/road.h
  146. ===================================================================
  147. --- src/road.h  (nonexistent)
  148. +++ src/road.h  (working copy)
  149. @@ -0,0 +1,175 @@
  150. +/* $Id$ */
  151. +
  152. +/*
  153. + * This file is part of OpenTTD.
  154. + * 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.
  155. + * 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.
  156. + * 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/>.
  157. + */
  158. +
  159. +/** @file road.h Road specific functions. */
  160. +
  161. +#ifndef ROAD_H
  162. +#define ROAD_H
  163. +
  164. +#include "road_type.h"
  165. +
  166. +/** Roadtype flags. Starts with RO instead of R because R is used for roads */
  167. +enum RoadTypeFlags {
  168. +   ROTF_CATENARY = 7,                   ///< Bit number for adding catenary
  169. +
  170. +   ROTFB_NONE = 0,                      ///< All flags cleared.
  171. +   ROTFB_CATENARY = 1 << ROTF_CATENARY, ///< Value for drawing a catenary.
  172. +};
  173. +DECLARE_ENUM_AS_BIT_SET(RoadTypeFlags)
  174. +
  175. +/** List of road type labels. */
  176. +typedef SmallVector<RoadTypeLabel, 4> RoadTypeLabelList;
  177. +
  178. +struct RoadtypeInfo {
  179. +   struct {
  180. +       StringID name;            ///< Name of this rail type.
  181. +       StringID toolbar_caption; ///< Caption in the construction toolbar GUI for this rail type.
  182. +       StringID menu_text;       ///< Name of this rail type in the main toolbar dropdown.
  183. +       StringID build_caption;   ///< Caption of the build vehicle GUI for this rail type.
  184. +       StringID replace_text;    ///< Text used in the autoreplace GUI.
  185. +       StringID new_loco;        ///< Name of an engine for this type of rail in the engine preview GUI.
  186. +   } strings;                        ///< Strings associated with the rail type.
  187. +
  188. +
  189. +   /** bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype generates power */
  190. +   RoadTypes powered_roadtypes;
  191. +
  192. +   /** bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype can physically travel */
  193. +   RoadTypes compatible_roadtypes;
  194. +
  195. +   /**
  196. +    * Bridge offset
  197. +    */
  198. +   SpriteID bridge_offset;
  199. +
  200. +   /**
  201. +    * Original roadtype number to use when drawing non-newgrf roadtypes, or when drawing stations.
  202. +    */
  203. +   byte fallback_roadtype;
  204. +
  205. +   /**
  206. +    * Multiplier for curve maximum speed advantage
  207. +    */
  208. +   byte curve_speed;
  209. +
  210. +   /**
  211. +    * Bit mask of road type flags
  212. +    */
  213. +   RoadTypeFlags flags;
  214. +
  215. +   /**
  216. +    * Cost multiplier for building this road type
  217. +    */
  218. +   uint16 cost_multiplier;
  219. +
  220. +   /**
  221. +    * Cost multiplier for maintenance of this road type
  222. +    */
  223. +   uint16 maintenance_multiplier;
  224. +
  225. +   /**
  226. +    * Maximum speed for vehicles travelling on this road type
  227. +    */
  228. +   uint16 max_speed;
  229. +
  230. +   /**
  231. +    * Unique 32 bit road type identifier
  232. +    */
  233. +   RoadTypeLabel label;
  234. +
  235. +   /**
  236. +    * Road type labels this type provides in addition to the main label.
  237. +    */
  238. +   RoadTypeLabelList alternate_labels;
  239. +
  240. +   /**
  241. +    * Colour on mini-map
  242. +    */
  243. +   byte map_colour;
  244. +
  245. +   /**
  246. +    * Introduction date.
  247. +    * When #INVALID_DATE or a vehicle using this roadtype gets introduced earlier,
  248. +    * the vehicle's introduction date will be used instead for this roadtype.
  249. +    * The introduction at this date is furthermore limited by the
  250. +    * #introduction_required_types.
  251. +    */
  252. +   Date introduction_date;
  253. +
  254. +   /**
  255. +    * Bitmask of roadtypes that are required for this roadtype to be introduced
  256. +    * at a given #introduction_date.
  257. +    */
  258. +   RoadTypes introduction_required_roadtypes;
  259. +
  260. +   /**
  261. +    * Bitmask of which other roadtypes are introduced when this roadtype is introduced.
  262. +    */
  263. +   RoadTypes introduces_roadtypes;
  264. +
  265. +   /**
  266. +    * The sorting order of this roadtype for the toolbar dropdown.
  267. +    */
  268. +   byte sorting_order;
  269. +};
  270. +
  271. +/**
  272. + * Returns a pointer to the Roadtype information for a given roadtype
  273. + * @param roadtype the road type which the information is requested for
  274. + * @return The pointer to the RoadtypeInfo
  275. + */
  276. +static inline const RoadtypeInfo *GetRoadTypeInfo(RoadType roadtype)
  277. +{
  278. +   extern RoadtypeInfo _roadtypes[ROADTYPE_END];
  279. +   assert(roadtype < ROADTYPE_END);
  280. +   return &_roadtypes[roadtype];
  281. +}
  282. +
  283. +/**
  284. + * Checks if an engine of the given RoadType can drive on a tile with a given
  285. + * RoadType. This would normally just be an equality check, but for electrified
  286. + * roads (which also support non-electric vehicles).
  287. + * @return Whether the engine can drive on this tile.
  288. + * @param  vehicletype The RoadType of the engine we are considering.
  289. + * @param  tiletype   The RoadType of the tile we are considering.
  290. + */
  291. +static inline bool IsCompatibleRoad(RoadType vehicletype, RoadType tiletype)
  292. +{
  293. +   return HasBit(GetRoadTypeInfo(vehicletype)->compatible_roadtypes, tiletype);
  294. +}
  295. +
  296. +/**
  297. + * Checks if an engine of the given RoadType got power on a tile with a given
  298. + * RoadType. This would normally just be an equality check, but for electrified
  299. + * roads (which also support non-electric vehicles).
  300. + * @return Whether the engine got power on this tile.
  301. + * @param  vehicletype The RoadType of the engine we are considering.
  302. + * @param  tiletype   The RoadType of the tile we are considering.
  303. + */
  304. +static inline bool HasPowerOnRoad(RoadType vehicletype, RoadType tiletype)
  305. +{
  306. +   return HasBit(GetRoadTypeInfo(vehicletype)->powered_roadtypes, tiletype);
  307. +}
  308. +
  309. +RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels = true);
  310. +
  311. +void ResetRoadTypes();
  312. +void InitRoadTypes();
  313. +RoadType AllocateRoadType(RoadTypeLabel label);
  314. +
  315. +extern RoadType _sorted_roadtypes[ROADTYPE_END];
  316. +extern uint8 _sorted_roadtypes_size;
  317. +
  318. +/**
  319. + * Loop header for iterating over roadtypes, sorted by sortorder.
  320. + * @param var Roadtype.
  321. + */
  322. +#define FOR_ALL_SORTED_ROADTYPES(var) for (uint8 index = 0; index < _sorted_roadtypes_size && (var = _sorted_roadtypes[index], true) ; index++)
  323. +
  324. +#endif /* ROAD_H */
  325. Index: src/road_cmd.cpp
  326. ===================================================================
  327. --- src/road_cmd.cpp    (revision 22431)
  328. +++ src/road_cmd.cpp    (working copy)
  329. @@ -37,10 +37,96 @@
  330.  #include "company_gui.h"
  331.  
  332.  #include "table/strings.h"
  333. +#include "table/roadtypes.h"
  334.  
  335.  #include "safeguards.h"
  336.  
  337. +
  338. +RoadtypeInfo _roadtypes[ROADTYPE_END];
  339. +RoadType _sorted_roadtypes[ROADTYPE_END];
  340. +uint8 _sorted_roadtypes_size;
  341. +
  342. +assert_compile(sizeof(_original_roadtypes) <= sizeof(_roadtypes));
  343. +
  344.  /**
  345. + * Reset all road type information to its default values.
  346. + */
  347. +void ResetRoadTypes()
  348. +{
  349. +   memset(_roadtypes, 0, sizeof(_roadtypes));
  350. +   memcpy(_roadtypes, _original_roadtypes, sizeof(_original_roadtypes));
  351. +}
  352. +
  353. +/**
  354. + * Compare roadtypes based on their sorting order.
  355. + * @param first  The roadtype to compare to.
  356. + * @param second The roadtype to compare.
  357. + * @return True iff the first should be sorted before the second.
  358. + */
  359. +static int CDECL CompareRoadTypes(const RoadType *first, const RoadType *second)
  360. +{
  361. +   return GetRoadTypeInfo(*first)->sorting_order - GetRoadTypeInfo(*second)->sorting_order;
  362. +}
  363. +
  364. +/**
  365. + * Resolve sprites of custom road types
  366. + * TODO: Sprite structure
  367. + */
  368. +void InitRoadTypes()
  369. +{
  370. +   //for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
  371. +   //  RoadtypeInfo *rti = &_roadtypes[rt];
  372. +   //  ResolveRoadTypeGUISprites(rti);
  373. +   //}
  374. +
  375. +   _sorted_roadtypes_size = 0;
  376. +   for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
  377. +       if (_roadtypes[rt].label != 0) {
  378. +           _sorted_roadtypes[_sorted_roadtypes_size++] = rt;
  379. +       }
  380. +   }
  381. +   QSortT(_sorted_roadtypes, _sorted_roadtypes_size, CompareRoadTypes);
  382. +}
  383. +
  384. +/**
  385. + * Allocate a new road type label
  386. + * TODO: newgrf.cpp function RoadTypeReserveInfo
  387. + */
  388. +RoadType AllocateRoadType(RoadTypeLabel label)
  389. +{
  390. +   for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
  391. +       RoadtypeInfo *rti = &_roadtypes[rt];
  392. +
  393. +       if (rti->label == 0) {
  394. +           /* Set up new road type */
  395. +           memcpy(rti, &_roadtypes[ROADTYPE_ROAD], sizeof(*rti));
  396. +           rti->label = label;
  397. +           /* Clear alternate label list. Can't use Reset() here as that would free
  398. +            * the data pointer of ROADTYPE_ROAD and not our new road type. */
  399. +           new (&rti->alternate_labels) RoadTypeLabelList;
  400. +
  401. +           /* Make us compatible with ourself. */
  402. +           rti->powered_roadtypes    = (RoadTypes)(1 << rt);
  403. +           rti->compatible_roadtypes = (RoadTypes)(1 << rt);
  404. +
  405. +           /* We also introduce ourself. */
  406. +           rti->introduces_roadtypes = (RoadTypes)(1 << rt);
  407. +
  408. +           /* Default sort order; order of allocation, but with some
  409. +            * offsets so it's easier for NewGRF to pick a spot without
  410. +            * changing the order of other (original) road types.
  411. +            * The << is so you can place other roadtypes in between the
  412. +            * other roadtypes, the 7 is to be able to place something
  413. +            * before the first (default) road type. */
  414. +           rti->sorting_order = rt << 4 | 7;
  415. +           return rt;
  416. +       }
  417. +   }
  418. +
  419. +   return INVALID_ROADTYPE;
  420. +}
  421. +
  422. +/**
  423.   * Verify whether a road vehicle is available.
  424.   * @return \c true if at least one road vehicle is available, \c false if not
  425.   */
  426. Index: src/road_gui.cpp
  427. ===================================================================
  428. --- src/road_gui.cpp    (revision 22430)
  429. +++ src/road_gui.cpp    (working copy)
  430. @@ -29,6 +29,7 @@
  431.  #include "hotkeys.h"
  432.  #include "road_gui.h"
  433.  #include "zoom_func.h"
  434. +#include "engine_base.h"
  435.  
  436.  #include "widgets/road_widget.h"
  437.  
  438. @@ -1116,3 +1117,46 @@
  439.     _road_depot_orientation = DIAGDIR_NW;
  440.     _road_station_picker_orientation = DIAGDIR_NW;
  441.  }
  442. +
  443. +/**
  444. + * Create a drop down list for all the road types of the local company.
  445. + * @param for_replacement Whether this list is for the replacement window.
  446. + * @return The populated and sorted #DropDownList.
  447. + *
  448. + * TODO: see rail_gui.cpp/GetRailTypeDropDownList() to complete the features for this function
  449. + */
  450. +DropDownList *GetRoadTypeDropDownList(bool for_replacement)
  451. +{
  452. +   /*** Test only, move to NewGRF spec! ***/
  453. +   ResetRoadTypes();
  454. +   InitRoadTypes();
  455. +   /*** Test only, move to NewGRF spec! ***/
  456. +
  457. +   const Company *c = Company::Get(_local_company);
  458. +   DropDownList *list = new DropDownList();
  459. +
  460. +   RoadTypes used_roadtypes = ROADTYPES_NONE;
  461. +   Engine *e;
  462. +   FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
  463. +       if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
  464. +
  465. +       used_roadtypes |= GetRoadTypeInfo(HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)->introduces_roadtypes;
  466. +       break;
  467. +   }
  468. +
  469. +   RoadType rt;
  470. +   FOR_ALL_SORTED_ROADTYPES(rt) {
  471. +       /* If it's not used ever, don't show it to the user. */
  472. +       if (!HasBit(used_roadtypes, rt)) continue;
  473. +
  474. +       const RoadtypeInfo *rti = GetRoadTypeInfo(rt);
  475. +
  476. +       StringID str = for_replacement ? rti->strings.replace_text : (rti->max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING);
  477. +       DropDownListParamStringItem *item = new DropDownListParamStringItem(str, rt, !HasBit(c->avail_roadtypes, rt));
  478. +       item->SetParam(0, rti->strings.menu_text);
  479. +       item->SetParam(1, rti->max_speed);
  480. +       *list->Append() = item;
  481. +   }
  482. +  
  483. +   return list;
  484. +}
  485. Index: src/road_gui.h
  486. ===================================================================
  487. --- src/road_gui.h  (revision 22430)
  488. +++ src/road_gui.h  (working copy)
  489. @@ -15,9 +15,11 @@
  490.  #include "road_type.h"
  491.  #include "tile_type.h"
  492.  #include "direction_type.h"
  493. +#include "widgets/dropdown_type.h"
  494.  
  495.  struct Window *ShowBuildRoadToolbar(RoadType roadtype);
  496.  struct Window *ShowBuildRoadScenToolbar();
  497.  void ConnectRoadToStructure(TileIndex tile, DiagDirection direction);
  498. +DropDownList *GetRoadTypeDropDownList(bool for_replacement = false);
  499.  
  500.  #endif /* ROAD_GUI_H */
  501. Index: src/road_map.h
  502. ===================================================================
  503. --- src/road_map.h  (revision 22431)
  504. +++ src/road_map.h  (working copy)
  505. @@ -17,6 +17,7 @@
  506.  #include "rail_type.h"
  507.  #include "road_func.h"
  508.  #include "tile_map.h"
  509. +#include "road.h"
  510.  
  511.  
  512.  /** The different types of road tiles. */
  513. @@ -305,7 +306,7 @@
  514.  */
  515.  static inline bool HasCatenary(TileIndex t)
  516.  {
  517. -   return GB(_m[t].m1, 7, 1) != 0;
  518. +   return GB(_m[t].m1, ROTF_CATENARY, 1) != 0;
  519.  }
  520.  
  521.  /**
  522. Index: src/road_type.h
  523. ===================================================================
  524. --- src/road_type.h (revision 22430)
  525. +++ src/road_type.h (working copy)
  526. @@ -14,6 +14,11 @@
  527.  
  528.  #include "core/enum_type.hpp"
  529.  
  530. +typedef uint32 RoadTypeLabel;
  531. +
  532. +static const RoadTypeLabel ROAD_TYPE_ROAD = 'ROAD';
  533. +static const RoadTypeLabel ROAD_TYPE_TRAM = 'TRAM';
  534. +
  535.  /**
  536.   * The different roadtypes we support
  537.   *
  538. @@ -28,6 +33,7 @@
  539.  };
  540.  DECLARE_POSTFIX_INCREMENT(RoadType)
  541.  template <> struct EnumPropsT<RoadType> : MakeEnumPropsT<RoadType, byte, ROADTYPE_BEGIN, ROADTYPE_END, INVALID_ROADTYPE, 2> {};
  542. +typedef TinyEnumT<RoadType> RoadTypeByte;
  543.  
  544.  /**
  545.   * The different roadtypes we support, but then a bitmask of them
  546. Index: src/table/engines.h
  547. ===================================================================
  548. --- src/table/engines.h (revision 22430)
  549. +++ src/table/engines.h (working copy)
  550. @@ -653,104 +653,109 @@
  551.   * @param f capacity (persons, bags, tons, pieces, items, cubic metres, ...)
  552.   * @param g weight (1/4 ton)
  553.   * @param h power (10 hp)
  554. + * @param i roadtype
  555.   * Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
  556.   * Air drag value depends on the top speed of the vehicle.
  557.   */
  558. -#define ROV(a, b, c, d, e, f, g, h) { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT, 0 }
  559. +#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 }
  560. +#define R ROADTYPE_ROAD
  561. +#define T ROADTYPE_TRAM
  562.  static const RoadVehicleInfo _orig_road_vehicle_info[] = {
  563.     /*    image_index       sfx                                 max_speed    power
  564. -    *    |    cost_factor  |                                   |   capacity |
  565. -    *    |    |    running_cost                                |   |    weight
  566. -    *    |    |    |       |                                   |   |    |   |*/
  567. -   ROV(  0, 120,  91, SND_19_BUS_START_PULL_AWAY,            112, 31,  42,  9), //  0 MPS Regal Bus
  568. -   ROV( 17, 140, 128, SND_1C_TRUCK_START_2,                  176, 35,  60, 12), //  1 Hereford Leopard Bus
  569. -   ROV( 17, 150, 178, SND_1B_TRUCK_START,                    224, 37,  70, 15), //  2 Foster Bus
  570. -   ROV( 34, 160, 240, SND_1B_TRUCK_START,                    255, 40, 100, 25), //  3 Foster MkII Superbus
  571. -   ROV( 51, 120,  91, SND_3C_COMEDY_CAR,                     112, 30,  42,  9), //  4 Ploddyphut MkI Bus
  572. -   ROV( 51, 140, 171, SND_3E_COMEDY_CAR_2,                   192, 35,  60, 15), //  5 Ploddyphut MkII Bus
  573. -   ROV( 51, 160, 240, SND_3C_COMEDY_CAR,                     240, 38,  90, 25), //  6 Ploddyphut MkIII Bus
  574. -   ROV(  1, 108,  90, SND_19_BUS_START_PULL_AWAY,             96, 20,  38, 12), //  7 Balogh Coal Truck
  575. -   ROV( 18, 128, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22), //  8 Uhl Coal Truck
  576. -   ROV( 35, 138, 240, SND_19_BUS_START_PULL_AWAY,            224, 28,  69, 45), //  9 DW Coal Truck
  577. -   ROV(  2, 115,  90, SND_19_BUS_START_PULL_AWAY,             96, 22,  38, 12), // 10 MPS Mail Truck
  578. -   ROV( 19, 135, 168, SND_19_BUS_START_PULL_AWAY,            176, 28,  48, 22), // 11 Reynard Mail Truck
  579. -   ROV( 36, 145, 240, SND_19_BUS_START_PULL_AWAY,            224, 30,  69, 45), // 12 Perry Mail Truck
  580. -   ROV( 57, 115,  90, SND_3E_COMEDY_CAR_2,                    96, 22,  38, 12), // 13 MightyMover Mail Truck
  581. -   ROV( 57, 135, 168, SND_3C_COMEDY_CAR,                     176, 28,  48, 22), // 14 Powernaught Mail Truck
  582. -   ROV( 57, 145, 240, SND_3E_COMEDY_CAR_2,                   224, 30,  69, 45), // 15 Wizzowow Mail Truck
  583. -   ROV(  3, 110,  90, SND_19_BUS_START_PULL_AWAY,             96, 21,  38, 12), // 16 Witcombe Oil Tanker
  584. -   ROV( 20, 140, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22), // 17 Foster Oil Tanker
  585. -   ROV( 37, 150, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45), // 18 Perry Oil Tanker
  586. -   ROV(  4, 105,  90, SND_19_BUS_START_PULL_AWAY,             96, 14,  38, 12), // 19 Talbott Livestock Van
  587. -   ROV( 21, 130, 168, SND_19_BUS_START_PULL_AWAY,            176, 16,  48, 22), // 20 Uhl Livestock Van
  588. -   ROV( 38, 140, 240, SND_19_BUS_START_PULL_AWAY,            224, 18,  69, 45), // 21 Foster Livestock Van
  589. -   ROV(  5, 107,  90, SND_19_BUS_START_PULL_AWAY,             96, 14,  38, 12), // 22 Balogh Goods Truck
  590. -   ROV( 22, 130, 168, SND_19_BUS_START_PULL_AWAY,            176, 16,  48, 22), // 23 Craighead Goods Truck
  591. -   ROV( 39, 140, 240, SND_19_BUS_START_PULL_AWAY,            224, 18,  69, 45), // 24 Goss Goods Truck
  592. -   ROV(  6, 114,  90, SND_19_BUS_START_PULL_AWAY,             96, 20,  38, 12), // 25 Hereford Grain Truck
  593. -   ROV( 23, 133, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22), // 26 Thomas Grain Truck
  594. -   ROV( 40, 143, 240, SND_19_BUS_START_PULL_AWAY,            224, 30,  69, 45), // 27 Goss Grain Truck
  595. -   ROV(  7, 118,  90, SND_19_BUS_START_PULL_AWAY,             96, 20,  38, 12), // 28 Witcombe Wood Truck
  596. -   ROV( 24, 137, 168, SND_19_BUS_START_PULL_AWAY,            176, 22,  48, 22), // 29 Foster Wood Truck
  597. -   ROV( 41, 147, 240, SND_19_BUS_START_PULL_AWAY,            224, 24,  69, 45), // 30 Moreland Wood Truck
  598. -   ROV(  8, 121,  90, SND_19_BUS_START_PULL_AWAY,             96, 22,  38, 12), // 31 MPS Iron Ore Truck
  599. -   ROV( 25, 140, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22), // 32 Uhl Iron Ore Truck
  600. -   ROV( 42, 150, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45), // 33 Chippy Iron Ore Truck
  601. -   ROV(  9, 112,  90, SND_19_BUS_START_PULL_AWAY,             96, 15,  38, 12), // 34 Balogh Steel Truck
  602. -   ROV( 26, 135, 168, SND_19_BUS_START_PULL_AWAY,            176, 18,  48, 22), // 35 Uhl Steel Truck
  603. -   ROV( 43, 145, 240, SND_19_BUS_START_PULL_AWAY,            224, 20,  69, 45), // 36 Kelling Steel Truck
  604. -   ROV( 10, 145,  90, SND_19_BUS_START_PULL_AWAY,             96, 12,  38, 12), // 37 Balogh Armoured Truck
  605. -   ROV( 27, 170, 168, SND_19_BUS_START_PULL_AWAY,            176, 15,  48, 22), // 38 Uhl Armoured Truck
  606. -   ROV( 44, 180, 240, SND_19_BUS_START_PULL_AWAY,            224, 16,  69, 45), // 39 Foster Armoured Truck
  607. -   ROV( 11, 112,  90, SND_19_BUS_START_PULL_AWAY,             96, 17,  38, 12), // 40 Foster Food Van
  608. -   ROV( 28, 134, 168, SND_19_BUS_START_PULL_AWAY,            176, 20,  48, 22), // 41 Perry Food Van
  609. -   ROV( 45, 144, 240, SND_19_BUS_START_PULL_AWAY,            224, 22,  69, 45), // 42 Chippy Food Van
  610. -   ROV( 12, 112,  90, SND_19_BUS_START_PULL_AWAY,             96, 15,  38, 12), // 43 Uhl Paper Truck
  611. -   ROV( 29, 135, 168, SND_19_BUS_START_PULL_AWAY,            176, 18,  48, 22), // 44 Balogh Paper Truck
  612. -   ROV( 46, 145, 240, SND_19_BUS_START_PULL_AWAY,            224, 20,  69, 45), // 45 MPS Paper Truck
  613. -   ROV( 13, 121,  90, SND_19_BUS_START_PULL_AWAY,             96, 22,  38, 12), // 46 MPS Copper Ore Truck
  614. -   ROV( 30, 140, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22), // 47 Uhl Copper Ore Truck
  615. -   ROV( 47, 150, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45), // 48 Goss Copper Ore Truck
  616. -   ROV( 14, 111,  90, SND_19_BUS_START_PULL_AWAY,             96, 21,  38, 12), // 49 Uhl Water Tanker
  617. -   ROV( 31, 141, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22), // 50 Balogh Water Tanker
  618. -   ROV( 48, 151, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45), // 51 MPS Water Tanker
  619. -   ROV( 15, 118,  90, SND_19_BUS_START_PULL_AWAY,             96, 18,  38, 12), // 52 Balogh Fruit Truck
  620. -   ROV( 32, 148, 168, SND_19_BUS_START_PULL_AWAY,            176, 20,  48, 22), // 53 Uhl Fruit Truck
  621. -   ROV( 49, 158, 240, SND_19_BUS_START_PULL_AWAY,            224, 23,  69, 45), // 54 Kelling Fruit Truck
  622. -   ROV( 16, 117,  90, SND_19_BUS_START_PULL_AWAY,             96, 17,  38, 12), // 55 Balogh Rubber Truck
  623. -   ROV( 33, 147, 168, SND_19_BUS_START_PULL_AWAY,            176, 19,  48, 22), // 56 Uhl Rubber Truck
  624. -   ROV( 50, 157, 240, SND_19_BUS_START_PULL_AWAY,            224, 22,  69, 45), // 57 RMT Rubber Truck
  625. -   ROV( 52, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12), // 58 MightyMover Sugar Truck
  626. -   ROV( 52, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22), // 59 Powernaught Sugar Truck
  627. -   ROV( 52, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45), // 60 Wizzowow Sugar Truck
  628. -   ROV( 53, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12), // 61 MightyMover Cola Truck
  629. -   ROV( 53, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22), // 62 Powernaught Cola Truck
  630. -   ROV( 53, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45), // 63 Wizzowow Cola Truck
  631. -   ROV( 54, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12), // 64 MightyMover Candyfloss Truck
  632. -   ROV( 54, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22), // 65 Powernaught Candyfloss Truck
  633. -   ROV( 54, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45), // 66 Wizzowow Candyfloss Truck
  634. -   ROV( 55, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12), // 67 MightyMover Toffee Truck
  635. -   ROV( 55, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22), // 68 Powernaught Toffee Truck
  636. -   ROV( 55, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45), // 69 Wizzowow Toffee Truck
  637. -   ROV( 56, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12), // 70 MightyMover Toy Van
  638. -   ROV( 56, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22), // 71 Powernaught Toy Van
  639. -   ROV( 56, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45), // 72 Wizzowow Toy Van
  640. -   ROV( 58, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12), // 73 MightyMover Sweet Truck
  641. -   ROV( 58, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22), // 74 Powernaught Sweet Truck
  642. -   ROV( 58, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45), // 75 Wizzowow Sweet Truck
  643. -   ROV( 59, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12), // 76 MightyMover Battery Truck
  644. -   ROV( 59, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22), // 77 Powernaught Battery Truck
  645. -   ROV( 59, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45), // 78 Wizzowow Battery Truck
  646. -   ROV( 60, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12), // 79 MightyMover Fizzy Drink Truck
  647. -   ROV( 60, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22), // 80 Powernaught Fizzy Drink Truck
  648. -   ROV( 60, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45), // 81 Wizzowow Fizzy Drink Truck
  649. -   ROV( 61, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12), // 82 MightyMover Plastic Truck
  650. -   ROV( 61, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22), // 83 Powernaught Plastic Truck
  651. -   ROV( 61, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45), // 84 Wizzowow Plastic Truck
  652. -   ROV( 62, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12), // 85 MightyMover Bubble Truck
  653. -   ROV( 62, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22), // 86 Powernaught Bubble Truck
  654. -   ROV( 62, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45), // 87 Wizzowow Bubble Truck
  655. +    *    |    cost_factor  |                                   |   capacity |  roadtype
  656. +    *    |    |    running_cost                                |   |    weight |
  657. +    *    |    |    |       |                                   |   |    |   |  |*/
  658. +   ROV(  0, 120,  91, SND_19_BUS_START_PULL_AWAY,            112, 31,  42,  9, R), //  0 MPS Regal Bus
  659. +   ROV( 17, 140, 128, SND_1C_TRUCK_START_2,                  176, 35,  60, 12, R), //  1 Hereford Leopard Bus
  660. +   ROV( 17, 150, 178, SND_1B_TRUCK_START,                    224, 37,  70, 15, R), //  2 Foster Bus
  661. +   ROV( 34, 160, 240, SND_1B_TRUCK_START,                    255, 40, 100, 25, R), //  3 Foster MkII Superbus
  662. +   ROV( 51, 120,  91, SND_3C_COMEDY_CAR,                     112, 30,  42,  9, R), //  4 Ploddyphut MkI Bus
  663. +   ROV( 51, 140, 171, SND_3E_COMEDY_CAR_2,                   192, 35,  60, 15, R), //  5 Ploddyphut MkII Bus
  664. +   ROV( 51, 160, 240, SND_3C_COMEDY_CAR,                     240, 38,  90, 25, R), //  6 Ploddyphut MkIII Bus
  665. +   ROV(  1, 108,  90, SND_19_BUS_START_PULL_AWAY,             96, 20,  38, 12, R), //  7 Balogh Coal Truck
  666. +   ROV( 18, 128, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22, R), //  8 Uhl Coal Truck
  667. +   ROV( 35, 138, 240, SND_19_BUS_START_PULL_AWAY,            224, 28,  69, 45, R), //  9 DW Coal Truck
  668. +   ROV(  2, 115,  90, SND_19_BUS_START_PULL_AWAY,             96, 22,  38, 12, R), // 10 MPS Mail Truck
  669. +   ROV( 19, 135, 168, SND_19_BUS_START_PULL_AWAY,            176, 28,  48, 22, R), // 11 Reynard Mail Truck
  670. +   ROV( 36, 145, 240, SND_19_BUS_START_PULL_AWAY,            224, 30,  69, 45, R), // 12 Perry Mail Truck
  671. +   ROV( 57, 115,  90, SND_3E_COMEDY_CAR_2,                    96, 22,  38, 12, R), // 13 MightyMover Mail Truck
  672. +   ROV( 57, 135, 168, SND_3C_COMEDY_CAR,                     176, 28,  48, 22, R), // 14 Powernaught Mail Truck
  673. +   ROV( 57, 145, 240, SND_3E_COMEDY_CAR_2,                   224, 30,  69, 45, R), // 15 Wizzowow Mail Truck
  674. +   ROV(  3, 110,  90, SND_19_BUS_START_PULL_AWAY,             96, 21,  38, 12, R), // 16 Witcombe Oil Tanker
  675. +   ROV( 20, 140, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22, R), // 17 Foster Oil Tanker
  676. +   ROV( 37, 150, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45, R), // 18 Perry Oil Tanker
  677. +   ROV(  4, 105,  90, SND_19_BUS_START_PULL_AWAY,             96, 14,  38, 12, R), // 19 Talbott Livestock Van
  678. +   ROV( 21, 130, 168, SND_19_BUS_START_PULL_AWAY,            176, 16,  48, 22, R), // 20 Uhl Livestock Van
  679. +   ROV( 38, 140, 240, SND_19_BUS_START_PULL_AWAY,            224, 18,  69, 45, R), // 21 Foster Livestock Van
  680. +   ROV(  5, 107,  90, SND_19_BUS_START_PULL_AWAY,             96, 14,  38, 12, R), // 22 Balogh Goods Truck
  681. +   ROV( 22, 130, 168, SND_19_BUS_START_PULL_AWAY,            176, 16,  48, 22, R), // 23 Craighead Goods Truck
  682. +   ROV( 39, 140, 240, SND_19_BUS_START_PULL_AWAY,            224, 18,  69, 45, R), // 24 Goss Goods Truck
  683. +   ROV(  6, 114,  90, SND_19_BUS_START_PULL_AWAY,             96, 20,  38, 12, R), // 25 Hereford Grain Truck
  684. +   ROV( 23, 133, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22, R), // 26 Thomas Grain Truck
  685. +   ROV( 40, 143, 240, SND_19_BUS_START_PULL_AWAY,            224, 30,  69, 45, R), // 27 Goss Grain Truck
  686. +   ROV(  7, 118,  90, SND_19_BUS_START_PULL_AWAY,             96, 20,  38, 12, R), // 28 Witcombe Wood Truck
  687. +   ROV( 24, 137, 168, SND_19_BUS_START_PULL_AWAY,            176, 22,  48, 22, R), // 29 Foster Wood Truck
  688. +   ROV( 41, 147, 240, SND_19_BUS_START_PULL_AWAY,            224, 24,  69, 45, R), // 30 Moreland Wood Truck
  689. +   ROV(  8, 121,  90, SND_19_BUS_START_PULL_AWAY,             96, 22,  38, 12, R), // 31 MPS Iron Ore Truck
  690. +   ROV( 25, 140, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22, R), // 32 Uhl Iron Ore Truck
  691. +   ROV( 42, 150, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45, R), // 33 Chippy Iron Ore Truck
  692. +   ROV(  9, 112,  90, SND_19_BUS_START_PULL_AWAY,             96, 15,  38, 12, R), // 34 Balogh Steel Truck
  693. +   ROV( 26, 135, 168, SND_19_BUS_START_PULL_AWAY,            176, 18,  48, 22, R), // 35 Uhl Steel Truck
  694. +   ROV( 43, 145, 240, SND_19_BUS_START_PULL_AWAY,            224, 20,  69, 45, R), // 36 Kelling Steel Truck
  695. +   ROV( 10, 145,  90, SND_19_BUS_START_PULL_AWAY,             96, 12,  38, 12, R), // 37 Balogh Armoured Truck
  696. +   ROV( 27, 170, 168, SND_19_BUS_START_PULL_AWAY,            176, 15,  48, 22, R), // 38 Uhl Armoured Truck
  697. +   ROV( 44, 180, 240, SND_19_BUS_START_PULL_AWAY,            224, 16,  69, 45, R), // 39 Foster Armoured Truck
  698. +   ROV( 11, 112,  90, SND_19_BUS_START_PULL_AWAY,             96, 17,  38, 12, R), // 40 Foster Food Van
  699. +   ROV( 28, 134, 168, SND_19_BUS_START_PULL_AWAY,            176, 20,  48, 22, R), // 41 Perry Food Van
  700. +   ROV( 45, 144, 240, SND_19_BUS_START_PULL_AWAY,            224, 22,  69, 45, R), // 42 Chippy Food Van
  701. +   ROV( 12, 112,  90, SND_19_BUS_START_PULL_AWAY,             96, 15,  38, 12, R), // 43 Uhl Paper Truck
  702. +   ROV( 29, 135, 168, SND_19_BUS_START_PULL_AWAY,            176, 18,  48, 22, R), // 44 Balogh Paper Truck
  703. +   ROV( 46, 145, 240, SND_19_BUS_START_PULL_AWAY,            224, 20,  69, 45, R), // 45 MPS Paper Truck
  704. +   ROV( 13, 121,  90, SND_19_BUS_START_PULL_AWAY,             96, 22,  38, 12, R), // 46 MPS Copper Ore Truck
  705. +   ROV( 30, 140, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22, R), // 47 Uhl Copper Ore Truck
  706. +   ROV( 47, 150, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45, R), // 48 Goss Copper Ore Truck
  707. +   ROV( 14, 111,  90, SND_19_BUS_START_PULL_AWAY,             96, 21,  38, 12, R), // 49 Uhl Water Tanker
  708. +   ROV( 31, 141, 168, SND_19_BUS_START_PULL_AWAY,            176, 25,  48, 22, R), // 50 Balogh Water Tanker
  709. +   ROV( 48, 151, 240, SND_19_BUS_START_PULL_AWAY,            224, 27,  69, 45, R), // 51 MPS Water Tanker
  710. +   ROV( 15, 118,  90, SND_19_BUS_START_PULL_AWAY,             96, 18,  38, 12, R), // 52 Balogh Fruit Truck
  711. +   ROV( 32, 148, 168, SND_19_BUS_START_PULL_AWAY,            176, 20,  48, 22, R), // 53 Uhl Fruit Truck
  712. +   ROV( 49, 158, 240, SND_19_BUS_START_PULL_AWAY,            224, 23,  69, 45, R), // 54 Kelling Fruit Truck
  713. +   ROV( 16, 117,  90, SND_19_BUS_START_PULL_AWAY,             96, 17,  38, 12, R), // 55 Balogh Rubber Truck
  714. +   ROV( 33, 147, 168, SND_19_BUS_START_PULL_AWAY,            176, 19,  48, 22, R), // 56 Uhl Rubber Truck
  715. +   ROV( 50, 157, 240, SND_19_BUS_START_PULL_AWAY,            224, 22,  69, 45, R), // 57 RMT Rubber Truck
  716. +   ROV( 52, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12, R), // 58 MightyMover Sugar Truck
  717. +   ROV( 52, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22, R), // 59 Powernaught Sugar Truck
  718. +   ROV( 52, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45, R), // 60 Wizzowow Sugar Truck
  719. +   ROV( 53, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12, R), // 61 MightyMover Cola Truck
  720. +   ROV( 53, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22, R), // 62 Powernaught Cola Truck
  721. +   ROV( 53, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45, R), // 63 Wizzowow Cola Truck
  722. +   ROV( 54, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12, R), // 64 MightyMover Candyfloss Truck
  723. +   ROV( 54, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22, R), // 65 Powernaught Candyfloss Truck
  724. +   ROV( 54, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45, R), // 66 Wizzowow Candyfloss Truck
  725. +   ROV( 55, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12, R), // 67 MightyMover Toffee Truck
  726. +   ROV( 55, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22, R), // 68 Powernaught Toffee Truck
  727. +   ROV( 55, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45, R), // 69 Wizzowow Toffee Truck
  728. +   ROV( 56, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12, R), // 70 MightyMover Toy Van
  729. +   ROV( 56, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22, R), // 71 Powernaught Toy Van
  730. +   ROV( 56, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45, R), // 72 Wizzowow Toy Van
  731. +   ROV( 58, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12, R), // 73 MightyMover Sweet Truck
  732. +   ROV( 58, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22, R), // 74 Powernaught Sweet Truck
  733. +   ROV( 58, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45, R), // 75 Wizzowow Sweet Truck
  734. +   ROV( 59, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12, R), // 76 MightyMover Battery Truck
  735. +   ROV( 59, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22, R), // 77 Powernaught Battery Truck
  736. +   ROV( 59, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45, R), // 78 Wizzowow Battery Truck
  737. +   ROV( 60, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12, R), // 79 MightyMover Fizzy Drink Truck
  738. +   ROV( 60, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22, R), // 80 Powernaught Fizzy Drink Truck
  739. +   ROV( 60, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45, R), // 81 Wizzowow Fizzy Drink Truck
  740. +   ROV( 61, 117,  90, SND_3F_COMEDY_CAR_3,                    96, 17,  38, 12, R), // 82 MightyMover Plastic Truck
  741. +   ROV( 61, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19,  48, 22, R), // 83 Powernaught Plastic Truck
  742. +   ROV( 61, 157, 240, SND_3F_COMEDY_CAR_3,                   224, 22,  69, 45, R), // 84 Wizzowow Plastic Truck
  743. +   ROV( 62, 117,  90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY,  96, 17,  38, 12, R), // 85 MightyMover Bubble Truck
  744. +   ROV( 62, 147, 168, SND_3F_COMEDY_CAR_3,                   176, 19,  48, 22, R), // 86 Powernaught Bubble Truck
  745. +   ROV( 62, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22,  69, 45, R), // 87 Wizzowow Bubble Truck
  746.  };
  747.  #undef ROV
  748. +#undef R
  749. +#undef T
  750.  
  751.  #endif /* ENGINES_H */
  752. Index: src/table/roadtypes.h
  753. ===================================================================
  754. --- src/table/roadtypes.h   (nonexistent)
  755. +++ src/table/roadtypes.h   (working copy)
  756. @@ -0,0 +1,142 @@
  757. +/* $Id$ */
  758. +
  759. +/*
  760. + * This file is part of OpenTTD.
  761. + * 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.
  762. + * 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.
  763. + * 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/>.
  764. + */
  765. +
  766. +/**
  767. + * @file roadtypes.h
  768. + * All the roadtype-specific information is stored here.
  769. + */
  770. +
  771. +#ifndef ROADTYPES_H
  772. +#define ROADTYPES_H
  773. +
  774. +/**
  775. + * Global Roadtype definition
  776. + */
  777. +static const RoadtypeInfo _original_roadtypes[] = {
  778. +   /** Road */
  779. +   {
  780. +       {
  781. +           STR_ROAD_NAME_ROAD,
  782. +           STR_ROAD_TOOLBAR_ROAD_CONSTRUCTION_CAPTION,
  783. +           STR_ROAD_MENU_ROAD_CONSTRUCTION,
  784. +           STR_BUY_VEHICLE_ROAD_VEHICLE_CAPTION,
  785. +           STR_REPLACE_VEHICLE_ROAD_VEHICLE,
  786. +           STR_ENGINE_PREVIEW_ROAD_VEHICLE,
  787. +       },
  788. +
  789. +       /* Powered roadtypes */
  790. +       ROADTYPES_ROAD | ROADTYPES_TRAM,
  791. +
  792. +       /* Compatible roadtypes */
  793. +       ROADTYPES_ROAD,
  794. +
  795. +       /* bridge offset */
  796. +       0,
  797. +
  798. +       /* fallback_roadtype */
  799. +       0,
  800. +
  801. +       /* curve speed advantage (multiplier) */
  802. +       0,
  803. +
  804. +       /* flags */
  805. +       ROTFB_NONE,
  806. +
  807. +       /* cost multiplier */
  808. +       8,
  809. +
  810. +       /* maintenance cost multiplier */
  811. +       8,
  812. +
  813. +       /* max speed */
  814. +       0,
  815. +
  816. +       /* road type label */
  817. +       'ROAD',
  818. +
  819. +       /* alternate labels */
  820. +       RoadTypeLabelList(),
  821. +
  822. +       /* map colour */
  823. +       0x0A,
  824. +
  825. +       /* introduction date */
  826. +       INVALID_DATE,
  827. +
  828. +       /* roadtypes required for this to be introduced */
  829. +       ROADTYPES_NONE,
  830. +
  831. +       /* introduction road types */
  832. +       ROADTYPES_ROAD,
  833. +
  834. +       /* sort order */
  835. +       0 << 4 | 7,
  836. +   },
  837. +   /** Tram */
  838. +   {
  839. +       {
  840. +           STR_ROAD_NAME_TRAM,
  841. +           STR_ROAD_TOOLBAR_TRAM_CONSTRUCTION_CAPTION,
  842. +           STR_ROAD_MENU_TRAM_CONSTRUCTION,
  843. +           STR_BUY_VEHICLE_ROAD_VEHICLE_CAPTION,
  844. +           STR_REPLACE_VEHICLE_ROAD_VEHICLE,
  845. +           STR_ENGINE_PREVIEW_ROAD_VEHICLE,
  846. +       },
  847. +
  848. +       /* Powered roadtypes */
  849. +       ROADTYPES_ROAD | ROADTYPES_TRAM,
  850. +
  851. +       /* Compatible roadtypes */
  852. +       ROADTYPES_TRAM,
  853. +
  854. +       /* bridge offset */
  855. +       0,
  856. +
  857. +       /* fallback_roadtype */
  858. +       0,
  859. +
  860. +       /* curve speed advantage (multiplier) */
  861. +       0,
  862. +
  863. +       /* flags */
  864. +       ROTFB_NONE,
  865. +
  866. +       /* cost multiplier */
  867. +       8,
  868. +
  869. +       /* maintenance cost multiplier */
  870. +       8,
  871. +
  872. +       /* max speed */
  873. +       0,
  874. +
  875. +       /* road type label */
  876. +       'TRAM',
  877. +
  878. +       /* alternate labels */
  879. +       RoadTypeLabelList(),
  880. +
  881. +       /* map colour */
  882. +       0x0A,
  883. +
  884. +       /* introduction date */
  885. +       INVALID_DATE,
  886. +
  887. +       /* roadtypes required for this to be introduced */
  888. +       ROADTYPES_NONE,
  889. +
  890. +       /* introduction road types */
  891. +       ROADTYPES_TRAM,
  892. +
  893. +       /* sort order */
  894. +       1 << 4 | 7,
  895. +   },
  896. +};
  897. +
  898. +#endif /* ROADTYPES_H */
  899. Index: src/toolbar_gui.cpp
  900. ===================================================================
  901. --- src/toolbar_gui.cpp (revision 22430)
  902. +++ src/toolbar_gui.cpp (working copy)
  903. @@ -887,22 +887,7 @@
  904.  
  905.  static CallBackFunction ToolbarBuildRoadClick(Window *w)
  906.  {
  907. -   const Company *c = Company::Get(_local_company);
  908. -   DropDownList *list = new DropDownList();
  909. -
  910. -   /* Road is always visible and available. */
  911. -   *list->Append() = new DropDownListStringItem(STR_ROAD_MENU_ROAD_CONSTRUCTION, ROADTYPE_ROAD, false);
  912. -
  913. -   /* Tram is only visible when there will be a tram, and available when that has been introduced. */
  914. -   Engine *e;
  915. -   FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
  916. -       if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
  917. -       if (!HasBit(e->info.misc_flags, EF_ROAD_TRAM)) continue;
  918. -
  919. -       *list->Append() = new DropDownListStringItem(STR_ROAD_MENU_TRAM_CONSTRUCTION, ROADTYPE_TRAM, !HasBit(c->avail_roadtypes, ROADTYPE_TRAM));
  920. -       break;
  921. -   }
  922. -   ShowDropDownList(w, list, _last_built_roadtype, WID_TN_ROADS, 140, true, true);
  923. +   ShowDropDownList(w, GetRoadTypeDropDownList(), _last_built_roadtype, WID_TN_ROADS, 140, true, true);
  924.     if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
  925.     return CBF_NONE;
  926.  }

Comments