bridge_cmd.c
branchcustombridgeheads
changeset 5613 8b68de175f44
parent 5612 5e103bb5236d
child 5621 6ce400c0a2f4
equal deleted inserted replaced
5612:5e103bb5236d 5613:8b68de175f44
   980 		return 0;
   980 		return 0;
   981 	}
   981 	}
   982 	return 0;
   982 	return 0;
   983 }
   983 }
   984 
   984 
   985 uint32 VehicleEnter_Railway_Bridge(Vehicle *v, TileIndex tile, int x, int y)
   985 static uint32 VehicleEnter_Railway_Bridge(Vehicle *v, TileIndex tile, int x, int y)
   986 {
       
   987 	DiagDirection dir;
       
   988 	uint8 dxy;
       
   989 	assert(IsBridgeTile(v->tile));
       
   990 	dir = GetBridgeRampDirection(v->tile);
       
   991 	v->u.rail.track = 0x40;
       
   992 	v->direction = DiagDirToDir(dir);
       
   993 	CLRBIT(v->u.rail.flags, VRF_GOINGUP);
       
   994 	CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
       
   995 
       
   996 	switch (dir) {
       
   997 		default: NOT_REACHED();
       
   998 		case DIAGDIR_NE: dxy = 0xF8; break;
       
   999 		case DIAGDIR_SE: dxy = 0x80; break;
       
  1000 		case DIAGDIR_SW: dxy = 0x08; break;
       
  1001 		case DIAGDIR_NW: dxy = 0x8F; break;
       
  1002 	}
       
  1003 	SB(x, 0, 4, GB(dxy, 4, 4));
       
  1004 	SB(y, 0, 4, GB(dxy, 0, 4));
       
  1005 	v->x_pos = x;
       
  1006 	v->y_pos = y;
       
  1007 	return 0;
       
  1008 }
       
  1009 
       
  1010 static uint32 VehicleEnter_Railway_BridgeRamp(Vehicle *v, TileIndex tile, int x, int y)
       
  1011 {
   986 {
  1012 	int z = GetSlopeZ(x, y) - v->z_pos;
   987 	int z = GetSlopeZ(x, y) - v->z_pos;
  1013 
   988 
  1014 	DiagDirection dir;
   989 	DiagDirection dir;
  1015 
   990 
  1041 	return 0;
  1016 	return 0;
  1042 }
  1017 }
  1043 
  1018 
  1044 static uint32 VehicleEnter_Bridge(Vehicle *v, TileIndex tile, int x, int y)
  1019 static uint32 VehicleEnter_Bridge(Vehicle *v, TileIndex tile, int x, int y)
  1045 {
  1020 {
  1046 	if (v->type == VEH_Train) return VehicleEnter_Railway_BridgeRamp(v, tile, x, y);
  1021 	if (v->type == VEH_Train) return VehicleEnter_Railway_Bridge(v, tile, x, y);
  1047 
  1022 
  1048 	if (v->type == VEH_Road) return VehicleEnter_Street_Bridge(v, tile, x, y);
  1023 	if (v->type == VEH_Road) return VehicleEnter_Street_Bridge(v, tile, x, y);
  1049 
  1024 
  1050 	NOT_REACHED();
  1025 	NOT_REACHED();
  1051 }
  1026 }