diff --git a/server/gameserver/mapservice.cc b/server/gameserver/mapservice.cc index 4caf99a7..016ba776 100644 --- a/server/gameserver/mapservice.cc +++ b/server/gameserver/mapservice.cc @@ -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) diff --git a/third_party/a8 b/third_party/a8 index 1e577389..54fe50ed 160000 --- a/third_party/a8 +++ b/third_party/a8 @@ -1 +1 @@ -Subproject commit 1e577389c8a2870db9ddbf18577bfca24def049b +Subproject commit 54fe50edf11dda774dcd6fc480134c9e4ce449cd