tunnelbridge_cmd.c
changeset 3853 c49992ab497b
parent 3794 ac26a7b4615d
child 3854 4821667ad368
equal deleted inserted replaced
3852:d293deaf2f1b 3853:c49992ab497b
   181 int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
   181 int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
   182 {
   182 {
   183 	int bridge_type;
   183 	int bridge_type;
   184 	TransportType transport;
   184 	TransportType transport;
   185 	RailType railtype;
   185 	RailType railtype;
   186 	int x;
   186 	uint x;
   187 	int y;
   187 	uint y;
   188 	int sx,sy;
   188 	uint sx;
       
   189 	uint sy;
   189 	TileIndex tile_start;
   190 	TileIndex tile_start;
   190 	TileIndex tile_end;
   191 	TileIndex tile_end;
   191 	Slope tileh_start;
   192 	Slope tileh_start;
   192 	Slope tileh_end;
   193 	Slope tileh_end;
   193 	uint z_start;
   194 	uint z_start;
   225 
   226 
   226 	/* check if valid, and make sure that (x,y) are smaller than (sx,sy) */
   227 	/* check if valid, and make sure that (x,y) are smaller than (sx,sy) */
   227 	if (x == sx) {
   228 	if (x == sx) {
   228 		if (y == sy) return_cmd_error(STR_5008_CANNOT_START_AND_END_ON);
   229 		if (y == sy) return_cmd_error(STR_5008_CANNOT_START_AND_END_ON);
   229 		direction = AXIS_Y;
   230 		direction = AXIS_Y;
   230 		if (y > sy) {
   231 		if (y > sy) intswap(y,sy);
   231 			intswap(y,sy);
       
   232 			intswap(x,sx);
       
   233 		}
       
   234 	} else if (y == sy) {
   232 	} else if (y == sy) {
   235 		direction = AXIS_X;
   233 		direction = AXIS_X;
   236 		if (x > sx) {
   234 		if (x > sx) intswap(x,sx);
   237 			intswap(y,sy);
       
   238 			intswap(x,sx);
       
   239 		}
       
   240 	} else {
   235 	} else {
   241 		return_cmd_error(STR_500A_START_AND_END_MUST_BE_IN);
   236 		return_cmd_error(STR_500A_START_AND_END_MUST_BE_IN);
   242 	}
   237 	}
   243 
   238 
   244 	/* set and test bridge length, availability */
   239 	/* set and test bridge length, availability */