Changeset - r1137:73b91a0f80ab
[Not reviewed]
master
0 1 0
celestar - 20 years ago 2005-01-24 14:39:22
celestar@openttd.org
(svn r1638) -Fix: Train crashes should no longer desync the game. This is more of a
workaround, as somewhere there might be some InteractiveRandom() abuse
in the code.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -2358,13 +2358,13 @@ static void ChangeTrainDirRandomly(Vehic
 
{
 
	static int8 _random_dir_change[4] = { -1, 0, 0, 1};
 

	
 
	do {
 
		//I need to buffer the train direction
 
		if (!(v->u.rail.track & 0x40))
 
			v->direction = (v->direction + _random_dir_change[InteractiveRandom()&3]) & 7;
 
			v->direction = (v->direction + _random_dir_change[Random()&3]) & 7;
 
		if (!(v->vehstatus & VS_HIDDEN)) {
 
			BeginVehicleMove(v);
 
			UpdateTrainDeltaXY(v, v->direction);
 
			v->cur_image = GetTrainImage(v, v->direction);
 
			AfterSetTrainPos(v, false);
 
		}
 
@@ -2378,19 +2378,19 @@ static void HandleCrashedTrain(Vehicle *
 
	Vehicle *u;
 

	
 
	if ( (state == 4) && (v->u.rail.track != 0x40) ) {
 
		CreateEffectVehicleRel(v, 4, 4, 8, EV_CRASHED_SMOKE);
 
	}
 

	
 
	if (state <= 200 && (uint16)(r=InteractiveRandom()) <= 0x2492) {
 
	if (state <= 200 && (uint16)(r=Random()) <= 0x2492) {
 
		index = (r * 10 >> 16);
 

	
 
		u = v;
 
		do {
 
			if (--index < 0) {
 
				r = InteractiveRandom();
 
				r = Random();
 

	
 
				CreateEffectVehicleRel(u,
 
					2 + ((r>>8)&7),
 
					2 + ((r>>16)&7),
 
					5 + (r&7),
 
					EV_DEMOLISH);
0 comments (0 inline, 0 general)