Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -379,10 +379,16 @@ inline void Waypoint::visible_distance(DatacheckEntryList *datacheckerrors, char

inline void Waypoint::bus_with_i(DatacheckEntryList *datacheckerrors)
{ // look for I-xx with Bus instead of BL or BS
if (label[0] != 'I' || label[1] != '-') return;
if (label[0] != 'I' || label[1] != '-' || route->region->country->first != "USA") return;
const char *c = label.data()+2;
if (*c < '0' || *c > '9') return;
while (*c >= '0' && *c <= '9') c++;
if (!strncmp(c, "Bus", 3)) datacheckerrors->add(route, label, "", "", "BUS_WITH_I", "");
if ( *c == 'E' || *c == 'W' || *c == 'C' || *c == 'N' || *c == 'S'
|| *c == 'e' || *c == 'w' || *c == 'c' || *c == 'n' || *c == 's' ) c++;
if ( (*c == 'B' || *c == 'b')
&& (*(c+1) == 'u' || *(c+1) == 'U')
&& (*(c+2) == 's' || *(c+2) == 'S') )
datacheckerrors->add(route, label, "", "", "BUS_WITH_I", "");
}

inline void Waypoint::label_looks_hidden(DatacheckEntryList *datacheckerrors)
Expand Down
26 changes: 11 additions & 15 deletions siteupdate/python-teresco/siteupdate.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -913,11 +913,7 @@ def __init__(self,line,system,el):
".csv line [" + line + "], expected " + system.systemname)
self.region = fields[1]
region_found = False
for r in all_regions:
if r[0] == self.region:
region_found = True
break
if not region_found:
if self.region not in all_regions:
el.add_error("Unrecognized region in " + system.systemname +
".csv line: " + line)
self.route = fields[2]
Expand DownExpand Up@@ -2538,7 +2534,7 @@ def __init__(self,filename,descr,vertices,edges,travelers,format,category):
" bytes in countries.csv line " + line)
countries.append(fields)

all_regions = []
all_regions = {}
try:
file = open(args.highwaydatapath+"/regions.csv", "rt",encoding='utf-8')
except OSError as e:
Expand DownExpand Up@@ -2580,7 +2576,7 @@ def __init__(self,filename,descr,vertices,edges,travelers,format,category):
if len(fields[4].encode('utf-8')) > DBFieldLength.regiontype:
el.add_error("Region type > " + str(DBFieldLength.regiontype) +
" bytes in regions.csv line " + line)
all_regions.append(fields)
all_regions[fields[0]] = fields

# Create a list of HighwaySystem objects, one per system in systems.csv file
highway_systems = []
Expand DownExpand Up@@ -3656,7 +3652,7 @@ def run(self):

# We will create graph data and a graph file for each region that includes
# any active or preview systems
for r in all_regions:
for r in all_regions.values():
region_code = r[0]
if region_code not in active_preview_mileage_by_region:
continue
Expand DownExpand Up@@ -3762,9 +3758,9 @@ def run(self):
print(fields[1] + ' ', end="", flush=True)
region_list = []
selected_regions = fields[2].split(",")
for r in all_regions:
if r[0] in selected_regions and r[0] in active_preview_mileage_by_region:
region_list.append(r[0])
for r in all_regions.keys():
if r in selected_regions and r in active_preview_mileage_by_region:
region_list.append(r)
graph_data.write_subgraphs_tmg(graph_list, args.graphfilepath + "/", fields[1],
fields[0], "multiregion",
region_list, None, None, all_waypoints)
Expand All@@ -3779,7 +3775,7 @@ def run(self):
print(et.et() + "Creating country graphs.", flush=True)
for c in countries:
region_list = []
for r in all_regions:
for r in all_regions.values():
# does it match this country and have routes?
if c[0] == r[2] and r[0] in active_preview_mileage_by_region:
region_list.append(r[0])
Expand All@@ -3800,7 +3796,7 @@ def run(self):
print(et.et() + "Creating continent graphs.", flush=True)
for c in continents:
region_list = []
for r in all_regions:
for r in all_regions.values():
# does it match this continent and have routes?
if c[0] == r[3] and r[0] in active_preview_mileage_by_region:
region_list.append(r[0])
Expand DownExpand Up@@ -3953,7 +3949,7 @@ def run(self):
datacheckerrors.append(DatacheckEntry(r,[w.label],'NONTERMINAL_UNDERSCORE'))

# look for I-xx with Bus instead of BL or BS
if re.fullmatch('I\-[0-9]*Bus', w.label):
if re.fullmatch('I\-[0-9]+[EeWwCcNnSs]?[Bb][Uu][Ss].*', w.label) and all_regions[w.route.region][2] == "USA":
datacheckerrors.append(DatacheckEntry(r,[w.label],'BUS_WITH_I'))

# look for labels that look like hidden waypoints but
Expand DownExpand Up@@ -4117,7 +4113,7 @@ def run(self):
'), PRIMARY KEY(code), FOREIGN KEY (country) REFERENCES countries(code), FOREIGN KEY (continent) REFERENCES continents(code));\n')
sqlfile.write('INSERT INTO regions VALUES\n')
first = True
for r in all_regions:
for r in all_regions.values():
if not first:
sqlfile.write(",")
first = False
Expand Down