changeset 3054:724f86a46f16 draft

(svn r3643) Remove a local variable which is just a pointer to a road stop status field and had the sensible name 'b'; instead directly use the road stop status field
author tron <tron@openttd.org>
date Tue, 21 Feb 2006 06:43:53 +0000
parents 7da563c4a183
children 570ea60d1e87
files roadveh_cmd.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -1294,11 +1294,10 @@
 			}
 			if (IS_BYTE_INSIDE(_m[v->tile].m5, 0x43, 0x4B)) {
 				RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
-				byte *b = &rs->status;
 
-				//we have reached a loading bay, mark it as used
-				//and clear the usage bit (0x80) of the stop
-				*b = (*b | ((v->u.road.state&2)?2:1)) & ~0x80;
+				// reached a loading bay, mark it as used and clear the usage bit
+				SETBIT(rs->status, v->u.road.state & 2 ? 1 : 0); // occupied bay
+				CLRBIT(rs->status, 7); // usage bit
 			}
 		}
 
@@ -1385,7 +1384,6 @@
 	if (v->u.road.state >= 0x20 &&
 			_road_veh_data_1[v->u.road.state - 0x20 + (_opt.road_side<<4)] == v->u.road.frame) {
 		RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
-		byte *b = &rs->status;
 
 		st = GetStation(_m[v->tile].m2);
 
@@ -1393,7 +1391,7 @@
 				v->current_order.type != OT_GOTO_DEPOT) {
 			Order old_order;
 
-			*b &= ~0x80;
+			CLRBIT(rs->status, 7);
 
 			v->last_station_visited = _m[v->tile].m2;
 
@@ -1419,14 +1417,14 @@
 		}
 
 		if (v->current_order.type != OT_GOTO_DEPOT) {
-			if (*b&0x80) {
+			if (HASBIT(rs->status, 7)) {
 				v->cur_speed = 0;
 				return;
 			}
 			v->current_order.type = OT_NOTHING;
 			v->current_order.flags = 0;
 		}
-		*b |= 0x80;
+		SETBIT(rs->status, 7);
 
 		if (rs == v->u.road.slot) {
 			//we have arrived at the correct station