This commit is contained in:
aozhiwei 2023-11-04 09:07:32 +08:00
parent f8658de2d2
commit 831dc77165

View File

@ -20,10 +20,6 @@ MapService::MapService()
MapService::~MapService()
{
if (map_cells_) {
free(map_cells_);
map_cells_ = nullptr;
}
}
void MapService::Init(int width, int height, int cell_width)
@ -57,7 +53,20 @@ void MapService::Init(int width, int height, int cell_width)
void MapService::UnInit()
{
for (int i = 0; i < max_grid_id_; ++i) {
list_head* head = &map_cells_[i];
while (!list_empty(head)) {
CellNode* e = list_first_entry(head,
CellNode,
entry);
list_del_init(&e->entry);
delete e;
}
}
if (map_cells_) {
free(map_cells_);
map_cells_ = nullptr;
}
}
bool MapService::CanAdd(const glm::vec3& pos, int rad)