1302 if (GetRailTileType(ti->tile) == RAIL_TYPE_SIGNALS) DrawSignals(ti->tile, rails); |
1302 if (GetRailTileType(ti->tile) == RAIL_TYPE_SIGNALS) DrawSignals(ti->tile, rails); |
1303 |
1303 |
1304 } else { |
1304 } else { |
1305 /* draw depots / waypoints */ |
1305 /* draw depots / waypoints */ |
1306 const DrawTrackSeqStruct *drss; |
1306 const DrawTrackSeqStruct *drss; |
1307 byte type = ti->map5 & 0x3F; // 0-3: depots, 4-5: waypoints |
1307 bool is_depot = GetRailTileSubtype(ti->tile) == RAIL_SUBTYPE_DEPOT; |
1308 |
1308 |
1309 if (ti->tileh != 0) DrawFoundation(ti, ti->tileh); |
1309 if (ti->tileh != 0) DrawFoundation(ti, ti->tileh); |
1310 |
1310 |
1311 if (IsRailWaypoint(ti->tile) && HASBIT(_m[ti->tile].m3, 4)) { |
1311 if (IsRailWaypoint(ti->tile) && HASBIT(_m[ti->tile].m3, 4)) { |
1312 // look for customization |
1312 // look for customization |
1314 const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, stat_id); |
1314 const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, stat_id); |
1315 |
1315 |
1316 if (stat != NULL) { |
1316 if (stat != NULL) { |
1317 DrawTileSeqStruct const *seq; |
1317 DrawTileSeqStruct const *seq; |
1318 // emulate station tile - open with building |
1318 // emulate station tile - open with building |
1319 const DrawTileSprites *cust = &stat->renderdata[2 + (ti->map5 & 0x1)]; |
1319 const DrawTileSprites *cust = &stat->renderdata[2 + GetWaypointAxis(ti->tile)]; |
1320 uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0); |
1320 uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0); |
1321 |
1321 |
1322 /* We don't touch the 0x8000 bit. In all this |
1322 /* We don't touch the 0x8000 bit. In all this |
1323 * waypoint code, it is used to indicate that |
1323 * waypoint code, it is used to indicate that |
1324 * we should offset by railtype, but we always |
1324 * we should offset by railtype, but we always |
1344 } |
1344 } |
1345 return; |
1345 return; |
1346 } |
1346 } |
1347 } |
1347 } |
1348 |
1348 |
1349 drss = _track_depot_layout_table[type]; |
1349 drss = is_depot ? _track_depot_layout_table[GetRailDepotDirection(ti->tile)] : _track_waypoint_layout_table[GetWaypointAxis(ti->tile)]; |
1350 |
1350 |
1351 image = drss++->image; |
1351 image = drss++->image; |
1352 /* @note This is kind of an ugly hack, as the PALETTE_MODIFIER_COLOR indicates |
1352 /* @note This is kind of an ugly hack, as the PALETTE_MODIFIER_COLOR indicates |
1353 * whether the sprite is railtype dependent. Rewrite this asap */ |
1353 * whether the sprite is railtype dependent. Rewrite this asap */ |
1354 if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + rti->total_offset; |
1354 if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + rti->total_offset; |
1355 |
1355 |
1356 // adjust ground tile for desert |
1356 // adjust ground tile for desert |
1357 // (don't adjust for arctic depots, because snow in depots looks weird) |
1357 // (don't adjust for arctic depots, because snow in depots looks weird) |
1358 // type >= 4 means waypoints |
1358 // type >= 4 means waypoints |
1359 if (IsSnowRailGround(ti->tile) && (_opt.landscape == LT_DESERT || type >= 4)) { |
1359 if (IsSnowRailGround(ti->tile) && (_opt.landscape == LT_DESERT || !is_depot)) { |
1360 if (image != SPR_FLAT_GRASS_TILE) { |
1360 if (image != SPR_FLAT_GRASS_TILE) { |
1361 image += rti->snow_offset; // tile with tracks |
1361 image += rti->snow_offset; // tile with tracks |
1362 } else { |
1362 } else { |
1363 image = SPR_FLAT_SNOWY_TILE; // flat ground |
1363 image = SPR_FLAT_SNOWY_TILE; // flat ground |
1364 } |
1364 } |
1368 |
1368 |
1369 if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti); |
1369 if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti); |
1370 |
1370 |
1371 for (; drss->image != 0; drss++) { |
1371 for (; drss->image != 0; drss++) { |
1372 DrawSpecialBuilding( |
1372 DrawSpecialBuilding( |
1373 drss->image, type < 4 ? rti->total_offset : 0, ti, |
1373 drss->image, is_depot ? rti->total_offset : 0, ti, |
1374 drss->subcoord_x, drss->subcoord_y, 0, |
1374 drss->subcoord_x, drss->subcoord_y, 0, |
1375 drss->width, drss->height, 0x17 |
1375 drss->width, drss->height, 0x17 |
1376 ); |
1376 ); |
1377 } |
1377 } |
1378 } |
1378 } |