mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-17 01:12:39 +01:00
(svn r13811) [0.6] -Backport from trunk:
- Fix: Several minor memory leaks. They only happened once per game (r13809, 13810) - Fix: Checking for train waiting at other side of two-way signal was broken [FS#2162] (r13806) - Fix: Some revision checking code was unintentionally disabled (r13776) - Fix: Enforce the validity of a NetworkAction (chat packet) issued by a client (r13775) - Fix: Selecting non-full length vehicles in the depot gui would place the "mouse pointer" out of the center of the vehicle making it hard to "aim" [FS#2147] (r13759)
This commit is contained in:
@@ -3041,13 +3041,13 @@ static void CheckTrainCollision(Vehicle *v)
|
||||
|
||||
static void *CheckVehicleAtSignal(Vehicle *v, void *data)
|
||||
{
|
||||
Direction dir = *(Direction*)data;
|
||||
DiagDirection exitdir = *(DiagDirection *)data;
|
||||
|
||||
if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
|
||||
DirDiff diff = ChangeDirDiff(DirDifference(v->direction, dir), DIRDIFF_90RIGHT);
|
||||
|
||||
if (diff == DIRDIFF_90RIGHT || (v->cur_speed <= 5 && diff <= DIRDIFF_REVERSE)) return v;
|
||||
/* front engine of a train, not inside wormhole or depot */
|
||||
if (v->type == VEH_TRAIN && IsFrontEngine(v) && (v->u.rail.track & TRACK_BIT_MASK) != 0) {
|
||||
if (v->cur_speed <= 5 && TrainExitDir(v->direction, v->u.rail.track) == exitdir) return v;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3138,11 +3138,13 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
|
||||
v->subspeed = 0;
|
||||
v->progress = 255 - 10;
|
||||
if (++v->load_unload_time_rem < _patches.wait_twoway_signal * 73) {
|
||||
TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir);
|
||||
Direction rdir = ReverseDir(dir);
|
||||
DiagDirection exitdir = TrackdirToExitdir(i);
|
||||
TileIndex o_tile = TileAddByDiagDir(gp.new_tile, exitdir);
|
||||
|
||||
exitdir = ReverseDiagDir(exitdir);
|
||||
|
||||
/* check if a train is waiting on the other side */
|
||||
if (VehicleFromPos(o_tile, &rdir, &CheckVehicleAtSignal) == NULL) return;
|
||||
if (VehicleFromPos(o_tile, &exitdir, &CheckVehicleAtSignal) == NULL) return;
|
||||
}
|
||||
}
|
||||
goto reverse_train_direction;
|
||||
|
||||
Reference in New Issue
Block a user