From: <geo...@us...> - 2011-06-17 07:25:04
|
Revision: 3998 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=3998&view=rev Author: geoffthemedio Date: 2011-06-17 07:24:57 +0000 (Fri, 17 Jun 2011) Log Message: ----------- Put some boost::graph related code in Universe.cpp into a named namespace (instead of an anonymous one) to fix some compile errors unique to particular GCC versions (4.2, possibly others) on OSX. Modified Paths: -------------- trunk/FreeOrion/universe/Universe.cpp Modified: trunk/FreeOrion/universe/Universe.cpp =================================================================== --- trunk/FreeOrion/universe/Universe.cpp 2011-06-13 13:02:23 UTC (rev 3997) +++ trunk/FreeOrion/universe/Universe.cpp 2011-06-17 07:24:57 UTC (rev 3998) @@ -48,25 +48,6 @@ return map; } - /** Used to short-circuit the use of BFS (breadth-first search) or - * Dijkstra's algorithm for pathfinding when it finds the desired - * destination system. */ - struct PathFindingShortCircuitingVisitor : public boost::base_visitor<PathFindingShortCircuitingVisitor> - { - typedef boost::on_finish_vertex event_filter; - - struct FoundDestination {}; // exception type thrown when destination is found - - PathFindingShortCircuitingVisitor(int dest_system) : destination_system(dest_system) {} - template <class Vertex, class Graph> - void operator()(Vertex u, Graph& g) - { - if (static_cast<int>(u) == destination_system) - throw FoundDestination(); - } - const int destination_system; - }; - void LoadSystemNames(std::list<std::string>& names) { boost::filesystem::ifstream ifs(GetResourceDir() / "starnames.txt"); @@ -90,7 +71,28 @@ } } } +} +namespace SystemPathing { + /** Used to short-circuit the use of BFS (breadth-first search) or + * Dijkstra's algorithm for pathfinding when it finds the desired + * destination system. */ + struct PathFindingShortCircuitingVisitor : public boost::base_visitor<PathFindingShortCircuitingVisitor> + { + typedef boost::on_finish_vertex event_filter; + + struct FoundDestination {}; // exception type thrown when destination is found + + PathFindingShortCircuitingVisitor(int dest_system) : destination_system(dest_system) {} + template <class Vertex, class Graph> + void operator()(Vertex u, Graph& g) + { + if (static_cast<int>(u) == destination_system) + throw FoundDestination(); + } + const int destination_system; + }; + //////////////////////////////////////////////////////////////// // templated implementations of Universe graph search methods // //////////////////////////////////////////////////////////////// @@ -271,6 +273,7 @@ return retval; } } +using namespace SystemPathing; // to keep GCC 4.2 on OSX happy const int ALL_EMPIRES = -1; |