2138 } |
2138 } |
2139 } |
2139 } |
2140 |
2140 |
2141 if (t == NULL || t->seq == NULL) t = &_station_display_datas[GetStationType(ti->tile)][GetStationGfx(ti->tile)]; |
2141 if (t == NULL || t->seq == NULL) t = &_station_display_datas[GetStationType(ti->tile)][GetStationGfx(ti->tile)]; |
2142 |
2142 |
2143 SpriteID image = t->ground_sprite; |
2143 |
2144 if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) { |
2144 if (IsBuoy(ti->tile) || IsDock(ti->tile)) { |
2145 image += GetCustomStationGroundRelocation(statspec, st, ti->tile); |
2145 if (ti->tileh == SLOPE_FLAT) { |
2146 image += custom_ground_offset; |
2146 DrawWaterClassGround(ti); |
|
2147 } else { |
|
2148 assert(IsDock(ti->tile)); |
|
2149 TileIndex water_tile = ti->tile + TileOffsByDiagDir(GetDockDirection(ti->tile)); |
|
2150 WaterClass wc = GetWaterClass(water_tile); |
|
2151 if (wc == WATER_CLASS_SEA) { |
|
2152 DrawShoreTile(ti->tileh); |
|
2153 } else { |
|
2154 DrawClearLandTile(ti, 3); |
|
2155 } |
|
2156 } |
2147 } else { |
2157 } else { |
2148 image += total_offset; |
2158 SpriteID image = t->ground_sprite; |
2149 } |
2159 if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) { |
2150 |
2160 image += GetCustomStationGroundRelocation(statspec, st, ti->tile); |
2151 /* station_land array has been increased from 82 elements to 114 |
2161 image += custom_ground_offset; |
2152 * but this is something else. If AI builds station with 114 it looks all weird */ |
2162 } else { |
2153 DrawGroundSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE); |
2163 image += total_offset; |
|
2164 } |
|
2165 DrawGroundSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE); |
|
2166 } |
2154 |
2167 |
2155 if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC && IsStationTileElectrifiable(ti->tile)) DrawCatenary(ti); |
2168 if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC && IsStationTileElectrifiable(ti->tile)) DrawCatenary(ti); |
2156 |
2169 |
2157 if (HasBit(roadtypes, ROADTYPE_TRAM)) { |
2170 if (HasBit(roadtypes, ROADTYPE_TRAM)) { |
2158 Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y; |
2171 Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y; |
2159 DrawGroundSprite((HasBit(roadtypes, ROADTYPE_ROAD) ? SPR_TRAMWAY_OVERLAY : SPR_TRAMWAY_TRAM) + (axis ^ 1), PAL_NONE); |
2172 DrawGroundSprite((HasBit(roadtypes, ROADTYPE_ROAD) ? SPR_TRAMWAY_OVERLAY : SPR_TRAMWAY_TRAM) + (axis ^ 1), PAL_NONE); |
2160 DrawTramCatenary(ti, axis == AXIS_X ? ROAD_X : ROAD_Y); |
2173 DrawTramCatenary(ti, axis == AXIS_X ? ROAD_X : ROAD_Y); |
2161 } |
2174 } |
2162 |
2175 |
2163 if (IsBuoy(ti->tile)) { |
|
2164 /* Draw appropriate water edges */ |
|
2165 switch (GetWaterClass(ti->tile)) { |
|
2166 case WATER_CLASS_SEA: break; |
|
2167 case WATER_CLASS_CANAL: DrawCanalWater(ti->tile, false); break; |
|
2168 case WATER_CLASS_RIVER: DrawRiverWater(ti, false); break; |
|
2169 } |
|
2170 } |
|
2171 |
|
2172 const DrawTileSeqStruct *dtss; |
2176 const DrawTileSeqStruct *dtss; |
2173 foreach_draw_tile_seq(dtss, t->seq) { |
2177 foreach_draw_tile_seq(dtss, t->seq) { |
2174 image = dtss->image; |
2178 SpriteID image = dtss->image; |
2175 if (relocation == 0 || HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) { |
2179 if (relocation == 0 || HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) { |
2176 image += total_offset; |
2180 image += total_offset; |
2177 } else { |
2181 } else { |
2178 image += relocation; |
2182 image += relocation; |
2179 } |
2183 } |