private void DrawTrains(grid g) { Train t; TrainStop ts; Track trk; int indx; int x, y; int nx, ny; for (t = Globals.schedule; t != null; t = t.next) { // gc = tgraph_grid.gc; // gdk_rgb_gc_set_foreground(gc, // (colortable[fieldcolors[COL_TRAIN1+t.type]][0] << 16) | // (colortable[fieldcolors[COL_TRAIN1+t.type]][1] << 8) | // (colortable[fieldcolors[COL_TRAIN1+t.type]][2])); x = y = -1; for (trk = Globals.layout; trk != null; trk = trk.next) { if (trk.type == trktype.TRACK && trk.isstation && Globals.samestation1(trk.station, t.entrance)) { break; } if (trk.type == trktype.TEXT && Globals.islinkedtext(trk) && trk.km > 0 && Globals.samestation1(trk.station, t.entrance)) { break; } } if (trk != null && (indx = Globals.graphstation1(trk.station)) >= 0) { Globals.graph_xy1(Globals.stations1[indx].km, t.timein, out x, out y); } for (ts = t.stops; ts != null; ts = ts.next) { indx = Globals.graphstation1(ts.station); if (indx < 0) { continue; } if (x == -1) { Globals.graph_xy1(Globals.stations1[indx].km, ts.departure, out x, out y); continue; } Globals.graph_xy1(Globals.stations1[indx].km, ts.arrival, out nx, out ny); Globals.time_to_time1(g, x, y, nx, ny, t.type); Globals.graph_xy1(Globals.stations1[indx].km, ts.departure, out x, out y); } if (x != -1) { for (trk = Globals.layout; trk != null; trk = trk.next) { if (trk.type == trktype.TRACK && trk.isstation && Globals.samestation1(trk.station, t.exit)) { break; } if (trk.type == trktype.TEXT && Globals.islinkedtext(trk) && trk.km > 0 && Globals.samestation1(trk.station, t.exit)) { break; } } if (trk == null) { continue; } indx = Globals.graphstation1(trk.station); if (indx < 0) { continue; } Globals.graph_xy1(Globals.stations1[indx].km, t.timeout, out nx, out ny); Globals.time_to_time1(g, x, y, nx, ny, t.type); } } }