#include <iostream>
#include "collision_grid.hpp"
+#include "msg.hpp"
#include "collision.hpp"
#include "sector.hpp"
#include "collision_grid_iterator.hpp"
int gridy = int(y / cell_height);
if(gridx < 0 || gridy < 0
|| gridx >= int(cells_x) || gridy >= int(cells_y)) {
- std::cerr << "Object out of range: " << gridx << ", " << gridy << "\n";
+ msg_warning("Object out of range: " << gridx << ", " << gridy);
continue;
}
GridEntry* entry = new GridEntry;
assert(wrapper != 0);
#else
if(wrapper == 0) {
- std::cerr << "Tried to remove nonexistant object!\n";
+ msg_warning("Tried to remove nonexistant object");
return;
}
#endif
int gridy = int(y / cell_height);
if(gridx < 0 || gridy < 0
|| gridx >= int(cells_x) || gridy >= int(cells_y)) {
- std::cerr << "Object out of range: " << gridx << ", " << gridy << "\n";
+ msg_warning("Object out of range: " << gridx << ", " << gridy);
continue;
}
remove_object_from_gridcell(gridy*cells_x + gridx, wrapper);
int gridy = int(y / cell_height);
if(gridx < 0 || gridy < 0 ||
gridx >= int(cells_x) || gridy >= int(cells_y)) {
- std::cerr << "Object out of range: " << gridx << ", " << gridy << "\n";
+ msg_warning("Object out of range: " << gridx << ", " << gridy);
continue;
}
remove_object_from_gridcell(gridy*cells_x + gridx, wrapper);
int gridy = int(y / cell_height);
if(gridx < 0 || gridy < 0
|| gridx >= int(cells_x) || gridy >= int(cells_y)) {
- std::cerr << "Object out of range: " << gridx << ", " << gridy << "\n";
+ msg_warning("Object out of range: " << gridx << ", " << gridy);
continue;
}
CollisionGrid::check_collisions()
{
std::vector<ObjectWrapper*> moved_objects;
-
+
+#if 0
CollisionGridIterator iter(*this, Sector::current()->get_active_region());
while(ObjectWrapper* wrapper = iter.next_wrapper()) {
MovingObject* object = wrapper->object;
moved_objects.push_back(wrapper);
}
}
+#endif
for(std::vector<ObjectWrapper*>::iterator i = moved_objects.begin();
i != moved_objects.end(); ++i) {
int gridy = int(y / cell_height);
if(gridx < 0 || gridy < 0
|| gridx >= int(cells_x) || gridy >= int(cells_y)) {
- //std::cerr << "Object out of range: " << gridx << ", " << gridy << "\n";
+ //msg_warning("Object out of range: " << gridx << ", " << gridy);
continue;
}
entry = entry->next;
};
- std::cerr << "Couldn't find object in cell.\n";
+ msg_warning("Couldn't find object in cell");
}