diff src/station_cmd.cpp @ 6000:2f43f0d4d589 draft

(svn r8715) -Codechange/cleanup: replace magic numbers related to state of road vehicles with enums. Original patch by mart3p.
author rubidium <rubidium@openttd.org>
date Tue, 13 Feb 2007 22:27:27 +0000 (2007-02-13)
parents bec0f8d9440b
children 542153c1c803
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2222,7 +2222,7 @@
 			}
 		}
 	} else if (v->type == VEH_Road) {
-		if (v->u.road.state < 16 && !HASBIT(v->u.road.state, 2) && v->u.road.frame == 0) {
+		if (v->u.road.state < RVSB_IN_ROAD_STOP && v->u.road.frame == 0) {
 			if (IsRoadStop(tile)) {
 				/* Attempt to allocate a parking bay in a road stop */
 				RoadStop *rs = GetRoadStopByTile(tile, GetRoadStopType(tile));
@@ -2230,11 +2230,11 @@
 				/* Check if station is busy or if there are no free bays. */
 				if (rs->IsEntranceBusy() || !rs->HasFreeBay()) return VETSB_CANNOT_ENTER;
 
-				v->u.road.state += 32;
+				SETBIT(v->u.road.state, RVS_IN_ROAD_STOP);
 
 				/* Allocate a bay and update the road state */
 				uint bay_nr = rs->AllocateBay();
-				SB(v->u.road.state, 1, 1, bay_nr);
+				SB(v->u.road.state, RVS_USING_SECOND_BAY, 1, bay_nr);
 
 				/* Mark the station entrace as busy */
 				rs->SetEntranceBusy(true);