(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
--- a/ai.c Fri Dec 03 14:38:02 2004 +0000
+++ b/ai.c Fri Dec 03 21:57:05 2004 +0000
@@ -121,7 +121,7 @@
int i;
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
- RailVehicleInfo *rvi = &rail_vehinfo(i);
+ const RailVehicleInfo *rvi = rail_vehinfo(i);
Engine *e = DEREF_ENGINE(i);
if (e->railtype != railtype || rvi->flags & RVI_WAGON
--- a/ai_new.c Fri Dec 03 14:38:02 2004 +0000
+++ b/ai_new.c Fri Dec 03 21:57:05 2004 +0000
@@ -568,7 +568,7 @@
if (p->ainew.tbt == AI_BUS && (FACIL_BUS_STOP & st->facilities) == FACIL_BUS_STOP) {
if (st->town == town) {
// Check how much cargo there is left in the station
- if ((st->goods[p->ainew.cargo].waiting_acceptance & 0xFFF) > road_vehicle_info(i)->capacity * AI_STATION_REUSE_MULTIPLER) {
+ if ((st->goods[p->ainew.cargo].waiting_acceptance & 0xFFF) > RoadVehInfo(i)->capacity * AI_STATION_REUSE_MULTIPLER) {
if (AiNew_CheckVehicleStation(p, st)) {
// We did found a station that was good enough!
new_tile = st->xy;
@@ -827,7 +827,7 @@
// Passenger run.. how long is the route?
length = p->ainew.path_info.route_length;
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
- tiles_a_day = road_vehicle_info(i)->max_speed * DAY_TICKS / 256 / 16;
+ tiles_a_day = RoadVehInfo(i)->max_speed * DAY_TICKS / 256 / 16;
// We want a vehicle in a station once a month at least, so, calculate it!
// (the * 2 is because we have 2 stations ;))
amount = ((int)(((float)length / (float)tiles_a_day / 30 * 2))) * 2;
@@ -842,7 +842,7 @@
// Passenger run.. how long is the route?
length = p->ainew.path_info.route_length;
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
- tiles_a_day = road_vehicle_info(i)->max_speed * DAY_TICKS / 256 / 16;
+ tiles_a_day = RoadVehInfo(i)->max_speed * DAY_TICKS / 256 / 16;
if (p->ainew.from_deliver)
max_cargo = DEREF_INDUSTRY(p->ainew.from_ic)->total_production[0];
else
@@ -853,7 +853,7 @@
// We want all the cargo to be gone in a month.. so, we know the cargo it delivers
// we know what the vehicle takes with him, and we know the time it takes him
// to get back here.. now let's do some math!
- amount = (int)(((float)length / (float)tiles_a_day / 30 * 2) * ((float)max_cargo / (float)road_vehicle_info(i)->capacity));
+ amount = (int)(((float)length / (float)tiles_a_day / 30 * 2) * ((float)max_cargo / (float)RoadVehInfo(i)->capacity));
amount += 1;
return amount;
} else {
--- a/aircraft_cmd.c Fri Dec 03 14:38:02 2004 +0000
+++ b/aircraft_cmd.c Fri Dec 03 21:57:05 2004 +0000
@@ -46,7 +46,7 @@
void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod)
{
- int spritenum = aircraft_vehinfo(engine).image_index;
+ int spritenum = AircraftVehInfo(engine)->image_index;
if (is_custom_sprite(spritenum)) {
int sprite = GetCustomVehicleIcon(engine, 6);
@@ -60,17 +60,18 @@
DrawSprite((6 + _aircraft_sprite[spritenum]) | image_ormod, x, y);
- if ((aircraft_vehinfo(engine).subtype & 1) == 0)
+ if ((AircraftVehInfo(engine)->subtype & 1) == 0)
DrawSprite(0xF3D, x, y-5);
}
void DrawAircraftEngineInfo(int engine, int x, int y, int maxw)
{
- SetDParam(0, ((_price.aircraft_base >> 3) * aircraft_vehinfo(engine).base_cost) >> 5);
- SetDParam(1, aircraft_vehinfo(engine).max_speed << 3);
- SetDParam(2, aircraft_vehinfo(engine).passanger_capacity);
- SetDParam(3, aircraft_vehinfo(engine).mail_capacity);
- SetDParam(4, aircraft_vehinfo(engine).running_cost * _price.aircraft_running >> 8);
+ const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
+ SetDParam(0, ((_price.aircraft_base >> 3) * avi->base_cost) >> 5);
+ SetDParam(1, avi->max_speed << 3);
+ SetDParam(2, avi->passanger_capacity);
+ SetDParam(3, avi->mail_capacity);
+ SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
}
@@ -100,7 +101,7 @@
static int32 EstimateAircraftCost(uint16 engine_type)
{
- return aircraft_vehinfo(engine_type).base_cost * (_price.aircraft_base>>3)>>5;
+ return AircraftVehInfo(engine_type)->base_cost * (_price.aircraft_base>>3)>>5;
}
@@ -111,6 +112,7 @@
Vehicle *vl[3], *v, *u, *w;
byte unit_num;
uint tile = TILE_FROM_XY(x,y);
+ const AircraftVehicleInfo *avi = AircraftVehInfo(p1);
Engine *e;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -121,7 +123,7 @@
return value;
// allocate 2 or 3 vehicle structs, depending on type
- if (!AllocateVehicles(vl, (aircraft_vehinfo(p1).subtype & 1) == 0 ? 3 : 2) ||
+ if (!AllocateVehicles(vl, (avi->subtype & 1) == 0 ? 3 : 2) ||
_ptr_to_next_order >= endof(_order_array))
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -163,11 +165,11 @@
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
u->vehstatus = VS_HIDDEN | VS_UNCLICKABLE | VS_DISASTER;
- v->spritenum = aircraft_vehinfo(p1).image_index;
+ v->spritenum = avi->image_index;
// v->cargo_count = u->number_of_pieces = 0;
- v->cargo_cap = aircraft_vehinfo(p1).passanger_capacity;
- u->cargo_cap = aircraft_vehinfo(p1).mail_capacity;
+ v->cargo_cap = avi->passanger_capacity;
+ u->cargo_cap = avi->mail_capacity;
v->cargo_type = CT_PASSENGERS;
u->cargo_type = CT_MAIL;
@@ -180,11 +182,11 @@
v->last_station_visited = 0xFF;
// v->destination_coords = 0;
- v->max_speed = aircraft_vehinfo(p1).max_speed;
- v->acceleration = aircraft_vehinfo(p1).acceleration;
+ v->max_speed = avi->max_speed;
+ v->acceleration = avi->acceleration;
v->engine_type = (byte)p1;
- v->subtype = (aircraft_vehinfo(p1).subtype & 1) == 0 ? 0 : 2;
+ v->subtype = (avi->subtype & 1) == 0 ? 0 : 2;
v->value = value;
u->subtype = 4;
@@ -416,7 +418,7 @@
if (!CheckOwnership(v->owner) || !CheckStoppedInHangar(v))
return CMD_ERROR;
- pass = aircraft_vehinfo(v->engine_type).passanger_capacity;
+ pass = AircraftVehInfo(v->engine_type)->passanger_capacity;
if (p2 != 0) {
pass >>= 1;
if (p2 != 5)
@@ -433,7 +435,7 @@
v->cargo_cap = pass;
u = v->next;
- mail = aircraft_vehinfo(v->engine_type).mail_capacity;
+ mail = AircraftVehInfo(v->engine_type)->mail_capacity;
if (p2 != 0) {
mail = 0;
}
@@ -502,7 +504,7 @@
if (v->vehstatus & VS_STOPPED)
return;
- cost = aircraft_vehinfo(v->engine_type).running_cost * _price.aircraft_running / 364;
+ cost = AircraftVehInfo(v->engine_type)->running_cost * _price.aircraft_running / 364;
v->profit_this_year -= cost >> 8;
@@ -652,7 +654,7 @@
static void PlayAircraftSound(Vehicle *v)
{
- SndPlayVehicleFx(aircraft_vehinfo(v->engine_type).sfx, v);
+ SndPlayVehicleFx(AircraftVehInfo(v->engine_type)->sfx, v);
}
static bool UpdateAircraftSpeed(Vehicle *v)
@@ -1062,7 +1064,7 @@
//FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports
prob = 0x10000 / 1500;
- if (st->airport_type == AT_SMALL && (aircraft_vehinfo(v->engine_type).subtype & 2) && !_cheats.no_jetcrash.value) {
+ if (st->airport_type == AT_SMALL && (AircraftVehInfo(v->engine_type)->subtype & 2) && !_cheats.no_jetcrash.value) {
prob = 0x10000 / 20;
}
--- a/aircraft_gui.c Fri Dec 03 14:38:02 2004 +0000
+++ b/aircraft_gui.c Fri Dec 03 21:57:05 2004 +0000
@@ -88,13 +88,14 @@
WP(w,buildtrain_d).sel_engine = selected_id;
if (selected_id != -1) {
+ const AircraftVehicleInfo *avi = AircraftVehInfo(selected_id);
Engine *e;
- SetDParam(0, aircraft_vehinfo(selected_id).base_cost * (_price.aircraft_base>>3)>>5);
- SetDParam(1, aircraft_vehinfo(selected_id).max_speed * 8);
- SetDParam(2, aircraft_vehinfo(selected_id).passanger_capacity);
- SetDParam(3, aircraft_vehinfo(selected_id).mail_capacity);
- SetDParam(4, aircraft_vehinfo(selected_id).running_cost * _price.aircraft_running >> 8);
+ SetDParam(0, avi->base_cost * (_price.aircraft_base>>3)>>5);
+ SetDParam(1, avi->max_speed * 8);
+ SetDParam(2, avi->passanger_capacity);
+ SetDParam(3, avi->mail_capacity);
+ SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
e = &_engines[selected_id];
SetDParam(6, e->lifelength);
@@ -350,7 +351,7 @@
}
SetDParam(0, str);
SetDParam(2, v->max_age / 366);
- SetDParam(3, _price.aircraft_running * aircraft_vehinfo(v->engine_type).running_cost >> 8);
+ SetDParam(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost >> 8);
DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0);
}
--- a/engine.h Fri Dec 03 14:38:02 2004 +0000
+++ b/engine.h Fri Dec 03 21:57:05 2004 +0000
@@ -156,12 +156,29 @@
extern ShipVehicleInfo _ship_vehicle_info[NUM_SHIP_ENGINES];
extern AircraftVehicleInfo _aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES];
extern RoadVehicleInfo _road_vehicle_info[NUM_ROAD_ENGINES];
-/* TODO: Change this to return a pointer type instead, for the sake of consistency.
- * --pasky. XXX - really needed? Why?. Best to remove the pointer type as well cause
- * _map uses it that way...less conflicts - Darkvater */
-#define rail_vehinfo(e) _rail_vehicle_info[e]
-#define ship_vehicle_info(e) _ship_vehicle_info[e - SHIP_ENGINES_INDEX]
-#define aircraft_vehinfo(e) _aircraft_vehicle_info[e - AIRCRAFT_ENGINES_INDEX]
-#define road_vehicle_info(e) (&_road_vehicle_info[e - ROAD_ENGINES_INDEX])
+
+static inline RailVehicleInfo *rail_vehinfo(uint e)
+{
+ assert(e < lengthof(_rail_vehicle_info));
+ return &_rail_vehicle_info[e];
+}
+
+static inline ShipVehicleInfo *ShipVehInfo(uint e)
+{
+ assert(e - SHIP_ENGINES_INDEX < lengthof(_ship_vehicle_info));
+ return &_ship_vehicle_info[e - SHIP_ENGINES_INDEX];
+}
+
+static inline AircraftVehicleInfo *AircraftVehInfo(uint e)
+{
+ assert(e - AIRCRAFT_ENGINES_INDEX < lengthof(_aircraft_vehicle_info));
+ return &_aircraft_vehicle_info[e - AIRCRAFT_ENGINES_INDEX];
+}
+
+static inline RoadVehicleInfo *RoadVehInfo(uint e)
+{
+ assert(e - ROAD_ENGINES_INDEX < lengthof(_road_vehicle_info));
+ return &_road_vehicle_info[e - ROAD_ENGINES_INDEX];
+}
#endif
--- a/roadveh_cmd.c Fri Dec 03 14:38:02 2004 +0000
+++ b/roadveh_cmd.c Fri Dec 03 21:57:05 2004 +0000
@@ -71,7 +71,7 @@
void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod)
{
- int spritenum = road_vehicle_info(engine)->image_index;
+ int spritenum = RoadVehInfo(engine)->image_index;
if (is_custom_sprite(spritenum)) {
int sprite = GetCustomVehicleIcon(engine, 6);
@@ -87,19 +87,21 @@
void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw)
{
- SetDParam(0, ((_price.roadveh_base >> 3) * road_vehicle_info(engine)->base_cost) >> 5);
- SetDParam(1, road_vehicle_info(engine)->max_speed * 10 >> 5);
- SetDParam(2, road_vehicle_info(engine)->running_cost * _price.roadveh_running >> 8);
+ const RoadVehicleInfo *rvi = RoadVehInfo(engine);
- SetDParam(4, road_vehicle_info(engine)->capacity);
- SetDParam(3, _cargoc.names_long_p[road_vehicle_info(engine)->cargo_type]);
+ SetDParam(0, ((_price.roadveh_base >> 3) * rvi->base_cost) >> 5);
+ SetDParam(1, rvi->max_speed * 10 >> 5);
+ SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
+
+ SetDParam(4, rvi->capacity);
+ SetDParam(3, _cargoc.names_long_p[rvi->cargo_type]);
DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw);
}
static int32 EstimateRoadVehCost(byte engine_type)
{
- return ((_price.roadveh_base >> 3) * road_vehicle_info(engine_type)->base_cost) >> 5;
+ return ((_price.roadveh_base >> 3) * RoadVehInfo(engine_type)->base_cost) >> 5;
}
int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2)
@@ -126,6 +128,8 @@
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) {
+ const RoadVehicleInfo *rvi = RoadVehInfo(p1);
+
v->unitnumber = unit_num;
v->direction = 0;
v->owner = _current_player;
@@ -141,9 +145,9 @@
v->u.road.state = 254;
v->vehstatus = VS_HIDDEN|VS_STOPPED|VS_DEFPAL;
- v->spritenum = road_vehicle_info(p1)->image_index;
- v->cargo_type = road_vehicle_info(p1)->cargo_type;
- v->cargo_cap = road_vehicle_info(p1)->capacity;
+ v->spritenum = rvi->image_index;
+ v->cargo_type = rvi->cargo_type;
+ v->cargo_cap = rvi->capacity;
// v->cargo_count = 0;
v->value = cost;
// v->day_counter = 0;
@@ -155,7 +159,7 @@
// v->u.road.overtaking = 0;
v->last_station_visited = 0xFF;
- v->max_speed = road_vehicle_info(p1)->max_speed;
+ v->max_speed = rvi->max_speed;
v->engine_type = (byte)p1;
e = &_engines[p1];
@@ -631,7 +635,7 @@
static void StartRoadVehSound(Vehicle *v)
{
- int s = road_vehicle_info(v->engine_type)->sfx;
+ int s = RoadVehInfo(v->engine_type)->sfx;
if (s == 23 && (v->tick_counter&3) == 0) s++;
SndPlayVehicleFx(s, v);
}
@@ -1476,7 +1480,7 @@
if (v->vehstatus & VS_STOPPED)
return;
- cost = road_vehicle_info(v->engine_type)->running_cost * _price.roadveh_running / 364;
+ cost = RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running / 364;
v->profit_this_year -= cost >> 8;
--- a/roadveh_gui.c Fri Dec 03 14:38:02 2004 +0000
+++ b/roadveh_gui.c Fri Dec 03 21:57:05 2004 +0000
@@ -54,7 +54,7 @@
}
SetDParam(0, str);
SetDParam(2, v->max_age / 366);
- SetDParam(3, road_vehicle_info(v->engine_type)->running_cost * _price.roadveh_running >> 8);
+ SetDParam(3, RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running >> 8);
DrawString(2, 15, STR_900D_AGE_RUNNING_COST_YR, 0);
}
@@ -348,13 +348,14 @@
WP(w,buildtrain_d).sel_engine = selected_id;
if (selected_id != -1) {
+ const RoadVehicleInfo *rvi = RoadVehInfo(selected_id);
Engine *e;
- SetDParam(0, road_vehicle_info(selected_id)->base_cost * (_price.roadveh_base>>3)>>5);
- SetDParam(1, road_vehicle_info(selected_id)->max_speed * 10 >> 5);
- SetDParam(2, road_vehicle_info(selected_id)->running_cost * _price.roadveh_running >> 8);
- SetDParam(4, road_vehicle_info(selected_id)->capacity);
- SetDParam(3, _cargoc.names_long_p[road_vehicle_info(selected_id)->cargo_type]);
+ SetDParam(0, rvi->base_cost * (_price.roadveh_base>>3)>>5);
+ SetDParam(1, rvi->max_speed * 10 >> 5);
+ SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
+ SetDParam(4, rvi->capacity);
+ SetDParam(3, _cargoc.names_long_p[rvi->cargo_type]);
e = &_engines[selected_id];
SetDParam(6, e->lifelength);
--- a/ship_cmd.c Fri Dec 03 14:38:02 2004 +0000
+++ b/ship_cmd.c Fri Dec 03 21:57:05 2004 +0000
@@ -22,7 +22,7 @@
void DrawShipEngine(int x, int y, int engine, uint32 image_ormod)
{
- int spritenum = ship_vehicle_info(engine).image_index;
+ int spritenum = ShipVehInfo(engine)->image_index;
if (is_custom_sprite(spritenum)) {
int sprite = GetCustomVehicleIcon(engine, 6);
@@ -38,7 +38,7 @@
void DrawShipEngineInfo(int engine, int x, int y, int maxw)
{
- ShipVehicleInfo *svi = &ship_vehicle_info(engine);
+ const ShipVehicleInfo *svi = ShipVehInfo(engine);
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
SetDParam(1, svi->max_speed * 10 >> 5);
SetDParam(2, _cargoc.names_long_p[svi->cargo_type]);
@@ -135,7 +135,7 @@
- cost = ship_vehicle_info(v->engine_type).running_cost * _price.ship_running / 364;
+ cost = ShipVehInfo(v->engine_type)->running_cost * _price.ship_running / 364;
v->profit_this_year -= cost >> 8;
SET_EXPENSES_TYPE(EXPENSES_SHIP_RUN);
@@ -182,7 +182,7 @@
static void PlayShipSound(Vehicle *v)
{
- SndPlayVehicleFx(ship_vehicle_info(v->engine_type).sfx, v);
+ SndPlayVehicleFx(ShipVehInfo(v->engine_type)->sfx, v);
}
static const TileIndexDiff _dock_offs[] = {
@@ -782,7 +782,7 @@
static int32 EstimateShipCost(uint16 engine_type)
{
- return ship_vehicle_info(engine_type).base_cost * (_price.ship_base>>3)>>5;
+ return ShipVehInfo(engine_type)->base_cost * (_price.ship_base>>3)>>5;
}
// p1 = type to build
@@ -806,6 +806,8 @@
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) {
+ const ShipVehicleInfo *svi = ShipVehInfo(p1);
+
v->unitnumber = unit_num;
v->owner = _current_player;
@@ -823,13 +825,13 @@
v->y_offs = -3;
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
- v->spritenum = ship_vehicle_info(p1).image_index;
- v->cargo_type = ship_vehicle_info(p1).cargo_type;
- v->cargo_cap = ship_vehicle_info(p1).capacity;
+ v->spritenum = svi->image_index;
+ v->cargo_type = svi->cargo_type;
+ v->cargo_cap = svi->capacity;
v->value = value;
v->last_station_visited = 255;
- v->max_speed = ship_vehicle_info(p1).max_speed;
+ v->max_speed = svi->max_speed;
v->engine_type = (byte)p1;
e = &_engines[p1];
--- a/ship_gui.c Fri Dec 03 14:38:02 2004 +0000
+++ b/ship_gui.c Fri Dec 03 21:57:05 2004 +0000
@@ -175,7 +175,7 @@
}
SetDParam(0, str);
SetDParam(2, v->max_age / 366);
- SetDParam(3, ship_vehicle_info(v->engine_type).running_cost * _price.ship_running >> 8);
+ SetDParam(3, ShipVehInfo(v->engine_type)->running_cost * _price.ship_running >> 8);
DrawString(2, 15, STR_9812_AGE_RUNNING_COST_YR, 0);
}
@@ -361,14 +361,15 @@
WP(w,buildtrain_d).sel_engine = selected_id;
if (selected_id != -1) {
+ const ShipVehicleInfo *svi = ShipVehInfo(selected_id);
Engine *e;
- SetDParam(0, ship_vehicle_info(selected_id).base_cost * (_price.ship_base>>3)>>5);
- SetDParam(1, ship_vehicle_info(selected_id).max_speed * 10 >> 5);
- SetDParam(2, _cargoc.names_long_p[ship_vehicle_info(selected_id).cargo_type]);
- SetDParam(3, ship_vehicle_info(selected_id).capacity);
- SetDParam(4, ship_vehicle_info(selected_id).refittable ? STR_9842_REFITTABLE : STR_EMPTY);
- SetDParam(5, ship_vehicle_info(selected_id).running_cost * _price.ship_running >> 8);
+ SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
+ SetDParam(1, svi->max_speed * 10 >> 5);
+ SetDParam(2, _cargoc.names_long_p[svi->cargo_type]);
+ SetDParam(3, svi->capacity);
+ SetDParam(4, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY);
+ SetDParam(5, svi->running_cost * _price.ship_running >> 8);
e = &_engines[selected_id];
SetDParam(7, e->lifelength);
@@ -474,7 +475,7 @@
StringID str;
// Possible to refit?
- if (ship_vehicle_info(v->engine_type).refittable &&
+ if (ShipVehInfo(v->engine_type)->refittable &&
v->vehstatus&VS_STOPPED &&
v->u.ship.state == 0x80 &&
IsShipDepotTile(v->tile))
--- a/train_gui.c Fri Dec 03 14:38:02 2004 +0000
+++ b/train_gui.c Fri Dec 03 21:57:05 2004 +0000
@@ -65,7 +65,7 @@
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
const Engine *e = DEREF_ENGINE(i);
- const RailVehicleInfo *rvi = &rail_vehinfo(i);
+ const RailVehicleInfo *rvi = rail_vehinfo(i);
if (e->railtype != railtype || !(rvi->flags & RVI_WAGON) != is_engine ||
!HASBIT(e->player_avail, _local_player))
@@ -128,7 +128,7 @@
WP(w,buildtrain_d).sel_engine = selected_id;
if (selected_id != -1) {
- const RailVehicleInfo *rvi = &rail_vehinfo(selected_id);
+ const RailVehicleInfo *rvi = rail_vehinfo(selected_id);
Engine *e;
YearMonthDay ymd;