Skip to content

Instantly share code, notes, and snippets.

@Wolfolo
Created November 13, 2016 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wolfolo/a7b60479a73111077b3fd5295dc94892 to your computer and use it in GitHub Desktop.
Save Wolfolo/a7b60479a73111077b3fd5295dc94892 to your computer and use it in GitHub Desktop.
Change assert to return invalid roadtype identifiers instead
diff --git a/src/road_map.h b/src/road_map.h
index 544083e..cf2d75d 100644
--- a/src/road_map.h
+++ b/src/road_map.h
@@ -562,9 +562,10 @@ struct RoadTypeIdentifiers {
*/
static RoadTypeIdentifiers FromTile(TileIndex t)
{
- assert(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE));
- TileType tt = GetTileType(t);
RoadTypeIdentifiers rtids;
+ if (!(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE))) return rtids;
+
+ TileType tt = GetTileType(t);
rtids.road_identifier = RoadTypeIdentifier();
rtids.tram_identifier = RoadTypeIdentifier();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment