- hash_map<string,Intersection>::const_iterator intersection = _intersections.find(node->name);
- if (intersection == _intersections.end()){ //Sanity check, should never be true..
- cerr << "BUG: Could not find intersection: " << node->name << endl;
- continue;
- }
- for (hash_map<string,StreetType>::const_iterator street = intersection->second.connections.begin();
- street != intersection->second.connections.end(); ++street){
- hash_map<string,SPInfo>::iterator newNode = nodes.find(street->first);
- bool travelStreet = false;
- if (hascar){
- if (reverse){
- if (street->second != foot){
- hash_map<string,Intersection>::const_iterator newInter = _intersections.find(street->first);
- if (newInter != _intersections.end()){
- hash_map<string,StreetType>::const_iterator st = newInter->second.connections.find(node->name);
- if (st != newInter->second.connections.end())
- travelStreet = st->second != foot;
- }
- }else
- travelStreet = true;
- }else
- travelStreet = street->second != foot;
- }else{
- travelStreet = street->second != car;
- }
- if (travelStreet){
- //cerr << "Adding street: " << street->first << endl;
- if (newNode == nodes.end()){
- n = &nodes[street->first];
- n->name = street->first;
- n->settled = false;
- n->parent = 0;
- n->cost = 10000;
- }else if (newNode->second.settled)
- continue;
- else
- n = &newNode->second;
-
- if (n->cost > node->cost + 1){
- n->cost = node->cost + 1;
- n->parent = node;
- pq.push(n);
- }
- }