roadveh_cmd.c
changeset 3168 34cfe6f61a12
parent 3167 197b5ee5a831
child 3169 b7ee0268325c
equal deleted inserted replaced
3167:197b5ee5a831 3168:34cfe6f61a12
   852 	return _roadveh_new_dir[y * 4 + x];
   852 	return _roadveh_new_dir[y * 4 + x];
   853 }
   853 }
   854 
   854 
   855 static Direction RoadVehGetSlidingDirection(const Vehicle* v, int x, int y)
   855 static Direction RoadVehGetSlidingDirection(const Vehicle* v, int x, int y)
   856 {
   856 {
   857 	Direction b = RoadVehGetNewDirection(v, x, y);
   857 	Direction new = RoadVehGetNewDirection(v, x, y);
   858 	Direction d = v->direction;
   858 	Direction old = v->direction;
   859 	DirDiff delta;
   859 	DirDiff delta;
   860 
   860 
   861 	if (b == d) return d;
   861 	if (new == old) return old;
   862 	delta = (DirDifference(d, b) > DIRDIFF_REVERSE ? DIRDIFF_45LEFT : DIRDIFF_45RIGHT);
   862 	delta = (DirDifference(new, old) > DIRDIFF_REVERSE ? DIRDIFF_45LEFT : DIRDIFF_45RIGHT);
   863 	return ChangeDir(d, delta);
   863 	return ChangeDir(old, delta);
   864 }
   864 }
   865 
   865 
   866 typedef struct OvertakeData {
   866 typedef struct OvertakeData {
   867 	const Vehicle* u;
   867 	const Vehicle* u;
   868 	const Vehicle* v;
   868 	const Vehicle* v;