Changeset - r11035:8a2d5962fbd9
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-02-06 15:52:22
rubidium@openttd.org
(svn r15375) -Fix [FS#2605]: a tram circling around in a depot did never actually 'enter' the depot.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/roadveh_cmd.cpp
Show inline comments
 
@@ -1532,49 +1532,49 @@ again:
 
			v->u.road.state = (byte)dir;
 
			v->u.road.frame = start_frame;
 
		}
 
		if (newdir != v->direction) {
 
			v->direction = newdir;
 
			v->cur_speed -= v->cur_speed >> 2;
 
		}
 

	
 
		v->cur_image = v->GetImage(newdir);
 
		v->UpdateDeltaXY(v->direction);
 
		RoadZPosAffectSpeed(v, SetRoadVehPosition(v, x, y));
 
		return true;
 
	}
 

	
 
	if (rd.x & RDE_TURNED) {
 
		/* Vehicle has finished turning around, it will now head back onto the same tile */
 
		Trackdir dir;
 
		uint32 r;
 
		Direction newdir;
 
		const RoadDriveEntry *rdp;
 

	
 
		uint turn_around_start_frame = RVC_TURN_AROUND_START_FRAME;
 

	
 
		RoadBits tram;
 
		if (v->u.road.roadtype == ROADTYPE_TRAM && CountBits(tram = GetAnyRoadBits(v->tile, ROADTYPE_TRAM, true)) == 1) {
 
		if (v->u.road.roadtype == ROADTYPE_TRAM && !IsRoadDepotTile(v->tile) && CountBits(tram = GetAnyRoadBits(v->tile, ROADTYPE_TRAM, true)) == 1) {
 
			/*
 
			 * The tram is turning around with one tram 'roadbit'. This means that
 
			 * it is using the 'big' corner 'drive data'. However, to support the
 
			 * trams to take a small corner, there is a 'turned' marker in the middle
 
			 * of the turning 'drive data'. When the tram took the long corner, we
 
			 * will still use the 'big' corner drive data, but we advance it one
 
			 * frame. We furthermore set the driving direction so the turning is
 
			 * going to be properly shown.
 
			 */
 
			turn_around_start_frame = RVC_START_FRAME_AFTER_LONG_TRAM;
 
			switch (rd.x & 0x3) {
 
				default: NOT_REACHED();
 
				case DIAGDIR_NW: dir = TRACKDIR_RVREV_SE; break;
 
				case DIAGDIR_NE: dir = TRACKDIR_RVREV_SW; break;
 
				case DIAGDIR_SE: dir = TRACKDIR_RVREV_NW; break;
 
				case DIAGDIR_SW: dir = TRACKDIR_RVREV_NE; break;
 
			}
 
		} else {
 
			if (IsRoadVehFront(v)) {
 
				/* If this is the front engine, look for the right path. */
 
				dir = RoadFindPathToDest(v, v->tile, (DiagDirection)(rd.x & 3));
 
			} else {
 
				dir = FollowPreviousRoadVehicle(v, prev, v->tile, (DiagDirection)(rd.x & 3), true);
 
			}
0 comments (0 inline, 0 general)