Changeset - r2604:54a05d7b5b59
[Not reviewed]
master
0 1 0
peter1138 - 19 years ago 2005-11-05 18:21:28
peter1138@openttd.org
(svn r3141) Replace incorrect railtype bitmask in CmdRailTrackHelper with appropriate GB()
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rail_cmd.c
Show inline comments
 
@@ -584,14 +584,15 @@ static int32 CmdRailTrackHelper(int x, i
 
{
 
	int ex, ey;
 
	int32 ret, total_cost = 0;
 
	Track track = (Track)GB(p2, 4, 3);
 
	Trackdir trackdir;
 
	byte mode = HASBIT(p2, 7);
 
	RailType railtype = (RailType)GB(p2, 0, 4);
 

	
 
	if (!ValParamRailtype(p2 & 0x3) || !ValParamTrackOrientation(track)) return CMD_ERROR;
 
	if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
 
	if (p1 > MapSize()) return CMD_ERROR;
 
	trackdir = TrackToTrackdir(track);
 

	
 
	/* unpack end point */
 
	ex = TileX(p1) * TILE_SIZE;
 
	ey = TileY(p1) * TILE_SIZE;
 
@@ -600,13 +601,13 @@ static int32 CmdRailTrackHelper(int x, i
 

	
 
	if (CmdFailed(ValidateAutoDrag(&trackdir, x, y, ex, ey))) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TileVirtXY(x, y));
 

	
 
	for(;;) {
 
		ret = DoCommand(x, y, p2 & 0x3, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
 
		ret = DoCommand(x, y, railtype, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
 

	
 
		if (CmdFailed(ret)) {
 
			if ((_error_message != STR_1007_ALREADY_BUILT) && (mode == 0))
 
				break;
 
		} else
 
			total_cost += ret;
0 comments (0 inline, 0 general)