Pathing tweaks, MagLine implementation

Wound up completely rewriting the SortTree class in my efforts to
squash an elusive pathfinding bug.  Turns out the problem was in
AgendaSearch.  ...Figures.