public bool CanSelect() { Signal sig; int el; Track trk; sig = Globals.findSignalNamed(signame); if (sig == null) { return(false); } Vector path; if (sig.controls == null) { return(false); } if (sig.IsClear()) { return(false); } TurnSwitches(); path = Globals.findPath(sig.controls, sig.direction); if (path == null) { RestoreSwitches(); return(false); } int nel = path._size; bool failed = false; // check that every element in the path is clear for (el = 0; el < nel; ++el) { trk = path.TrackAt(el); if (trk.fgcolor != Globals.conf.fgcolor) { failed = true; break; } } Globals.Vector_delete(path); RestoreSwitches(); return(!failed); }