1
0
Fork 0

(svn r609) Fixed choose waypoints dialogs, it works without assertion failures and with custom waypoint #0 selectable now. (pasky)

release/0.4.5
dominik 2004-11-14 20:25:07 +00:00
parent 0bcc9b7573
commit c2193ce1a8
1 changed files with 14 additions and 15 deletions

View File

@ -736,7 +736,7 @@ int32 CmdBuildTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ModifyTile(tile, MP_MAP5, RAIL_TYPE_WAYPOINT | dir); ModifyTile(tile, MP_MAP5, RAIL_TYPE_WAYPOINT | dir);
if (p1 & 0x100 && (p1 & 0xff)!=0) { // waypoint type 0 uses default graphics if (--p1 & 0x100) { // waypoint type 0 uses default graphics
// custom graphics // custom graphics
_map3_lo[tile] |= 16; _map3_lo[tile] |= 16;
_map3_hi[tile] = p1 & 0xff; _map3_hi[tile] = p1 & 0xff;
@ -1626,20 +1626,11 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
void DrawWaypointSprite(int x, int y, int stat_id) void DrawWaypointSprite(int x, int y, int stat_id)
{ {
struct StationSpec *stat = GetCustomStation('WAYP', stat_id); struct StationSpec *stat;
uint32 relocation; uint32 relocation;
DrawTileSprites *cust; DrawTileSprites *cust;
DrawTileSeqStruct const *seq; DrawTileSeqStruct const *seq;
uint32 ormod, img; uint32 ormod, img;
const DrawTrackSeqStruct *dtss;
const byte *t;
assert(stat);
relocation = GetCustomStationRelocation(stat, NULL, 1);
// emulate station tile - open with building
// add 1 to get the other direction
cust = &stat->renderdata[2];
ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player)); ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player));
@ -1647,14 +1638,15 @@ void DrawWaypointSprite(int x, int y, int stat_id)
y += 17; y += 17;
// draw default waypoint graphics of ID 0 // draw default waypoint graphics of ID 0
t = _track_depot_layout_table[4]; if (stat_id == 0) {
if(stat_id==0) const byte *t = _track_depot_layout_table[4];
{ const DrawTrackSeqStruct *dtss;
img = *(const uint16*)t; img = *(const uint16*)t;
if (img & 0x8000) img = (img & 0x7FFF) + 0; if (img & 0x8000) img = (img & 0x7FFF) + 0;
DrawSprite(img, x, y); DrawSprite(img, x, y);
for(dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) { for (dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0); Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
img = dtss->image; img = dtss->image;
if (img & 0x8000) img |= ormod; if (img & 0x8000) img |= ormod;
@ -1663,6 +1655,13 @@ void DrawWaypointSprite(int x, int y, int stat_id)
return; return;
} }
stat = GetCustomStation('WAYP', stat_id - 1);
assert(stat);
relocation = GetCustomStationRelocation(stat, NULL, 1);
// emulate station tile - open with building
// add 1 to get the other direction
cust = &stat->renderdata[2];
img = cust->ground_sprite; img = cust->ground_sprite;
if (img & 0x8000) img = (img & 0x7FFF); if (img & 0x8000) img = (img & 0x7FFF);
DrawSprite(img, x, y); DrawSprite(img, x, y);