Index: source.list
===================================================================
--- source.list (revision 22430)
+++ source.list (working copy)
@@ -302,6 +302,7 @@
rail_gui.h
rail_type.h
rev.h
+road.h
road_cmd.h
road_func.h
road_gui.h
@@ -659,6 +660,7 @@
table/pricebase.h
table/railtypes.h
table/road_land.h
+table/roadtypes.h
table/roadveh_movement.h
../objs/settings/table/settings.h
table/sprites.h
Index: src/bridge_map.h
===================================================================
--- src/bridge_map.h (revision 22431)
+++ src/bridge_map.h (working copy)
@@ -116,30 +116,30 @@
SetBit(_m[t].type, 2 + a);
}
-/**
- * Set wether a bridge has a catenary or not.
- * @param t the tile with the bridge
- * @pre IsBridgeTile(t)
- */
-static inline void SetBridgeRoadTramCatenary(TileIndex t, bool b)
-{
- assert(IsBridgeTile(t));
- SB(_m[t].m1, 7, 1, b ? 1 : 0);
-}
-
-/**
- * Checks if given bridge has catenary bit.
- * @param t the bridge ramp tile
- * @pre IsBridgeTile(t)
- * @return True if bridge has catenary bit set
- */
-static inline bool HasBridgeRoadTramCatenary(TileIndex t)
-{
- assert(IsBridgeTile(t));
- return GB(_m[t].m1, 7, 1) != 0;
+/**
+ * Set wether a bridge has a catenary or not.
+ * @param t the tile with the bridge
+ * @pre IsBridgeTile(t)
+ */
+static inline void SetBridgeRoadTramCatenary(TileIndex t, bool b)
+{
+ assert(IsBridgeTile(t));
+ SB(_m[t].m1, 7, 1, b ? 1 : 0);
}
/**
+ * Checks if given bridge has catenary bit.
+ * @param t the bridge ramp tile
+ * @pre IsBridgeTile(t)
+ * @return True if bridge has catenary bit set
+ */
+static inline bool HasBridgeRoadTramCatenary(TileIndex t)
+{
+ assert(IsBridgeTile(t));
+ return GB(_m[t].m1, 7, 1) != 0;
+}
+
+/**
* Generic part to make a bridge ramp for both roads and rails.
* @param t the tile to make a bridge ramp
* @param o the new owner of the bridge ramp
Index: src/engine_type.h
===================================================================
--- src/engine_type.h (revision 22430)
+++ src/engine_type.h (working copy)
@@ -14,6 +14,7 @@
#include "economy_type.h"
#include "rail_type.h"
+#include "road_type.h"
#include "cargo_type.h"
#include "date_type.h"
#include "sound_type.h"
@@ -123,6 +124,7 @@
uint8 air_drag; ///< Coefficient of air drag
byte visual_effect; ///< Bitstuffed NewGRF visual effect data
byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor
+ RoadTypeByte roadtype;
};
/**
Index: src/lang/english.txt
===================================================================
--- src/lang/english.txt (revision 22430)
+++ src/lang/english.txt (working copy)
@@ -2407,6 +2407,9 @@
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD :{BLACK}Toggle build/remove for road construction
STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS :{BLACK}Toggle build/remove for tramway construction
+STR_ROAD_NAME_ROAD :Road
+STR_ROAD_NAME_TRAM :Tramway
+
# Road depot construction window
STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION :{WHITE}Road Depot Orientation
STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP :{BLACK}Select road vehicle depot orientation
Index: src/road.cpp
===================================================================
--- src/road.cpp (revision 22430)
+++ src/road.cpp (working copy)
@@ -152,3 +152,29 @@
return rt;
}
+
+/**
+ * Get the road type for a given label.
+ * @param label the roadtype label.
+ * @param allow_alternate_labels Search in the alternate label lists as well.
+ * @return the roadtype.
+ */
+RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels)
+{
+ /* Loop through each road type until the label is found */
+ for (RoadType r = ROADTYPE_BEGIN; r != ROADTYPE_END; r++) {
+ const RoadtypeInfo *rti = GetRoadTypeInfo(r);
+ if (rti->label == label) return r;
+ }
+
+ if (allow_alternate_labels) {
+ /* Test if any road type defines the label as an alternate. */
+ for (RoadType r = ROADTYPE_BEGIN; r != ROADTYPE_END; r++) {
+ const RoadtypeInfo *rti = GetRoadTypeInfo(r);
+ if (rti->alternate_labels.Contains(label)) return r;
+ }
+ }
+
+ /* No matching label was found, so it is invalid */
+ return INVALID_ROADTYPE;
+}
Index: src/road.h
===================================================================
--- src/road.h (nonexistent)
+++ src/road.h (working copy)
@@ -0,0 +1,175 @@
+/* $Id$ */
+
+/*
+ * 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 .
+ */
+
+/** @file road.h Road specific functions. */
+
+#ifndef ROAD_H
+#define ROAD_H
+
+#include "road_type.h"
+
+/** Roadtype flags. Starts with RO instead of R because R is used for roads */
+enum RoadTypeFlags {
+ ROTF_CATENARY = 7, ///< Bit number for adding catenary
+
+ ROTFB_NONE = 0, ///< All flags cleared.
+ ROTFB_CATENARY = 1 << ROTF_CATENARY, ///< Value for drawing a catenary.
+};
+DECLARE_ENUM_AS_BIT_SET(RoadTypeFlags)
+
+/** List of road type labels. */
+typedef SmallVector RoadTypeLabelList;
+
+struct RoadtypeInfo {
+ struct {
+ StringID name; ///< Name of this rail type.
+ StringID toolbar_caption; ///< Caption in the construction toolbar GUI for this rail type.
+ StringID menu_text; ///< Name of this rail type in the main toolbar dropdown.
+ StringID build_caption; ///< Caption of the build vehicle GUI for this rail type.
+ StringID replace_text; ///< Text used in the autoreplace GUI.
+ StringID new_loco; ///< Name of an engine for this type of rail in the engine preview GUI.
+ } strings; ///< Strings associated with the rail type.
+
+
+ /** bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype generates power */
+ RoadTypes powered_roadtypes;
+
+ /** bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype can physically travel */
+ RoadTypes compatible_roadtypes;
+
+ /**
+ * Bridge offset
+ */
+ SpriteID bridge_offset;
+
+ /**
+ * Original roadtype number to use when drawing non-newgrf roadtypes, or when drawing stations.
+ */
+ byte fallback_roadtype;
+
+ /**
+ * Multiplier for curve maximum speed advantage
+ */
+ byte curve_speed;
+
+ /**
+ * Bit mask of road type flags
+ */
+ RoadTypeFlags flags;
+
+ /**
+ * Cost multiplier for building this road type
+ */
+ uint16 cost_multiplier;
+
+ /**
+ * Cost multiplier for maintenance of this road type
+ */
+ uint16 maintenance_multiplier;
+
+ /**
+ * Maximum speed for vehicles travelling on this road type
+ */
+ uint16 max_speed;
+
+ /**
+ * Unique 32 bit road type identifier
+ */
+ RoadTypeLabel label;
+
+ /**
+ * Road type labels this type provides in addition to the main label.
+ */
+ RoadTypeLabelList alternate_labels;
+
+ /**
+ * Colour on mini-map
+ */
+ byte map_colour;
+
+ /**
+ * Introduction date.
+ * When #INVALID_DATE or a vehicle using this roadtype gets introduced earlier,
+ * the vehicle's introduction date will be used instead for this roadtype.
+ * The introduction at this date is furthermore limited by the
+ * #introduction_required_types.
+ */
+ Date introduction_date;
+
+ /**
+ * Bitmask of roadtypes that are required for this roadtype to be introduced
+ * at a given #introduction_date.
+ */
+ RoadTypes introduction_required_roadtypes;
+
+ /**
+ * Bitmask of which other roadtypes are introduced when this roadtype is introduced.
+ */
+ RoadTypes introduces_roadtypes;
+
+ /**
+ * The sorting order of this roadtype for the toolbar dropdown.
+ */
+ byte sorting_order;
+};
+
+/**
+ * Returns a pointer to the Roadtype information for a given roadtype
+ * @param roadtype the road type which the information is requested for
+ * @return The pointer to the RoadtypeInfo
+ */
+static inline const RoadtypeInfo *GetRoadTypeInfo(RoadType roadtype)
+{
+ extern RoadtypeInfo _roadtypes[ROADTYPE_END];
+ assert(roadtype < ROADTYPE_END);
+ return &_roadtypes[roadtype];
+}
+
+/**
+ * Checks if an engine of the given RoadType can drive on a tile with a given
+ * RoadType. This would normally just be an equality check, but for electrified
+ * roads (which also support non-electric vehicles).
+ * @return Whether the engine can drive on this tile.
+ * @param vehicletype The RoadType of the engine we are considering.
+ * @param tiletype The RoadType of the tile we are considering.
+ */
+static inline bool IsCompatibleRoad(RoadType vehicletype, RoadType tiletype)
+{
+ return HasBit(GetRoadTypeInfo(vehicletype)->compatible_roadtypes, tiletype);
+}
+
+/**
+ * Checks if an engine of the given RoadType got power on a tile with a given
+ * RoadType. This would normally just be an equality check, but for electrified
+ * roads (which also support non-electric vehicles).
+ * @return Whether the engine got power on this tile.
+ * @param vehicletype The RoadType of the engine we are considering.
+ * @param tiletype The RoadType of the tile we are considering.
+ */
+static inline bool HasPowerOnRoad(RoadType vehicletype, RoadType tiletype)
+{
+ return HasBit(GetRoadTypeInfo(vehicletype)->powered_roadtypes, tiletype);
+}
+
+RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels = true);
+
+void ResetRoadTypes();
+void InitRoadTypes();
+RoadType AllocateRoadType(RoadTypeLabel label);
+
+extern RoadType _sorted_roadtypes[ROADTYPE_END];
+extern uint8 _sorted_roadtypes_size;
+
+/**
+ * Loop header for iterating over roadtypes, sorted by sortorder.
+ * @param var Roadtype.
+ */
+#define FOR_ALL_SORTED_ROADTYPES(var) for (uint8 index = 0; index < _sorted_roadtypes_size && (var = _sorted_roadtypes[index], true) ; index++)
+
+#endif /* ROAD_H */
Index: src/road_cmd.cpp
===================================================================
--- src/road_cmd.cpp (revision 22431)
+++ src/road_cmd.cpp (working copy)
@@ -37,10 +37,96 @@
#include "company_gui.h"
#include "table/strings.h"
+#include "table/roadtypes.h"
#include "safeguards.h"
+
+RoadtypeInfo _roadtypes[ROADTYPE_END];
+RoadType _sorted_roadtypes[ROADTYPE_END];
+uint8 _sorted_roadtypes_size;
+
+assert_compile(sizeof(_original_roadtypes) <= sizeof(_roadtypes));
+
/**
+ * Reset all road type information to its default values.
+ */
+void ResetRoadTypes()
+{
+ memset(_roadtypes, 0, sizeof(_roadtypes));
+ memcpy(_roadtypes, _original_roadtypes, sizeof(_original_roadtypes));
+}
+
+/**
+ * Compare roadtypes based on their sorting order.
+ * @param first The roadtype to compare to.
+ * @param second The roadtype to compare.
+ * @return True iff the first should be sorted before the second.
+ */
+static int CDECL CompareRoadTypes(const RoadType *first, const RoadType *second)
+{
+ return GetRoadTypeInfo(*first)->sorting_order - GetRoadTypeInfo(*second)->sorting_order;
+}
+
+/**
+ * Resolve sprites of custom road types
+ * TODO: Sprite structure
+ */
+void InitRoadTypes()
+{
+ //for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
+ // RoadtypeInfo *rti = &_roadtypes[rt];
+ // ResolveRoadTypeGUISprites(rti);
+ //}
+
+ _sorted_roadtypes_size = 0;
+ for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
+ if (_roadtypes[rt].label != 0) {
+ _sorted_roadtypes[_sorted_roadtypes_size++] = rt;
+ }
+ }
+ QSortT(_sorted_roadtypes, _sorted_roadtypes_size, CompareRoadTypes);
+}
+
+/**
+ * Allocate a new road type label
+ * TODO: newgrf.cpp function RoadTypeReserveInfo
+ */
+RoadType AllocateRoadType(RoadTypeLabel label)
+{
+ for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
+ RoadtypeInfo *rti = &_roadtypes[rt];
+
+ if (rti->label == 0) {
+ /* Set up new road type */
+ memcpy(rti, &_roadtypes[ROADTYPE_ROAD], sizeof(*rti));
+ rti->label = label;
+ /* Clear alternate label list. Can't use Reset() here as that would free
+ * the data pointer of ROADTYPE_ROAD and not our new road type. */
+ new (&rti->alternate_labels) RoadTypeLabelList;
+
+ /* Make us compatible with ourself. */
+ rti->powered_roadtypes = (RoadTypes)(1 << rt);
+ rti->compatible_roadtypes = (RoadTypes)(1 << rt);
+
+ /* We also introduce ourself. */
+ rti->introduces_roadtypes = (RoadTypes)(1 << rt);
+
+ /* Default sort order; order of allocation, but with some
+ * offsets so it's easier for NewGRF to pick a spot without
+ * changing the order of other (original) road types.
+ * The << is so you can place other roadtypes in between the
+ * other roadtypes, the 7 is to be able to place something
+ * before the first (default) road type. */
+ rti->sorting_order = rt << 4 | 7;
+ return rt;
+ }
+ }
+
+ return INVALID_ROADTYPE;
+}
+
+/**
* Verify whether a road vehicle is available.
* @return \c true if at least one road vehicle is available, \c false if not
*/
Index: src/road_gui.cpp
===================================================================
--- src/road_gui.cpp (revision 22430)
+++ src/road_gui.cpp (working copy)
@@ -29,6 +29,7 @@
#include "hotkeys.h"
#include "road_gui.h"
#include "zoom_func.h"
+#include "engine_base.h"
#include "widgets/road_widget.h"
@@ -1116,3 +1117,46 @@
_road_depot_orientation = DIAGDIR_NW;
_road_station_picker_orientation = DIAGDIR_NW;
}
+
+/**
+ * Create a drop down list for all the road types of the local company.
+ * @param for_replacement Whether this list is for the replacement window.
+ * @return The populated and sorted #DropDownList.
+ *
+ * TODO: see rail_gui.cpp/GetRailTypeDropDownList() to complete the features for this function
+ */
+DropDownList *GetRoadTypeDropDownList(bool for_replacement)
+{
+ /*** Test only, move to NewGRF spec! ***/
+ ResetRoadTypes();
+ InitRoadTypes();
+ /*** Test only, move to NewGRF spec! ***/
+
+ const Company *c = Company::Get(_local_company);
+ DropDownList *list = new DropDownList();
+
+ RoadTypes used_roadtypes = ROADTYPES_NONE;
+ Engine *e;
+ FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
+
+ used_roadtypes |= GetRoadTypeInfo(HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)->introduces_roadtypes;
+ break;
+ }
+
+ RoadType rt;
+ FOR_ALL_SORTED_ROADTYPES(rt) {
+ /* If it's not used ever, don't show it to the user. */
+ if (!HasBit(used_roadtypes, rt)) continue;
+
+ const RoadtypeInfo *rti = GetRoadTypeInfo(rt);
+
+ StringID str = for_replacement ? rti->strings.replace_text : (rti->max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING);
+ DropDownListParamStringItem *item = new DropDownListParamStringItem(str, rt, !HasBit(c->avail_roadtypes, rt));
+ item->SetParam(0, rti->strings.menu_text);
+ item->SetParam(1, rti->max_speed);
+ *list->Append() = item;
+ }
+
+ return list;
+}
Index: src/road_gui.h
===================================================================
--- src/road_gui.h (revision 22430)
+++ src/road_gui.h (working copy)
@@ -15,9 +15,11 @@
#include "road_type.h"
#include "tile_type.h"
#include "direction_type.h"
+#include "widgets/dropdown_type.h"
struct Window *ShowBuildRoadToolbar(RoadType roadtype);
struct Window *ShowBuildRoadScenToolbar();
void ConnectRoadToStructure(TileIndex tile, DiagDirection direction);
+DropDownList *GetRoadTypeDropDownList(bool for_replacement = false);
#endif /* ROAD_GUI_H */
Index: src/road_map.h
===================================================================
--- src/road_map.h (revision 22431)
+++ src/road_map.h (working copy)
@@ -17,6 +17,7 @@
#include "rail_type.h"
#include "road_func.h"
#include "tile_map.h"
+#include "road.h"
/** The different types of road tiles. */
@@ -305,7 +306,7 @@
*/
static inline bool HasCatenary(TileIndex t)
{
- return GB(_m[t].m1, 7, 1) != 0;
+ return GB(_m[t].m1, ROTF_CATENARY, 1) != 0;
}
/**
Index: src/road_type.h
===================================================================
--- src/road_type.h (revision 22430)
+++ src/road_type.h (working copy)
@@ -14,6 +14,11 @@
#include "core/enum_type.hpp"
+typedef uint32 RoadTypeLabel;
+
+static const RoadTypeLabel ROAD_TYPE_ROAD = 'ROAD';
+static const RoadTypeLabel ROAD_TYPE_TRAM = 'TRAM';
+
/**
* The different roadtypes we support
*
@@ -28,6 +33,7 @@
};
DECLARE_POSTFIX_INCREMENT(RoadType)
template <> struct EnumPropsT : MakeEnumPropsT {};
+typedef TinyEnumT RoadTypeByte;
/**
* The different roadtypes we support, but then a bitmask of them
Index: src/table/engines.h
===================================================================
--- src/table/engines.h (revision 22430)
+++ src/table/engines.h (working copy)
@@ -653,104 +653,109 @@
* @param f capacity (persons, bags, tons, pieces, items, cubic metres, ...)
* @param g weight (1/4 ton)
* @param h power (10 hp)
+ * @param i roadtype
* Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
* Air drag value depends on the top speed of the vehicle.
*/
-#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 }
+#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 }
+#define R ROADTYPE_ROAD
+#define T ROADTYPE_TRAM
static const RoadVehicleInfo _orig_road_vehicle_info[] = {
/* image_index sfx max_speed power
- * | cost_factor | | capacity |
- * | | running_cost | | weight
- * | | | | | | | |*/
- ROV( 0, 120, 91, SND_19_BUS_START_PULL_AWAY, 112, 31, 42, 9), // 0 MPS Regal Bus
- ROV( 17, 140, 128, SND_1C_TRUCK_START_2, 176, 35, 60, 12), // 1 Hereford Leopard Bus
- ROV( 17, 150, 178, SND_1B_TRUCK_START, 224, 37, 70, 15), // 2 Foster Bus
- ROV( 34, 160, 240, SND_1B_TRUCK_START, 255, 40, 100, 25), // 3 Foster MkII Superbus
- ROV( 51, 120, 91, SND_3C_COMEDY_CAR, 112, 30, 42, 9), // 4 Ploddyphut MkI Bus
- ROV( 51, 140, 171, SND_3E_COMEDY_CAR_2, 192, 35, 60, 15), // 5 Ploddyphut MkII Bus
- ROV( 51, 160, 240, SND_3C_COMEDY_CAR, 240, 38, 90, 25), // 6 Ploddyphut MkIII Bus
- ROV( 1, 108, 90, SND_19_BUS_START_PULL_AWAY, 96, 20, 38, 12), // 7 Balogh Coal Truck
- ROV( 18, 128, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22), // 8 Uhl Coal Truck
- ROV( 35, 138, 240, SND_19_BUS_START_PULL_AWAY, 224, 28, 69, 45), // 9 DW Coal Truck
- ROV( 2, 115, 90, SND_19_BUS_START_PULL_AWAY, 96, 22, 38, 12), // 10 MPS Mail Truck
- ROV( 19, 135, 168, SND_19_BUS_START_PULL_AWAY, 176, 28, 48, 22), // 11 Reynard Mail Truck
- ROV( 36, 145, 240, SND_19_BUS_START_PULL_AWAY, 224, 30, 69, 45), // 12 Perry Mail Truck
- ROV( 57, 115, 90, SND_3E_COMEDY_CAR_2, 96, 22, 38, 12), // 13 MightyMover Mail Truck
- ROV( 57, 135, 168, SND_3C_COMEDY_CAR, 176, 28, 48, 22), // 14 Powernaught Mail Truck
- ROV( 57, 145, 240, SND_3E_COMEDY_CAR_2, 224, 30, 69, 45), // 15 Wizzowow Mail Truck
- ROV( 3, 110, 90, SND_19_BUS_START_PULL_AWAY, 96, 21, 38, 12), // 16 Witcombe Oil Tanker
- ROV( 20, 140, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22), // 17 Foster Oil Tanker
- ROV( 37, 150, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45), // 18 Perry Oil Tanker
- ROV( 4, 105, 90, SND_19_BUS_START_PULL_AWAY, 96, 14, 38, 12), // 19 Talbott Livestock Van
- ROV( 21, 130, 168, SND_19_BUS_START_PULL_AWAY, 176, 16, 48, 22), // 20 Uhl Livestock Van
- ROV( 38, 140, 240, SND_19_BUS_START_PULL_AWAY, 224, 18, 69, 45), // 21 Foster Livestock Van
- ROV( 5, 107, 90, SND_19_BUS_START_PULL_AWAY, 96, 14, 38, 12), // 22 Balogh Goods Truck
- ROV( 22, 130, 168, SND_19_BUS_START_PULL_AWAY, 176, 16, 48, 22), // 23 Craighead Goods Truck
- ROV( 39, 140, 240, SND_19_BUS_START_PULL_AWAY, 224, 18, 69, 45), // 24 Goss Goods Truck
- ROV( 6, 114, 90, SND_19_BUS_START_PULL_AWAY, 96, 20, 38, 12), // 25 Hereford Grain Truck
- ROV( 23, 133, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22), // 26 Thomas Grain Truck
- ROV( 40, 143, 240, SND_19_BUS_START_PULL_AWAY, 224, 30, 69, 45), // 27 Goss Grain Truck
- ROV( 7, 118, 90, SND_19_BUS_START_PULL_AWAY, 96, 20, 38, 12), // 28 Witcombe Wood Truck
- ROV( 24, 137, 168, SND_19_BUS_START_PULL_AWAY, 176, 22, 48, 22), // 29 Foster Wood Truck
- ROV( 41, 147, 240, SND_19_BUS_START_PULL_AWAY, 224, 24, 69, 45), // 30 Moreland Wood Truck
- ROV( 8, 121, 90, SND_19_BUS_START_PULL_AWAY, 96, 22, 38, 12), // 31 MPS Iron Ore Truck
- ROV( 25, 140, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22), // 32 Uhl Iron Ore Truck
- ROV( 42, 150, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45), // 33 Chippy Iron Ore Truck
- ROV( 9, 112, 90, SND_19_BUS_START_PULL_AWAY, 96, 15, 38, 12), // 34 Balogh Steel Truck
- ROV( 26, 135, 168, SND_19_BUS_START_PULL_AWAY, 176, 18, 48, 22), // 35 Uhl Steel Truck
- ROV( 43, 145, 240, SND_19_BUS_START_PULL_AWAY, 224, 20, 69, 45), // 36 Kelling Steel Truck
- ROV( 10, 145, 90, SND_19_BUS_START_PULL_AWAY, 96, 12, 38, 12), // 37 Balogh Armoured Truck
- ROV( 27, 170, 168, SND_19_BUS_START_PULL_AWAY, 176, 15, 48, 22), // 38 Uhl Armoured Truck
- ROV( 44, 180, 240, SND_19_BUS_START_PULL_AWAY, 224, 16, 69, 45), // 39 Foster Armoured Truck
- ROV( 11, 112, 90, SND_19_BUS_START_PULL_AWAY, 96, 17, 38, 12), // 40 Foster Food Van
- ROV( 28, 134, 168, SND_19_BUS_START_PULL_AWAY, 176, 20, 48, 22), // 41 Perry Food Van
- ROV( 45, 144, 240, SND_19_BUS_START_PULL_AWAY, 224, 22, 69, 45), // 42 Chippy Food Van
- ROV( 12, 112, 90, SND_19_BUS_START_PULL_AWAY, 96, 15, 38, 12), // 43 Uhl Paper Truck
- ROV( 29, 135, 168, SND_19_BUS_START_PULL_AWAY, 176, 18, 48, 22), // 44 Balogh Paper Truck
- ROV( 46, 145, 240, SND_19_BUS_START_PULL_AWAY, 224, 20, 69, 45), // 45 MPS Paper Truck
- ROV( 13, 121, 90, SND_19_BUS_START_PULL_AWAY, 96, 22, 38, 12), // 46 MPS Copper Ore Truck
- ROV( 30, 140, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22), // 47 Uhl Copper Ore Truck
- ROV( 47, 150, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45), // 48 Goss Copper Ore Truck
- ROV( 14, 111, 90, SND_19_BUS_START_PULL_AWAY, 96, 21, 38, 12), // 49 Uhl Water Tanker
- ROV( 31, 141, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22), // 50 Balogh Water Tanker
- ROV( 48, 151, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45), // 51 MPS Water Tanker
- ROV( 15, 118, 90, SND_19_BUS_START_PULL_AWAY, 96, 18, 38, 12), // 52 Balogh Fruit Truck
- ROV( 32, 148, 168, SND_19_BUS_START_PULL_AWAY, 176, 20, 48, 22), // 53 Uhl Fruit Truck
- ROV( 49, 158, 240, SND_19_BUS_START_PULL_AWAY, 224, 23, 69, 45), // 54 Kelling Fruit Truck
- ROV( 16, 117, 90, SND_19_BUS_START_PULL_AWAY, 96, 17, 38, 12), // 55 Balogh Rubber Truck
- ROV( 33, 147, 168, SND_19_BUS_START_PULL_AWAY, 176, 19, 48, 22), // 56 Uhl Rubber Truck
- ROV( 50, 157, 240, SND_19_BUS_START_PULL_AWAY, 224, 22, 69, 45), // 57 RMT Rubber Truck
- ROV( 52, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12), // 58 MightyMover Sugar Truck
- ROV( 52, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22), // 59 Powernaught Sugar Truck
- ROV( 52, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45), // 60 Wizzowow Sugar Truck
- ROV( 53, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12), // 61 MightyMover Cola Truck
- ROV( 53, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22), // 62 Powernaught Cola Truck
- ROV( 53, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45), // 63 Wizzowow Cola Truck
- ROV( 54, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12), // 64 MightyMover Candyfloss Truck
- ROV( 54, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22), // 65 Powernaught Candyfloss Truck
- ROV( 54, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45), // 66 Wizzowow Candyfloss Truck
- ROV( 55, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12), // 67 MightyMover Toffee Truck
- ROV( 55, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22), // 68 Powernaught Toffee Truck
- ROV( 55, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45), // 69 Wizzowow Toffee Truck
- ROV( 56, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12), // 70 MightyMover Toy Van
- ROV( 56, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22), // 71 Powernaught Toy Van
- ROV( 56, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45), // 72 Wizzowow Toy Van
- ROV( 58, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12), // 73 MightyMover Sweet Truck
- ROV( 58, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22), // 74 Powernaught Sweet Truck
- ROV( 58, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45), // 75 Wizzowow Sweet Truck
- ROV( 59, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12), // 76 MightyMover Battery Truck
- ROV( 59, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22), // 77 Powernaught Battery Truck
- ROV( 59, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45), // 78 Wizzowow Battery Truck
- ROV( 60, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12), // 79 MightyMover Fizzy Drink Truck
- ROV( 60, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22), // 80 Powernaught Fizzy Drink Truck
- ROV( 60, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45), // 81 Wizzowow Fizzy Drink Truck
- ROV( 61, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12), // 82 MightyMover Plastic Truck
- ROV( 61, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22), // 83 Powernaught Plastic Truck
- ROV( 61, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45), // 84 Wizzowow Plastic Truck
- ROV( 62, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12), // 85 MightyMover Bubble Truck
- ROV( 62, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22), // 86 Powernaught Bubble Truck
- ROV( 62, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45), // 87 Wizzowow Bubble Truck
+ * | cost_factor | | capacity | roadtype
+ * | | running_cost | | weight |
+ * | | | | | | | | |*/
+ ROV( 0, 120, 91, SND_19_BUS_START_PULL_AWAY, 112, 31, 42, 9, R), // 0 MPS Regal Bus
+ ROV( 17, 140, 128, SND_1C_TRUCK_START_2, 176, 35, 60, 12, R), // 1 Hereford Leopard Bus
+ ROV( 17, 150, 178, SND_1B_TRUCK_START, 224, 37, 70, 15, R), // 2 Foster Bus
+ ROV( 34, 160, 240, SND_1B_TRUCK_START, 255, 40, 100, 25, R), // 3 Foster MkII Superbus
+ ROV( 51, 120, 91, SND_3C_COMEDY_CAR, 112, 30, 42, 9, R), // 4 Ploddyphut MkI Bus
+ ROV( 51, 140, 171, SND_3E_COMEDY_CAR_2, 192, 35, 60, 15, R), // 5 Ploddyphut MkII Bus
+ ROV( 51, 160, 240, SND_3C_COMEDY_CAR, 240, 38, 90, 25, R), // 6 Ploddyphut MkIII Bus
+ ROV( 1, 108, 90, SND_19_BUS_START_PULL_AWAY, 96, 20, 38, 12, R), // 7 Balogh Coal Truck
+ ROV( 18, 128, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22, R), // 8 Uhl Coal Truck
+ ROV( 35, 138, 240, SND_19_BUS_START_PULL_AWAY, 224, 28, 69, 45, R), // 9 DW Coal Truck
+ ROV( 2, 115, 90, SND_19_BUS_START_PULL_AWAY, 96, 22, 38, 12, R), // 10 MPS Mail Truck
+ ROV( 19, 135, 168, SND_19_BUS_START_PULL_AWAY, 176, 28, 48, 22, R), // 11 Reynard Mail Truck
+ ROV( 36, 145, 240, SND_19_BUS_START_PULL_AWAY, 224, 30, 69, 45, R), // 12 Perry Mail Truck
+ ROV( 57, 115, 90, SND_3E_COMEDY_CAR_2, 96, 22, 38, 12, R), // 13 MightyMover Mail Truck
+ ROV( 57, 135, 168, SND_3C_COMEDY_CAR, 176, 28, 48, 22, R), // 14 Powernaught Mail Truck
+ ROV( 57, 145, 240, SND_3E_COMEDY_CAR_2, 224, 30, 69, 45, R), // 15 Wizzowow Mail Truck
+ ROV( 3, 110, 90, SND_19_BUS_START_PULL_AWAY, 96, 21, 38, 12, R), // 16 Witcombe Oil Tanker
+ ROV( 20, 140, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22, R), // 17 Foster Oil Tanker
+ ROV( 37, 150, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45, R), // 18 Perry Oil Tanker
+ ROV( 4, 105, 90, SND_19_BUS_START_PULL_AWAY, 96, 14, 38, 12, R), // 19 Talbott Livestock Van
+ ROV( 21, 130, 168, SND_19_BUS_START_PULL_AWAY, 176, 16, 48, 22, R), // 20 Uhl Livestock Van
+ ROV( 38, 140, 240, SND_19_BUS_START_PULL_AWAY, 224, 18, 69, 45, R), // 21 Foster Livestock Van
+ ROV( 5, 107, 90, SND_19_BUS_START_PULL_AWAY, 96, 14, 38, 12, R), // 22 Balogh Goods Truck
+ ROV( 22, 130, 168, SND_19_BUS_START_PULL_AWAY, 176, 16, 48, 22, R), // 23 Craighead Goods Truck
+ ROV( 39, 140, 240, SND_19_BUS_START_PULL_AWAY, 224, 18, 69, 45, R), // 24 Goss Goods Truck
+ ROV( 6, 114, 90, SND_19_BUS_START_PULL_AWAY, 96, 20, 38, 12, R), // 25 Hereford Grain Truck
+ ROV( 23, 133, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22, R), // 26 Thomas Grain Truck
+ ROV( 40, 143, 240, SND_19_BUS_START_PULL_AWAY, 224, 30, 69, 45, R), // 27 Goss Grain Truck
+ ROV( 7, 118, 90, SND_19_BUS_START_PULL_AWAY, 96, 20, 38, 12, R), // 28 Witcombe Wood Truck
+ ROV( 24, 137, 168, SND_19_BUS_START_PULL_AWAY, 176, 22, 48, 22, R), // 29 Foster Wood Truck
+ ROV( 41, 147, 240, SND_19_BUS_START_PULL_AWAY, 224, 24, 69, 45, R), // 30 Moreland Wood Truck
+ ROV( 8, 121, 90, SND_19_BUS_START_PULL_AWAY, 96, 22, 38, 12, R), // 31 MPS Iron Ore Truck
+ ROV( 25, 140, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22, R), // 32 Uhl Iron Ore Truck
+ ROV( 42, 150, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45, R), // 33 Chippy Iron Ore Truck
+ ROV( 9, 112, 90, SND_19_BUS_START_PULL_AWAY, 96, 15, 38, 12, R), // 34 Balogh Steel Truck
+ ROV( 26, 135, 168, SND_19_BUS_START_PULL_AWAY, 176, 18, 48, 22, R), // 35 Uhl Steel Truck
+ ROV( 43, 145, 240, SND_19_BUS_START_PULL_AWAY, 224, 20, 69, 45, R), // 36 Kelling Steel Truck
+ ROV( 10, 145, 90, SND_19_BUS_START_PULL_AWAY, 96, 12, 38, 12, R), // 37 Balogh Armoured Truck
+ ROV( 27, 170, 168, SND_19_BUS_START_PULL_AWAY, 176, 15, 48, 22, R), // 38 Uhl Armoured Truck
+ ROV( 44, 180, 240, SND_19_BUS_START_PULL_AWAY, 224, 16, 69, 45, R), // 39 Foster Armoured Truck
+ ROV( 11, 112, 90, SND_19_BUS_START_PULL_AWAY, 96, 17, 38, 12, R), // 40 Foster Food Van
+ ROV( 28, 134, 168, SND_19_BUS_START_PULL_AWAY, 176, 20, 48, 22, R), // 41 Perry Food Van
+ ROV( 45, 144, 240, SND_19_BUS_START_PULL_AWAY, 224, 22, 69, 45, R), // 42 Chippy Food Van
+ ROV( 12, 112, 90, SND_19_BUS_START_PULL_AWAY, 96, 15, 38, 12, R), // 43 Uhl Paper Truck
+ ROV( 29, 135, 168, SND_19_BUS_START_PULL_AWAY, 176, 18, 48, 22, R), // 44 Balogh Paper Truck
+ ROV( 46, 145, 240, SND_19_BUS_START_PULL_AWAY, 224, 20, 69, 45, R), // 45 MPS Paper Truck
+ ROV( 13, 121, 90, SND_19_BUS_START_PULL_AWAY, 96, 22, 38, 12, R), // 46 MPS Copper Ore Truck
+ ROV( 30, 140, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22, R), // 47 Uhl Copper Ore Truck
+ ROV( 47, 150, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45, R), // 48 Goss Copper Ore Truck
+ ROV( 14, 111, 90, SND_19_BUS_START_PULL_AWAY, 96, 21, 38, 12, R), // 49 Uhl Water Tanker
+ ROV( 31, 141, 168, SND_19_BUS_START_PULL_AWAY, 176, 25, 48, 22, R), // 50 Balogh Water Tanker
+ ROV( 48, 151, 240, SND_19_BUS_START_PULL_AWAY, 224, 27, 69, 45, R), // 51 MPS Water Tanker
+ ROV( 15, 118, 90, SND_19_BUS_START_PULL_AWAY, 96, 18, 38, 12, R), // 52 Balogh Fruit Truck
+ ROV( 32, 148, 168, SND_19_BUS_START_PULL_AWAY, 176, 20, 48, 22, R), // 53 Uhl Fruit Truck
+ ROV( 49, 158, 240, SND_19_BUS_START_PULL_AWAY, 224, 23, 69, 45, R), // 54 Kelling Fruit Truck
+ ROV( 16, 117, 90, SND_19_BUS_START_PULL_AWAY, 96, 17, 38, 12, R), // 55 Balogh Rubber Truck
+ ROV( 33, 147, 168, SND_19_BUS_START_PULL_AWAY, 176, 19, 48, 22, R), // 56 Uhl Rubber Truck
+ ROV( 50, 157, 240, SND_19_BUS_START_PULL_AWAY, 224, 22, 69, 45, R), // 57 RMT Rubber Truck
+ ROV( 52, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12, R), // 58 MightyMover Sugar Truck
+ ROV( 52, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22, R), // 59 Powernaught Sugar Truck
+ ROV( 52, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45, R), // 60 Wizzowow Sugar Truck
+ ROV( 53, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12, R), // 61 MightyMover Cola Truck
+ ROV( 53, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22, R), // 62 Powernaught Cola Truck
+ ROV( 53, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45, R), // 63 Wizzowow Cola Truck
+ ROV( 54, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12, R), // 64 MightyMover Candyfloss Truck
+ ROV( 54, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22, R), // 65 Powernaught Candyfloss Truck
+ ROV( 54, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45, R), // 66 Wizzowow Candyfloss Truck
+ ROV( 55, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12, R), // 67 MightyMover Toffee Truck
+ ROV( 55, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22, R), // 68 Powernaught Toffee Truck
+ ROV( 55, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45, R), // 69 Wizzowow Toffee Truck
+ ROV( 56, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12, R), // 70 MightyMover Toy Van
+ ROV( 56, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22, R), // 71 Powernaught Toy Van
+ ROV( 56, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45, R), // 72 Wizzowow Toy Van
+ ROV( 58, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12, R), // 73 MightyMover Sweet Truck
+ ROV( 58, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22, R), // 74 Powernaught Sweet Truck
+ ROV( 58, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45, R), // 75 Wizzowow Sweet Truck
+ ROV( 59, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12, R), // 76 MightyMover Battery Truck
+ ROV( 59, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22, R), // 77 Powernaught Battery Truck
+ ROV( 59, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45, R), // 78 Wizzowow Battery Truck
+ ROV( 60, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12, R), // 79 MightyMover Fizzy Drink Truck
+ ROV( 60, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22, R), // 80 Powernaught Fizzy Drink Truck
+ ROV( 60, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45, R), // 81 Wizzowow Fizzy Drink Truck
+ ROV( 61, 117, 90, SND_3F_COMEDY_CAR_3, 96, 17, 38, 12, R), // 82 MightyMover Plastic Truck
+ ROV( 61, 147, 168, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 176, 19, 48, 22, R), // 83 Powernaught Plastic Truck
+ ROV( 61, 157, 240, SND_3F_COMEDY_CAR_3, 224, 22, 69, 45, R), // 84 Wizzowow Plastic Truck
+ ROV( 62, 117, 90, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 96, 17, 38, 12, R), // 85 MightyMover Bubble Truck
+ ROV( 62, 147, 168, SND_3F_COMEDY_CAR_3, 176, 19, 48, 22, R), // 86 Powernaught Bubble Truck
+ ROV( 62, 157, 240, SND_40_COMEDY_CAR_START_AND_PULL_AWAY, 224, 22, 69, 45, R), // 87 Wizzowow Bubble Truck
};
#undef ROV
+#undef R
+#undef T
#endif /* ENGINES_H */
Index: src/table/roadtypes.h
===================================================================
--- src/table/roadtypes.h (nonexistent)
+++ src/table/roadtypes.h (working copy)
@@ -0,0 +1,142 @@
+/* $Id$ */
+
+/*
+ * 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 .
+ */
+
+/**
+ * @file roadtypes.h
+ * All the roadtype-specific information is stored here.
+ */
+
+#ifndef ROADTYPES_H
+#define ROADTYPES_H
+
+/**
+ * Global Roadtype definition
+ */
+static const RoadtypeInfo _original_roadtypes[] = {
+ /** Road */
+ {
+ {
+ STR_ROAD_NAME_ROAD,
+ STR_ROAD_TOOLBAR_ROAD_CONSTRUCTION_CAPTION,
+ STR_ROAD_MENU_ROAD_CONSTRUCTION,
+ STR_BUY_VEHICLE_ROAD_VEHICLE_CAPTION,
+ STR_REPLACE_VEHICLE_ROAD_VEHICLE,
+ STR_ENGINE_PREVIEW_ROAD_VEHICLE,
+ },
+
+ /* Powered roadtypes */
+ ROADTYPES_ROAD | ROADTYPES_TRAM,
+
+ /* Compatible roadtypes */
+ ROADTYPES_ROAD,
+
+ /* bridge offset */
+ 0,
+
+ /* fallback_roadtype */
+ 0,
+
+ /* curve speed advantage (multiplier) */
+ 0,
+
+ /* flags */
+ ROTFB_NONE,
+
+ /* cost multiplier */
+ 8,
+
+ /* maintenance cost multiplier */
+ 8,
+
+ /* max speed */
+ 0,
+
+ /* road type label */
+ 'ROAD',
+
+ /* alternate labels */
+ RoadTypeLabelList(),
+
+ /* map colour */
+ 0x0A,
+
+ /* introduction date */
+ INVALID_DATE,
+
+ /* roadtypes required for this to be introduced */
+ ROADTYPES_NONE,
+
+ /* introduction road types */
+ ROADTYPES_ROAD,
+
+ /* sort order */
+ 0 << 4 | 7,
+ },
+ /** Tram */
+ {
+ {
+ STR_ROAD_NAME_TRAM,
+ STR_ROAD_TOOLBAR_TRAM_CONSTRUCTION_CAPTION,
+ STR_ROAD_MENU_TRAM_CONSTRUCTION,
+ STR_BUY_VEHICLE_ROAD_VEHICLE_CAPTION,
+ STR_REPLACE_VEHICLE_ROAD_VEHICLE,
+ STR_ENGINE_PREVIEW_ROAD_VEHICLE,
+ },
+
+ /* Powered roadtypes */
+ ROADTYPES_ROAD | ROADTYPES_TRAM,
+
+ /* Compatible roadtypes */
+ ROADTYPES_TRAM,
+
+ /* bridge offset */
+ 0,
+
+ /* fallback_roadtype */
+ 0,
+
+ /* curve speed advantage (multiplier) */
+ 0,
+
+ /* flags */
+ ROTFB_NONE,
+
+ /* cost multiplier */
+ 8,
+
+ /* maintenance cost multiplier */
+ 8,
+
+ /* max speed */
+ 0,
+
+ /* road type label */
+ 'TRAM',
+
+ /* alternate labels */
+ RoadTypeLabelList(),
+
+ /* map colour */
+ 0x0A,
+
+ /* introduction date */
+ INVALID_DATE,
+
+ /* roadtypes required for this to be introduced */
+ ROADTYPES_NONE,
+
+ /* introduction road types */
+ ROADTYPES_TRAM,
+
+ /* sort order */
+ 1 << 4 | 7,
+ },
+};
+
+#endif /* ROADTYPES_H */
Index: src/toolbar_gui.cpp
===================================================================
--- src/toolbar_gui.cpp (revision 22430)
+++ src/toolbar_gui.cpp (working copy)
@@ -887,22 +887,7 @@
static CallBackFunction ToolbarBuildRoadClick(Window *w)
{
- const Company *c = Company::Get(_local_company);
- DropDownList *list = new DropDownList();
-
- /* Road is always visible and available. */
- *list->Append() = new DropDownListStringItem(STR_ROAD_MENU_ROAD_CONSTRUCTION, ROADTYPE_ROAD, false);
-
- /* Tram is only visible when there will be a tram, and available when that has been introduced. */
- Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
- if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
- if (!HasBit(e->info.misc_flags, EF_ROAD_TRAM)) continue;
-
- *list->Append() = new DropDownListStringItem(STR_ROAD_MENU_TRAM_CONSTRUCTION, ROADTYPE_TRAM, !HasBit(c->avail_roadtypes, ROADTYPE_TRAM));
- break;
- }
- ShowDropDownList(w, list, _last_built_roadtype, WID_TN_ROADS, 140, true, true);
+ ShowDropDownList(w, GetRoadTypeDropDownList(), _last_built_roadtype, WID_TN_ROADS, 140, true, true);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
return CBF_NONE;
}