This commit is contained in:
aozhiwei 2019-04-25 18:36:46 +08:00
parent 2990a44ca2
commit 564e639edc
2 changed files with 14 additions and 0 deletions

View File

@ -120,7 +120,9 @@ void Bullet::OnHit(std::set<Entity*>& objects)
obstacle->ClearColliders();
room->ScatterDrop(obstacle->pos, obstacle->meta->i->drop());
}
#if 0
obstacle->BroadcastFullState();
#endif
}
}
break;

View File

@ -125,6 +125,12 @@ void GridService::MoveHuman(Human* hum)
int new_x = (int)hum->pos.x + cell_width_;
int new_y = (int)hum->pos.y + cell_width_;
int new_grid_id = new_x/cell_width_ + (new_y/cell_width_) * cell_count_per_row_;
if (BroderOverFlow(new_x, new_y)) {
abort();
}
if (new_grid_id == 0 || new_grid_id > max_grid_id_) {
abort();
}
if (new_grid_id != hum->grid_id) {
std::set<GridCell*> inc_grid_list;
std::set<GridCell*> dec_grid_list;
@ -160,6 +166,12 @@ void GridService::MoveBullet(Bullet* bullet)
int new_x = (int)bullet->pos.x + cell_width_;
int new_y = (int)bullet->pos.y + cell_width_;
int new_grid_id = new_x/cell_width_ + (new_y/cell_width_) * cell_count_per_row_;
if (BroderOverFlow(new_x, new_y)) {
abort();
}
if (new_grid_id == 0 || new_grid_id > max_grid_id_) {
abort();
}
if (new_grid_id != bullet->grid_id) {
std::set<GridCell*> inc_grid_list;
std::set<GridCell*> dec_grid_list;