Changeset - r1986:40fe0be5bb1e
[Not reviewed]
master
0 10 0
tron - 19 years ago 2005-06-27 06:57:24
tron@openttd.org
(svn r2492) Remove some pointless casts and fix some nearby indentation
10 files changed with 59 insertions and 95 deletions:
0 comments (0 inline, 0 general)
aircraft_gui.c
Show inline comments
 
@@ -641,7 +641,7 @@ static void DrawAircraftDepotWindow(Wind
 
	num = 0;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Aircraft && v->subtype <= 2 && v->vehstatus&VS_HIDDEN &&
 
				v->tile == (TileIndex)tile)
 
				v->tile == tile)
 
					num++;
 
	}
 
	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
 
@@ -657,7 +657,7 @@ static void DrawAircraftDepotWindow(Wind
 
		if (v->type == VEH_Aircraft &&
 
				v->subtype <= 2 &&
 
				v->vehstatus&VS_HIDDEN &&
 
				v->tile == (TileIndex)tile &&
 
				v->tile == tile &&
 
				--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
 

	
 
			DrawAircraftImage(v, x+12, y, WP(w,traindepot_d).sel);
 
@@ -695,20 +695,14 @@ static int GetVehicleFromAircraftDepotWn
 

	
 
	tile = w->window_number;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Aircraft &&
 
				v->subtype <= 2 &&
 
				v->vehstatus&VS_HIDDEN &&
 
				v->tile == (TileIndex)tile &&
 
		if (v->type == VEH_Aircraft && v->subtype <= 2 &&
 
				v->vehstatus & VS_HIDDEN && v->tile == tile &&
 
				--pos < 0) {
 
					*veh = v;
 
					if (xm >= 12)
 
						return 0;
 

	
 
					if (ym <= 12)
 
						return -1; /* show window */
 

	
 
					return -2; /* start stop */
 
				}
 
			*veh = v;
 
			if (xm >= 12) return 0;
 
			if (ym <= 12) return -1; /* show window */
 
			return -2; /* start stop */
 
		}
 
	}
 
	return 1; /* outside */
 
}
clear_cmd.c
Show inline comments
 
@@ -167,13 +167,12 @@ static bool TerraformTileHeight(Terrafor
 
			ts->modheight_count++;
 
			break;
 
		}
 
		if (mod->tile == (TileIndex)tile)
 
			break;
 
		if (mod->tile == tile) break;
 
		mod++;
 
		count--;
 
	}
 

	
 
	mod->tile = (TileIndex)tile;
 
	mod->tile = tile;
 
	mod->height = (byte)height;
 

	
 
	ts->cost += _price.terraform;
pathfind.c
Show inline comments
 
@@ -22,12 +22,12 @@ static bool TPFSetTileBit(TrackPathFinde
 
		/* unused hash entry, set the appropriate bit in it and return true
 
		 * to indicate that a bit was set. */
 
		tpf->hash_head[hash] = bits;
 
		tpf->hash_tile[hash] = (TileIndex)tile;
 
		tpf->hash_tile[hash] = tile;
 
		return true;
 
	} else if (!(val & 0x8000)) {
 
		/* single tile */
 

	
 
		if ( (TileIndex)tile == tpf->hash_tile[hash] ) {
 
		if (tile == tpf->hash_tile[hash]) {
 
			/* found another bit for the same tile,
 
			 * check if this bit is already set, if so, return false */
 
			if (val & bits)
 
@@ -65,7 +65,7 @@ static bool TPFSetTileBit(TrackPathFinde
 
		offs = tpf->hash_tile[hash];
 
		do {
 
			link = PATHFIND_GET_LINK_PTR(tpf, offs);
 
			if ( (TileIndex)tile == link->tile) {
 
			if (tile == link->tile) {
 
				/* found the tile in the link list,
 
				 * check if the bit was alrady set, if so return false to indicate that the
 
				 * bit was already set */
 
@@ -86,7 +86,7 @@ static bool TPFSetTileBit(TrackPathFinde
 

	
 
	/* then fill the link with the new info, and establish a ptr from the old
 
	 * link to the new one */
 
	new_link->tile = (TileIndex)tile;
 
	new_link->tile = tile;
 
	new_link->flags = bits;
 
	new_link->next = 0xFFFF;
 

	
 
@@ -531,7 +531,7 @@ static bool NtpVisit(NewTrackPathFinder 
 
	}
 

	
 
	if (head != 0xffff) {
 
		if ( (TileIndex)tile == tpf->hash_tile[hash] && (head & 0x3) == dir ) {
 
		if (tile == tpf->hash_tile[hash] && (head & 0x3) == dir) {
 

	
 
			// longer length
 
			if (length >= (head >> 2)) return false;
 
@@ -563,7 +563,7 @@ static bool NtpVisit(NewTrackPathFinder 
 
		uint offs = tpf->hash_tile[hash];
 
		do {
 
			link = NTP_GET_LINK_PTR(tpf, offs);
 
			if ( (TileIndex)tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
 
			if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
 
				if (length >= (uint)(link->typelength >> 2)) return false;
 
				link->typelength = dir | (length << 2);
 
				return true;
 
@@ -580,7 +580,7 @@ static bool NtpVisit(NewTrackPathFinder 
 

	
 
	/* then fill the link with the new info, and establish a ptr from the old
 
	 * link to the new one */
 
	new_link->tile = (TileIndex)tile;
 
	new_link->tile = tile;
 
	new_link->typelength = dir | (length << 2);
 
	new_link->next = 0xFFFF;
 

	
 
@@ -607,7 +607,7 @@ static bool NtpCheck(NewTrackPathFinder 
 
	offs = tpf->hash_tile[hash];
 
	for(;;) {
 
		link = NTP_GET_LINK_PTR(tpf, offs);
 
		if ( (TileIndex)tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
 
		if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
 
			assert( (uint)(link->typelength >> 2) <= length);
 
			return length == (uint)(link->typelength >> 2);
 
		}
rail_cmd.c
Show inline comments
 
@@ -663,8 +663,7 @@ int32 CmdBuildTrainDepot(int x, int y, u
 
		return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		if (_current_player == _local_player)
 
			_last_built_train_depot_tile = (TileIndex)tile;
 
		if (_current_player == _local_player) _last_built_train_depot_tile = tile;
 

	
 
		ModifyTile(tile,
 
			MP_SETTYPE(MP_RAILWAY) |
road_cmd.c
Show inline comments
 
@@ -644,8 +644,7 @@ int32 CmdBuildRoadDepot(int x, int y, ui
 
		return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		if (_current_player == _local_player)
 
			_last_built_road_depot_tile = (TileIndex)tile;
 
		if (_current_player == _local_player) _last_built_road_depot_tile = tile;
 

	
 
		dep->xy = tile;
 
		dep->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
roadveh_cmd.c
Show inline comments
 
@@ -907,11 +907,8 @@ typedef struct OvertakeData {
 

	
 
static void *EnumFindVehToOvertake(Vehicle *v, OvertakeData *od)
 
{
 
	if (v->tile != (TileIndex)od->tile ||
 
			v->type != VEH_Road ||
 
			v == od->u ||
 
			v == od->v)
 
				return NULL;
 
	if (v->tile != od->tile || v->type != VEH_Road || v == od->u || v == od->v)
 
		return NULL;
 
	return v;
 
}
 

	
 
@@ -1079,7 +1076,7 @@ static int RoadFindPathToDest(Vehicle *v
 
	if (v->u.road.reverse_ctr != 0) {
 
		/* What happens here?? */
 
		v->u.road.reverse_ctr = 0;
 
		if (v->tile != (TileIndex)tile) {
 
		if (v->tile != tile) {
 
			return_track(_road_reverse_table[enterdir]);
 
		}
 
	}
roadveh_gui.c
Show inline comments
 
@@ -540,9 +540,8 @@ static void DrawRoadDepotWindow(Window *
 
	/* determine amount of items for scroller */
 
	num = 0;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Road && v->u.road.state == 254 &&
 
				v->tile == (TileIndex)tile)
 
					num++;
 
		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile)
 
			num++;
 
	}
 
	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
 

	
 
@@ -558,11 +557,8 @@ static void DrawRoadDepotWindow(Window *
 
	num = w->vscroll.pos * w->hscroll.cap;
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Road &&
 
				v->u.road.state == 254 &&
 
				v->tile == (TileIndex)tile &&
 
		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
 
				--num < 0 && num >=	-w->vscroll.cap * w->hscroll.cap) {
 

	
 
			DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
 

	
 
			SetDParam(0, v->unitnumber);
 
@@ -598,19 +594,13 @@ static int GetVehicleFromRoadDepotWndPt(
 

	
 
	tile = w->window_number;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Road &&
 
				v->u.road.state == 254 &&
 
				v->tile == (TileIndex)tile &&
 
		if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
 
				--pos < 0) {
 
					*veh = v;
 
					if (xm >= 24)
 
						return 0;
 

	
 
					if (xm <= 16)
 
						return -1; /* show window */
 

	
 
					return -2; /* start stop */
 
				}
 
			*veh = v;
 
			if (xm >= 24) return 0;
 
			if (xm <= 16) return -1; /* show window */
 
			return -2; /* start stop */
 
		}
 
	}
 

	
 
	return 1; /* outside */
ship_gui.c
Show inline comments
 
@@ -616,9 +616,8 @@ static void DrawShipDepotWindow(Window *
 
	/* determine amount of items for scroller */
 
	num = 0;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Ship && v->u.ship.state == 0x80 &&
 
				v->tile == (TileIndex)tile)
 
					num++;
 
		if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile)
 
			num++;
 
	}
 
	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
 

	
 
@@ -634,11 +633,8 @@ static void DrawShipDepotWindow(Window *
 
	num = w->vscroll.pos * w->hscroll.cap;
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Ship &&
 
				v->u.ship.state == 0x80 &&
 
				v->tile == (TileIndex)tile &&
 
		if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile &&
 
				--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
 

	
 
			DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel);
 

	
 
			SetDParam(0, v->unitnumber);
 
@@ -675,17 +671,13 @@ static int GetVehicleFromShipDepotWndPt(
 

	
 
	tile = w->window_number;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Ship &&
 
				v->vehstatus&VS_HIDDEN &&
 
				v->tile == (TileIndex)tile &&
 
		if (v->type == VEH_Ship && v->vehstatus & VS_HIDDEN && v->tile == tile &&
 
				--pos < 0) {
 
					*veh = v;
 
					if (xm >= 19)
 
						return 0;
 
					if (ym <= 10)
 
						return -1; /* show window */
 
					return -2; /* start stop */
 
				}
 
			*veh = v;
 
			if (xm >= 19) return 0;
 
			if (ym <= 10) return -1; /* show window */
 
			return -2; /* start stop */
 
		}
 
	}
 

	
 
	return 1; /* outside */
train_cmd.c
Show inline comments
 
@@ -445,7 +445,7 @@ static int32 CmdBuildRailWagon(uint engi
 
			u = NULL;
 

	
 
			FOR_ALL_VEHICLES(w) {
 
				if (w->type == VEH_Train && w->tile == (TileIndex)tile &&
 
				if (w->type == VEH_Train && w->tile == tile &&
 
				    w->subtype == TS_Free_Car && w->engine_type == engine) {
 
					u = GetLastVehicleInChain(w);
 
					break;
 
@@ -457,7 +457,7 @@ static int32 CmdBuildRailWagon(uint engi
 
			dir = _map5[tile] & 3;
 

	
 
			v->direction = (byte)(dir*2+1);
 
			v->tile = (TileIndex)tile;
 
			v->tile = tile;
 

	
 
			x = TileX(tile) * TILE_SIZE | _vehicle_initial_x_fract[dir];
 
			y = TileY(tile) * TILE_SIZE | _vehicle_initial_y_fract[dir];
 
@@ -633,7 +633,7 @@ int32 CmdBuildRailVehicle(int x, int y, 
 
			dir = _map5[tile] & 3;
 

	
 
			v->direction = (byte)(dir*2+1);
 
			v->tile = (TileIndex)tile;
 
			v->tile = tile;
 
			v->owner = _current_player;
 
			v->x_pos = (x |= _vehicle_initial_x_fract[dir]);
 
			v->y_pos = (y |= _vehicle_initial_y_fract[dir]);
train_gui.c
Show inline comments
 
@@ -370,17 +370,17 @@ static void DrawTrainDepotWindow(Window 
 
	hnum = 1;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Train &&
 
				  (v->subtype == TS_Front_Engine || v->subtype == TS_Free_Car) &&
 
				v->tile == (TileIndex)tile &&
 
			  (v->subtype == TS_Front_Engine || v->subtype == TS_Free_Car) &&
 
				v->tile == tile &&
 
				v->u.rail.track == 0x80) {
 
					num++;
 
					// determine number of items in the X direction.
 
					if (v->subtype == TS_Front_Engine) {
 
						i = 0;
 
						u = v;
 
						do i++; while ( (u=u->next) != NULL);
 
						if (i > hnum) hnum = i;
 
					}
 
			num++;
 
			// determine number of items in the X direction.
 
			if (v->subtype == TS_Front_Engine) {
 
				i = 0;
 
				u = v;
 
				do i++; while ((u = u->next) != NULL);
 
				if (i > hnum) hnum = i;
 
			}
 
		}
 
	}
 

	
 
@@ -403,12 +403,9 @@ static void DrawTrainDepotWindow(Window 
 

	
 
	// draw all trains
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Train &&
 
				v->subtype == TS_Front_Engine &&
 
				v->tile == (TileIndex)tile &&
 
				v->u.rail.track == 0x80 &&
 
		if (v->type == VEH_Train && v->subtype == TS_Front_Engine &&
 
				v->tile == tile && v->u.rail.track == 0x80 &&
 
				--num < 0 && num >= -w->vscroll.cap) {
 

	
 
			DrawTrainImage(v, x+21, y, w->hscroll.cap, w->hscroll.pos, WP(w,traindepot_d).sel);
 
			/* Draw the train number */
 
			SetDParam(0, v->unitnumber);
 
@@ -433,12 +430,9 @@ static void DrawTrainDepotWindow(Window 
 

	
 
	// draw all remaining vehicles
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Train &&
 
				v->subtype == TS_Free_Car &&
 
				v->tile == (TileIndex)tile &&
 
				v->u.rail.track == 0x80 &&
 
		if (v->type == VEH_Train && v->subtype == TS_Free_Car &&
 
				v->tile == tile && v->u.rail.track == 0x80 &&
 
				--num < 0 && num >= -w->vscroll.cap) {
 

	
 
			DrawTrainImage(v, x+50, y, w->hscroll.cap - 1, 0, WP(w,traindepot_d).sel);
 
			DrawString(x, y+2, STR_8816, 0);
 

	
0 comments (0 inline, 0 general)