Changeset - r3257:ccaf7c50364f
[Not reviewed]
master
0 1 0
bjarni - 19 years ago 2006-03-18 13:15:34
bjarni@openttd.org
(svn r3945) cleaned the layout in CmdReverseTrainDirection a bit (made a bit messy in last commit)
1 file changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -1592,33 +1592,33 @@ static void ReverseTrainDirection(Vehicl
 

	
 
	v = GetVehicle(p1);
 

	
 
	if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
 

	
 
	if (p2) {
 
		// turn a single unit around
 
		Vehicle *front;
 

	
 
		if (IsMultiheaded(v) || HASBIT(RailVehInfo(v->engine_type)->callbackmask, CBM_ARTIC_ENGINE)) {
 
			return_cmd_error(STR_ONLY_TURN_SINGLE_UNIT);
 
		}
 

	
 
		front = GetFirstVehicleInChain(v);
 
		// make sure the vehicle is stopped in the depot
 
		if (CheckTrainStoppedInDepot(front) < 0) {
 
			return_cmd_error(STR_881A_TRAINS_CAN_ONLY_BE_ALTERED);
 
		}
 
	}
 
//	if (v->u.rail.track & 0x80 || IsTileDepotType(v->tile, TRANSPORT_RAIL))
 
//		return CMD_ERROR;
 

	
 
	if (v->u.rail.crash_anim_pos != 0 || v->breakdown_ctr != 0) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		if (p2) {
 

	
 
		if (flags & DC_EXEC) {
 
			v->u.rail.flags ^= 1 << VRF_REVERSE_DIRECTION;
 
		} else {
 
		}
 
	} else {
 
		//turn the whole train around
 
		if (v->u.rail.crash_anim_pos != 0 || v->breakdown_ctr != 0) return CMD_ERROR;
 

	
 
		if (flags & DC_EXEC) {
 
			if (_patches.realistic_acceleration && v->cur_speed != 0) {
 
				TOGGLEBIT(v->u.rail.flags, VRF_REVERSING);
 
			} else {
 
				v->cur_speed = 0;
 
				SetLastSpeed(v, 0);
 
				ReverseTrainDirection(v);
0 comments (0 inline, 0 general)