roadveh_cmd.c
changeset 2549 5587f9a38563
parent 2493 f6b4300cc2b0
child 2550 4570b91c81aa
equal deleted inserted replaced
2548:49c8a096033f 2549:5587f9a38563
   298 static Depot *FindClosestRoadDepot(Vehicle *v)
   298 static Depot *FindClosestRoadDepot(Vehicle *v)
   299 {
   299 {
   300 	TileIndex tile = v->tile;
   300 	TileIndex tile = v->tile;
   301 	int i;
   301 	int i;
   302 
   302 
   303 	if (v->u.road.state == 255) { tile = GetVehicleOutOfTunnelTile(v); }
   303 	if (v->u.road.state == 255) tile = GetVehicleOutOfTunnelTile(v);
   304 
   304 
   305 	if (_patches.new_pathfinding_all) {
   305 	if (_patches.new_pathfinding_all) {
   306 		NPFFoundTargetData ftd;
   306 		NPFFoundTargetData ftd;
   307 		/* See where we are now */
   307 		/* See where we are now */
   308 		Trackdir trackdir = GetVehicleTrackdir(v);
   308 		Trackdir trackdir = GetVehicleTrackdir(v);
  1032 		signal  = GB(r, 16, 16);
  1032 		signal  = GB(r, 16, 16);
  1033 		bitmask = GB(r,  0, 16);
  1033 		bitmask = GB(r,  0, 16);
  1034 	}
  1034 	}
  1035 
  1035 
  1036 	if (IsTileType(tile, MP_STREET)) {
  1036 	if (IsTileType(tile, MP_STREET)) {
  1037 		if (GB(_m[tile].m5, 4, 4) == 2 && IsTileOwner(tile, v->owner))
  1037 		if (GB(_m[tile].m5, 4, 4) == 2 && IsTileOwner(tile, v->owner)) {
  1038 			/* Road crossing */
  1038 			/* Road depot */
  1039 			bitmask |= _road_veh_fp_ax_or[_m[tile].m5&3];
  1039 			bitmask |= _road_veh_fp_ax_or[GB(_m[tile].m5, 0, 2)];
       
  1040 		}
  1040 	} else if (IsTileType(tile, MP_STATION)) {
  1041 	} else if (IsTileType(tile, MP_STATION)) {
  1041 		if (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, v->owner)) {
  1042 		if (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, v->owner)) {
  1042 			/* Our station */
  1043 			/* Our station */
  1043 			Station *st = GetStation(_m[tile].m2);
  1044 			const Station* st = GetStation(_m[tile].m2);
  1044 			byte val = _m[tile].m5;
  1045 			byte val = _m[tile].m5;
  1045 			if (v->cargo_type != CT_PASSENGERS) {
  1046 			if (v->cargo_type != CT_PASSENGERS) {
  1046 				if (IS_BYTE_INSIDE(val, 0x43, 0x47) && (_patches.roadveh_queue || st->truck_stops->status&3))
  1047 				if (IS_BYTE_INSIDE(val, 0x43, 0x47) && (_patches.roadveh_queue || st->truck_stops->status&3))
  1047 					bitmask |= _road_veh_fp_ax_or[(val-0x43)&3];
  1048 					bitmask |= _road_veh_fp_ax_or[(val-0x43)&3];
  1048 			} else {
  1049 			} else {