Changeset - r6697:f1b39d102e5e
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-05-26 07:58:49
rubidium@openttd.org
(svn r9929) -Fix [FS#803]: fix several drawing issues.
1 file changed with 12 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -223,12 +223,16 @@ int32 CmdRemoveRoad(TileIndex tile, uint
 

	
 
		case ROAD_TILE_CROSSING: {
 
			if (pieces & ComplementRoadBits(GetCrossingRoadBits(tile))) {
 
				return CMD_ERROR;
 
			}
 

	
 
			/* Don't allow road to be removed from the crossing when there is tram;
 
			 * we can't draw the crossing without trambits ;) */
 
			if (rt == ROADTYPE_ROAD && HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM)) return CMD_ERROR;
 

	
 
			if (flags & DC_EXEC) {
 
				if (rt == ROADTYPE_ROAD) {
 
					ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
 
				}
 

	
 
				RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
 
@@ -402,16 +406,17 @@ int32 CmdBuildRoad(TileIndex tile, uint3
 
			}
 

	
 
			if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
 

	
 
			if (flags & DC_EXEC) {
 
				YapfNotifyTrackLayoutChange(tile, FindFirstTrack(GetTrackBits(tile)));
 
				MakeRoadCrossing(tile, _current_player, _current_player, _current_player, GetTileOwner(tile), roaddir, GetRailType(tile), RoadTypeToRoadTypes(rt), p2);
 
				/* Always add road to the roadtypes (can't draw without it) */
 
				MakeRoadCrossing(tile, _current_player, _current_player, _current_player, GetTileOwner(tile), roaddir, GetRailType(tile), RoadTypeToRoadTypes(rt) | ROADTYPES_ROAD, p2);
 
				MarkTileDirtyByTile(tile);
 
			}
 
			return _price.build_road * 2;
 
			return _price.build_road * (rt == ROADTYPE_ROAD ? 2 : 4);
 
		}
 

	
 
		case MP_STATION:
 
			if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
 
			if (HASBIT(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 
			break;
 
@@ -844,13 +849,13 @@ void DrawTramCatenary(TileInfo *ti, Road
 
		SETBIT(front, PALETTE_MODIFIER_TRANSPARENT);
 
		SETBIT(back,  PALETTE_MODIFIER_TRANSPARENT);
 
		pal = PALETTE_TO_TRANSPARENT;
 
	}
 

	
 
	AddSortableSpriteToDraw(back,  pal, ti->x, ti->y, 16, 16, 0x20, ti->z);
 
	AddSortableSpriteToDraw(front, pal, ti->x, ti->y, 16, 16, 0, ti->z);
 
	AddSortableSpriteToDraw(front, pal, ti->x, ti->y, 16, 16, 0x20, ti->z);
 
}
 

	
 
/**
 
 * Draw ground sprite and road pieces
 
 * @param ti TileInfo
 
 */
 
@@ -952,12 +957,16 @@ static void DrawTile_Road(TileInfo *ti)
 
					case ROADSIDE_GRASS:  break;
 
					default:              image += 4; break; // Paved
 
				}
 
			}
 

	
 
			DrawGroundSprite(image, pal);
 
			if (HASBIT(GetRoadTypes(ti->tile), ROADTYPE_TRAM)) {
 
				DrawGroundSprite(SPR_TRAMWAY_OVERLAY + (GetCrossingRoadAxis(ti->tile) ^ 1), pal);
 
				DrawTramCatenary(ti, GetCrossingRoadBits(ti->tile));
 
			}
 
			if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
 
			break;
 
		}
 

	
 
		default:
 
		case ROAD_TILE_DEPOT: {
0 comments (0 inline, 0 general)