1
This commit is contained in:
parent
f8658de2d2
commit
831dc77165
@ -20,10 +20,6 @@ MapService::MapService()
|
|||||||
|
|
||||||
MapService::~MapService()
|
MapService::~MapService()
|
||||||
{
|
{
|
||||||
if (map_cells_) {
|
|
||||||
free(map_cells_);
|
|
||||||
map_cells_ = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapService::Init(int width, int height, int cell_width)
|
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()
|
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)
|
bool MapService::CanAdd(const glm::vec3& pos, int rad)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user