--- a/newgrf_config.c Sun Mar 11 23:03:14 2007 +0000
+++ b/newgrf_config.c Mon Mar 19 18:47:10 2007 +0000
@@ -241,8 +241,8 @@
free(c->filename);
c->filename = strdup(f->filename);
memcpy(c->md5sum, f->md5sum, sizeof(c->md5sum));
- if (c->name == NULL) c->name = strdup(f->name);
- if (c->info == NULL) c->info = strdup(f->info);
+ if (c->name == NULL && f->name != NULL) c->name = strdup(f->name);
+ if (c->info == NULL && f->info != NULL) c->info = strdup(f->info);
}
}
}
--- a/newgrf_engine.c Sun Mar 11 23:03:14 2007 +0000
+++ b/newgrf_engine.c Mon Mar 19 18:47:10 2007 +0000
@@ -523,21 +523,6 @@
}
-static uint32 GetVehicleTypeInfo(EngineID engine_type)
-{
- /* Bit 0 Vehicle type is available on the market
- * Bit 1 Vehicle type is in the testing phase
- * Bit 2 Exclusive testing offer for a human player active */
- const Engine *e = GetEngine(engine_type);
- uint32 var = 0;
-
- if (e->player_avail == 0xFF) SETBIT(var, 0);
- if (e->age < e->duration_phase_1) SETBIT(var, 1);
- if (e->player_avail > 0 && e->player_avail != 0xFF) SETBIT(var, 2);
- return var;
-}
-
-
static uint32 GetGRFParameter(EngineID engine_type, byte parameter)
{
const GRFFile *file = GetEngineGRF(engine_type);
@@ -556,7 +541,7 @@
switch (variable) {
case 0x43: return _current_player; /* Owner information */
case 0x46: return 0; /* Motion counter */
- case 0x48: return GetVehicleTypeInfo(object->u.vehicle.self_type); /* Vehicle Type Info */
+ case 0x48: return GetEngine(object->u.vehicle.self_type)->flags; /* Vehicle Type Info */
case 0xC4: return clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; /* Build year */
case 0xDA: return INVALID_VEHICLE; /* Next vehicle */
case 0x7F: return GetGRFParameter(object->u.vehicle.self_type, parameter); /* Read GRF parameter */
@@ -669,7 +654,7 @@
return (_cargo_classes[cid] << 16) | (_cargoc.weights[v->cargo_type] << 8) | cid;
}
- case 0x48: return GetVehicleTypeInfo(v->engine_type); /* Vehicle Type Info */
+ case 0x48: return GetEngine(v->engine_type)->flags; /* Vehicle Type Info */
/* Variables which use the parameter */
case 0x60: /* Count consist's engine ID occurance */
--- a/openttd.c Sun Mar 11 23:03:14 2007 +0000
+++ b/openttd.c Mon Mar 19 18:47:10 2007 +0000
@@ -1611,6 +1611,7 @@
/* reload vehicles */
ResetVehiclePosHash();
AfterLoadVehicles();
+ StartupEngines();
/* update station and waypoint graphics */
AfterLoadWaypoints();
AfterLoadStations();
--- a/rail_gui.c Sun Mar 11 23:03:14 2007 +0000
+++ b/rail_gui.c Mon Mar 19 18:47:10 2007 +0000
@@ -795,16 +795,33 @@
case 8:
case 9:
case 10:
- case 11:
+ case 11: {
+ const StationSpec *statspec;
RaiseWindowWidget(w, _railstation.numtracks + 4);
RaiseWindowWidget(w, 19);
+
_railstation.numtracks = (e->we.click.widget - 5) + 1;
_railstation.dragdrop = false;
+
+ statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
+ if (statspec != NULL && HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
+ /* The previously selected number of platforms in invalid */
+ uint i;
+ for (i = 0; i < 7; i++) {
+ if (!HASBIT(statspec->disallowed_lengths, i)) {
+ RaiseWindowWidget(w, _railstation.platlength + 11);
+ _railstation.platlength = i + 1;
+ break;
+ }
+ }
+ }
+
LowerWindowWidget(w, _railstation.platlength + 11);
LowerWindowWidget(w, _railstation.numtracks + 4);
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
break;
+ }
case 12:
case 13:
@@ -812,16 +829,33 @@
case 15:
case 16:
case 17:
- case 18:
+ case 18: {
+ const StationSpec *statspec;
RaiseWindowWidget(w, _railstation.platlength + 11);
RaiseWindowWidget(w, 19);
+
_railstation.platlength = (e->we.click.widget - 12) + 1;
_railstation.dragdrop = false;
+
+ statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
+ if (statspec != NULL && HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
+ /* The previously selected number of tracks in invalid */
+ uint i;
+ for (i = 0; i < 7; i++) {
+ if (!HASBIT(statspec->disallowed_platforms, i)) {
+ RaiseWindowWidget(w, _railstation.numtracks + 4);
+ _railstation.numtracks = i + 1;
+ break;
+ }
+ }
+ }
+
LowerWindowWidget(w, _railstation.platlength + 11);
LowerWindowWidget(w, _railstation.numtracks + 4);
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
break;
+ }
case 19:
_railstation.dragdrop ^= true;
--- a/tunnelbridge_cmd.c Sun Mar 11 23:03:14 2007 +0000
+++ b/tunnelbridge_cmd.c Mon Mar 19 18:47:10 2007 +0000
@@ -1376,7 +1376,7 @@
if (v->u.rail.track != 0x40 && dir == vdir) {
if (IsFrontEngine(v) && fc == _tunnel_fractcoord_1[dir]) {
- if (!PlayVehicleSound(v, VSE_TUNNEL) && v->spritenum < 4) {
+ if (!PlayVehicleSound(v, VSE_TUNNEL) && RailVehInfo(v->engine_type)->engclass == 0) {
SndPlayVehicleFx(SND_05_TRAIN_THROUGH_TUNNEL, v);
}
return 0;