mirror of https://github.com/OpenTTD/OpenTTD
(svn r16869) -Codechange: make drawing waypoints a tiny bit more like drawing stations
parent
8c17c6cb2b
commit
861a2163f6
|
@ -222,7 +222,6 @@ static inline Money RailConvertCost(RailType from, RailType to)
|
||||||
|
|
||||||
Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data);
|
Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data);
|
||||||
void DrawTrainDepotSprite(int x, int y, int image, RailType railtype);
|
void DrawTrainDepotSprite(int x, int y, int image, RailType railtype);
|
||||||
void DrawDefaultWaypointSprite(int x, int y, RailType railtype);
|
|
||||||
Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data);
|
Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data);
|
||||||
int TicksToLeaveDepot(const Train *v);
|
int TicksToLeaveDepot(const Train *v);
|
||||||
|
|
||||||
|
|
|
@ -1973,7 +1973,7 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
} else {
|
} else {
|
||||||
default_waypoint:
|
default_waypoint:
|
||||||
/* There is no custom layout, fall back to the default graphics */
|
/* There is no custom layout, fall back to the default graphics */
|
||||||
dts = &_waypoint_gfx_table[GetWaypointAxis(ti->tile)];
|
dts = GetStationTileLayout(STATION_WAYPOINT, GetWaypointAxis(ti->tile));
|
||||||
relocation = 0;
|
relocation = 0;
|
||||||
image = dts->ground.sprite + rti->total_offset;
|
image = dts->ground.sprite + rti->total_offset;
|
||||||
if (IsSnowRailGround(ti->tile)) image += rti->snow_offset;
|
if (IsSnowRailGround(ti->tile)) image += rti->snow_offset;
|
||||||
|
@ -2049,14 +2049,6 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
|
||||||
DrawTileSequence(x + 33, y + 17, image, dts->seq, offset);
|
DrawTileSequence(x + 33, y + 17, image, dts->seq, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawDefaultWaypointSprite(int x, int y, RailType railtype)
|
|
||||||
{
|
|
||||||
uint32 offset = GetRailTypeInfo(railtype)->total_offset;
|
|
||||||
const DrawTileSprites *dts = &_waypoint_gfx_table[AXIS_X];
|
|
||||||
|
|
||||||
DrawTileSequence(x, y, dts->ground.sprite + offset, dts->seq, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y)
|
static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y)
|
||||||
{
|
{
|
||||||
uint z;
|
uint z;
|
||||||
|
|
|
@ -3081,6 +3081,7 @@ static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
|
||||||
{
|
{
|
||||||
if (flags & DC_AUTO) {
|
if (flags & DC_AUTO) {
|
||||||
switch (GetStationType(tile)) {
|
switch (GetStationType(tile)) {
|
||||||
|
default: break;
|
||||||
case STATION_RAIL: return_cmd_error(STR_ERROR_MUST_DEMOLISH_RAILROAD);
|
case STATION_RAIL: return_cmd_error(STR_ERROR_MUST_DEMOLISH_RAILROAD);
|
||||||
case STATION_AIRPORT: return_cmd_error(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST);
|
case STATION_AIRPORT: return_cmd_error(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST);
|
||||||
case STATION_TRUCK: return_cmd_error(HasTileRoadType(tile, ROADTYPE_TRAM) ? STR_ERROR_MUST_DEMOLISH_CARGO_TRAM_STATION_FIRST : STR_ERROR_MUST_DEMOLISH_TRUCK_STATION_FIRST);
|
case STATION_TRUCK: return_cmd_error(HasTileRoadType(tile, ROADTYPE_TRAM) ? STR_ERROR_MUST_DEMOLISH_CARGO_TRAM_STATION_FIRST : STR_ERROR_MUST_DEMOLISH_TRUCK_STATION_FIRST);
|
||||||
|
|
|
@ -26,7 +26,8 @@ enum StationType {
|
||||||
STATION_BUS,
|
STATION_BUS,
|
||||||
STATION_OILRIG,
|
STATION_OILRIG,
|
||||||
STATION_DOCK,
|
STATION_DOCK,
|
||||||
STATION_BUOY
|
STATION_BUOY,
|
||||||
|
STATION_WAYPOINT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Types of RoadStops */
|
/** Types of RoadStops */
|
||||||
|
|
|
@ -737,6 +737,18 @@ static const DrawTileSeqStruct _station_display_datas_0171[] = {
|
||||||
TILE_SEQ_END()
|
TILE_SEQ_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const DrawTileSeqStruct _station_display_datas_waypoint_X[] = {
|
||||||
|
TILE_SEQ_LINE( 0, 0, 0, 16, 5, 23, SPR_WAYPOINT_X_1 | (1 << PALETTE_MODIFIER_COLOUR))
|
||||||
|
TILE_SEQ_LINE( 0, 11, 0, 16, 5, 23, SPR_WAYPOINT_X_2 | (1 << PALETTE_MODIFIER_COLOUR))
|
||||||
|
TILE_SEQ_END()
|
||||||
|
};
|
||||||
|
|
||||||
|
static const DrawTileSeqStruct _station_display_datas_waypoint_Y[] = {
|
||||||
|
TILE_SEQ_LINE( 0, 0, 0, 5, 16, 23, SPR_WAYPOINT_Y_1 | (1 << PALETTE_MODIFIER_COLOUR))
|
||||||
|
TILE_SEQ_LINE(11, 0, 0, 5, 16, 23, SPR_WAYPOINT_Y_2 | (1 << PALETTE_MODIFIER_COLOUR))
|
||||||
|
TILE_SEQ_END()
|
||||||
|
};
|
||||||
|
|
||||||
#undef TILE_SEQ_END
|
#undef TILE_SEQ_END
|
||||||
#undef TILE_SEQ_LINE
|
#undef TILE_SEQ_LINE
|
||||||
#undef TILE_SEQ_LINE_PAL
|
#undef TILE_SEQ_LINE_PAL
|
||||||
|
@ -941,6 +953,11 @@ static const DrawTileSprites _station_display_datas_buoy[] = {
|
||||||
TILE_SPRITE_LINE(SPR_FLAT_WATER_TILE, _station_display_datas_82)
|
TILE_SPRITE_LINE(SPR_FLAT_WATER_TILE, _station_display_datas_82)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const DrawTileSprites _station_display_datas_waypoint[] = {
|
||||||
|
TILE_SPRITE_LINE(SPR_RAIL_TRACK_X, _station_display_datas_waypoint_X)
|
||||||
|
TILE_SPRITE_LINE(SPR_RAIL_TRACK_Y, _station_display_datas_waypoint_Y)
|
||||||
|
};
|
||||||
|
|
||||||
#undef TILE_SPRITE_LINE
|
#undef TILE_SPRITE_LINE
|
||||||
|
|
||||||
static const DrawTileSprites *_station_display_datas[] = {
|
static const DrawTileSprites *_station_display_datas[] = {
|
||||||
|
@ -951,4 +968,5 @@ static const DrawTileSprites *_station_display_datas[] = {
|
||||||
_station_display_datas_oilrig,
|
_station_display_datas_oilrig,
|
||||||
_station_display_datas_dock,
|
_station_display_datas_dock,
|
||||||
_station_display_datas_buoy,
|
_station_display_datas_buoy,
|
||||||
|
_station_display_datas_waypoint,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
/** @file track_land.h Sprites to use and how to display them for train depot/waypoint tiles. */
|
/** @file track_land.h Sprites to use and how to display them for train depot tiles. */
|
||||||
|
|
||||||
#define TILE_SEQ_LINE(img, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 23, {img, PAL_NONE} },
|
#define TILE_SEQ_LINE(img, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 23, {img, PAL_NONE} },
|
||||||
#define TILE_SEQ_END() { (int8)0x80, 0, 0, 0, 0, 0, {0, 0} }
|
#define TILE_SEQ_END() { (int8)0x80, 0, 0, 0, 0, 0, {0, 0} }
|
||||||
|
@ -42,23 +42,6 @@ static const DrawTileSprites _depot_invisible_gfx_table[] = {
|
||||||
{ {SPR_RAIL_TRACK_Y, PAL_NONE}, _depot_gfx_NW }
|
{ {SPR_RAIL_TRACK_Y, PAL_NONE}, _depot_gfx_NW }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const DrawTileSeqStruct _waypoint_gfx_X[] = {
|
|
||||||
TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_X_1, 0, 0, 16, 5)
|
|
||||||
TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_X_2, 0, 11, 16, 5)
|
|
||||||
TILE_SEQ_END()
|
|
||||||
};
|
|
||||||
|
|
||||||
static const DrawTileSeqStruct _waypoint_gfx_Y[] = {
|
|
||||||
TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_Y_1, 0, 0, 5, 16)
|
|
||||||
TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_Y_2, 11, 0, 5, 16)
|
|
||||||
TILE_SEQ_END()
|
|
||||||
};
|
|
||||||
|
|
||||||
static const DrawTileSprites _waypoint_gfx_table[] = {
|
|
||||||
{ {SPR_RAIL_TRACK_X, PAL_NONE}, _waypoint_gfx_X },
|
|
||||||
{ {SPR_RAIL_TRACK_Y, PAL_NONE}, _waypoint_gfx_Y }
|
|
||||||
};
|
|
||||||
|
|
||||||
#undef TILE_SEQ_LINE
|
#undef TILE_SEQ_LINE
|
||||||
#undef TILE_SEQ_END
|
#undef TILE_SEQ_END
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
|
||||||
y += 17;
|
y += 17;
|
||||||
|
|
||||||
if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) {
|
if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) {
|
||||||
DrawDefaultWaypointSprite(x, y, railtype);
|
StationPickerDrawSprite(x, y, STATION_WAYPOINT, railtype, INVALID_ROADTYPE, AXIS_X);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue