Skip to content

Commit

Permalink
Put back in duplicate homes drawing. This is needed in the case where…
Browse files Browse the repository at this point in the history
… homes wrap around torus. Also fix bug where wrapped homes did not score pucks correctly.
  • Loading branch information
horgh committed Mar 27, 2011
1 parent e28a35e commit da88614
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 0 additions & 2 deletions gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,10 @@ DrawAll() {
glColor3f( it->colour.r, it->colour.g, it->colour.b );

GlDrawCircle( it->x, it->y, home_radius, 16 );
/*
GlDrawCircle( it->x+world_size, it->y, home_radius, 16 );
GlDrawCircle( it->x-world_size, it->y, home_radius, 16 );
GlDrawCircle( it->x, it->y+world_size, home_radius, 16 );
GlDrawCircle( it->x, it->y-world_size, home_radius, 16 );
*/

glColor3f(0.0, 1.0, 0.0); // Green

Expand Down
16 changes: 13 additions & 3 deletions map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,21 @@ class Map {
// of the map and place in another vector
for (vector<Home *>::iterator it = all_homes.begin(); it != all_homes.end(); it++) {
Home *h = *it;
// Within our x range
if (h->x + antix::home_radius >= my_min_x && h->x - antix::home_radius < my_max_x) {
local_homes.push_back(h);
#if DEBUG
cout << "Found a local home for team " << h->team << endl;
#endif

// On first node, the homes may come from wrapping around the world
} else if (my_min_x == 0) {
if (h->x + antix::home_radius > antix::world_size) {
local_homes.push_back(h);
}

// On last node, homes may come from wrapping around the world
} else if (my_max_x == antix::world_size) {
if (h->x - antix::home_radius < 0) {
local_homes.push_back(h);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ main(int argc, char **argv) {
// update poses for internal robots
my_map->update_poses();

// Exchange robots/pucks on border, and agree on collisions near borders
neighbours_handshake();

// build message for each client of what their robots can see
Expand Down

0 comments on commit da88614

Please sign in to comment.