2037 return &_station_display_datas[gfx]; |
2037 return &_station_display_datas[gfx]; |
2038 } |
2038 } |
2039 |
2039 |
2040 static void DrawTile_Station(TileInfo *ti) |
2040 static void DrawTile_Station(TileInfo *ti) |
2041 { |
2041 { |
2042 uint32 image_or_modificator; |
|
2043 uint32 image; |
2042 uint32 image; |
2044 const DrawTileSeqStruct *dtss; |
2043 const DrawTileSeqStruct *dtss; |
2045 const DrawTileSprites *t = NULL; |
2044 const DrawTileSprites *t = NULL; |
2046 RailType railtype = GetRailType(ti->tile); |
2045 RailType railtype = GetRailType(ti->tile); |
2047 const RailtypeInfo *rti = GetRailTypeInfo(railtype); |
2046 const RailtypeInfo *rti = GetRailTypeInfo(railtype); |
2048 uint32 relocation = 0; |
2047 uint32 relocation = 0; |
2049 const Station *st = NULL; |
2048 const Station *st = NULL; |
2050 const StationSpec *statspec = NULL; |
2049 const StationSpec *statspec = NULL; |
2051 |
2050 PlayerID owner = GetTileOwner(ti->tile); |
2052 { |
2051 uint32 palette; |
2053 PlayerID owner = GetTileOwner(ti->tile); |
2052 |
2054 image_or_modificator = PALETTE_TO_GREY; /* NOTE: possible bug in ttd here? */ |
2053 if (owner < MAX_PLAYERS) { |
2055 if (owner < MAX_PLAYERS) image_or_modificator = PLAYER_SPRITE_COLOR(owner); |
2054 palette = PLAYER_SPRITE_COLOR(owner); |
|
2055 } else { |
|
2056 // Some stations are not owner by a player, namely oil rigs |
|
2057 palette = PALETTE_TO_GREY; |
2056 } |
2058 } |
2057 |
2059 |
2058 // don't show foundation for docks |
2060 // don't show foundation for docks |
2059 if (ti->tileh != SLOPE_FLAT && !IsDock(ti->tile)) |
2061 if (ti->tileh != SLOPE_FLAT && !IsDock(ti->tile)) |
2060 DrawFoundation(ti, ti->tileh); |
2062 DrawFoundation(ti, ti->tileh); |
2091 image += GetCustomStationGroundRelocation(statspec, st, ti->tile); |
2093 image += GetCustomStationGroundRelocation(statspec, st, ti->tile); |
2092 image += rti->custom_ground_offset; |
2094 image += rti->custom_ground_offset; |
2093 } else { |
2095 } else { |
2094 image += rti->total_offset; |
2096 image += rti->total_offset; |
2095 } |
2097 } |
2096 if (image & PALETTE_MODIFIER_COLOR) image |= image_or_modificator; |
2098 if (image & PALETTE_MODIFIER_COLOR) image |= palette; |
2097 |
2099 |
2098 // station_land array has been increased from 82 elements to 114 |
2100 // station_land array has been increased from 82 elements to 114 |
2099 // but this is something else. If AI builds station with 114 it looks all weird |
2101 // but this is something else. If AI builds station with 114 it looks all weird |
2100 DrawGroundSprite(image); |
2102 DrawGroundSprite(image); |
2101 |
2103 |
2110 image += relocation; |
2112 image += relocation; |
2111 } |
2113 } |
2112 |
2114 |
2113 if (_display_opt & DO_TRANS_BUILDINGS) { |
2115 if (_display_opt & DO_TRANS_BUILDINGS) { |
2114 MAKE_TRANSPARENT(image); |
2116 MAKE_TRANSPARENT(image); |
2115 } else { |
2117 } else if (image & PALETTE_MODIFIER_COLOR) { |
2116 if (image & PALETTE_MODIFIER_COLOR) image |= image_or_modificator; |
2118 image |= palette; |
2117 } |
2119 } |
2118 |
2120 |
2119 if ((byte)dtss->delta_z != 0x80) { |
2121 if ((byte)dtss->delta_z != 0x80) { |
2120 AddSortableSpriteToDraw(image, ti->x + dtss->delta_x, ti->y + dtss->delta_y, dtss->width, dtss->height, dtss->unk, ti->z + dtss->delta_z); |
2122 AddSortableSpriteToDraw(image, ti->x + dtss->delta_x, ti->y + dtss->delta_y, dtss->width, dtss->height, dtss->unk, ti->z + dtss->delta_z); |
2121 } else { |
2123 } else { |