/[projectaxis]/projectaxis/projectAxis/src/map/pathfinding/mapsearch_pod.cpp
ViewVC logotype

Diff of /projectaxis/projectAxis/src/map/pathfinding/mapsearch_pod.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by leiavoia, Sat Jun 7 00:03:49 2003 UTC revision 1.3 by leiavoia, Fri Jul 25 21:18:38 2003 UTC
# Line 46  bool MapSearchNode_Pod::GetSuccessors( A Line 46  bool MapSearchNode_Pod::GetSuccessors( A
46                  checker.x = x + x_coords[i];                  checker.x = x + x_coords[i];
47                  checker.y = y + y_coords[i];                  checker.y = y + y_coords[i];
48    
49                  if( map->IsValid(checker.x, checker.y) == 1 ) { // is valid                  if( themap->IsValid(checker.x, checker.y) == 1 ) { // is valid
50                          temp = map->GetOccu(checker.x, checker.y); // get occupant if any                          temp = themap->GetOccu(checker.x, checker.y); // get occupant if any
51                          if (    (map->GetObst(checker.x, checker.y) != 1)  && // is not a blocked tile                          if (    (themap->GetObst(checker.x, checker.y) != 1)  && // is not a blocked tile
52                                  !((parent_x == checker.x) && (parent_y == checker.y)  ) // isn't where we just came from                                  !((parent_x == checker.x) && (parent_y == checker.y)  ) // isn't where we just came from
53                                  ) {                                  ) {
54                                  if (temp == NULL || checker.IsGoal(  *(astarsearch->GetSolutionEnd())  ) == 1) {  // if not already occupied -OR- it's the goal state.                                  if (temp == NULL || checker.IsGoal(  *(astarsearch->GetSolutionEnd())  ) == 1) {  // if not already occupied -OR- it's the goal state.
# Line 83  float MapSearchNode_Pod::GetCost( MapSea Line 83  float MapSearchNode_Pod::GetCost( MapSea
83                  for (int j=-rad; j <= rad; j++) {                  for (int j=-rad; j <= rad; j++) {
84                          if (j==0 && i==0) {continue;} // don't check self                          if (j==0 && i==0) {continue;} // don't check self
85                          //--------\/---------                          //--------\/---------
86                          if(  map->IsValid(successor.x + i, successor.y + j)  ) { // is valid                          if(  themap->IsValid(successor.x + i, successor.y + j)  ) { // is valid
87                                  // TODO: check visor for visibilty in this tile                                  // TODO: check visor for visibilty in this tile
88                                  temp = map->GetOccu(successor.x + i, successor.y + j); // get occupant if any                                  temp = themap->GetOccu(successor.x + i, successor.y + j); // get occupant if any
89                                  if (temp != NULL) { // isn't already occupied.                                  if (temp != NULL) { // isn't already occupied.
90                                          if (temp->GetAlign() != pod->GetAlign()) { // if not on our team                                          if (temp->GetAlign() != pod->GetAlign()) { // if not on our team
91                                                  enemy_cost += (10 * pod->GetAvoid());// TODO: avoidence amplified by map size. otherwise, H takes too much over G on larger maps                                                  enemy_cost += (10 * pod->GetAvoid());// TODO: avoidence amplified by map size. otherwise, H takes too much over G on larger maps
# Line 99  float MapSearchNode_Pod::GetCost( MapSea Line 99  float MapSearchNode_Pod::GetCost( MapSea
99                  }                  }
100    
101          // Road Quality - we like roads          // Road Quality - we like roads
102          int road_q = map->GetRoadQ(successor.x, successor.y);          int road_q = themap->GetRoadQ(successor.x, successor.y);
103    
104          return (  (road_q / 2) + enemy_cost  );          return (  (road_q / 2) + enemy_cost  );
105          }          }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26