1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 10:22:39 +01:00

(svn r12865) [0.6] -Backport from trunk r12856, r12809, r12808, r12637, r12574:

- Fix: Ensure that prop 25 is set for all vehicles in the consist before other properties as it could cause desyncs (r12856)
- Fix: Possible out of bounds array access (r12809)
- Fix: Enforce autorenew values range in command (r12808)
- Fix: Possible NULL pointer dereference when reading some NewGRF data [FS#1913] (r12637)
- Fix: Binding to a specific IP could cause OpenTTD to not register properly with the masterserver if one has multiple external interfaces (r12574)
This commit is contained in:
rubidium
2008-04-24 11:56:15 +00:00
parent 9f65c1b8f0
commit fb0afc9cca
7 changed files with 30 additions and 17 deletions

View File

@@ -200,12 +200,24 @@ void TrainConsistChanged(Vehicle* v)
/* Check the v->first cache. */
assert(u->First() == v);
if (!HasBit(EngInfo(u->engine_type)->misc_flags, EF_RAIL_TILTS)) train_can_tilt = false;
/* update the 'first engine' */
u->u.rail.first_engine = v == u ? INVALID_ENGINE : first_engine;
u->u.rail.railtype = rvi_u->railtype;
/* Set user defined data to its default value */
u->u.rail.user_def_data = rvi_u->user_def_data;
}
for (Vehicle *u = v; u != NULL; u = u->Next()) {
/* Update user defined data (must be done before other properties) */
u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, u->u.rail.user_def_data);
}
for (Vehicle *u = v; u != NULL; u = u->Next()) {
const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
if (!HasBit(EngInfo(u->engine_type)->misc_flags, EF_RAIL_TILTS)) train_can_tilt = false;
if (IsTrainEngine(u)) first_engine = u->engine_type;
/* Cache wagon override sprite group. NULL is returned if there is none */
@@ -214,9 +226,6 @@ void TrainConsistChanged(Vehicle* v)
/* Reset color map */
u->colormap = PAL_NONE;
/* Set user defined data (must be done before other properties) */
u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, rvi_u->user_def_data);
if (rvi_u->visual_effect != 0) {
u->u.rail.cached_vis_effect = rvi_u->visual_effect;
} else {