1
This commit is contained in:
parent
8901dcdf24
commit
3d9d01a0f1
@ -44,9 +44,9 @@ void MapService::Init(int width, int height, int cell_width)
|
|||||||
grid_offset_arr_[7] = map_width_;
|
grid_offset_arr_[7] = map_width_;
|
||||||
grid_offset_arr_[8] = map_width_ + 1;
|
grid_offset_arr_[8] = map_width_ + 1;
|
||||||
|
|
||||||
map_cells_ = (list_head*)malloc(sizeof(list_head) * width * height);
|
map_cells_.reserve(width * height);
|
||||||
memset(map_cells_, 0, sizeof(list_head) * width * height);
|
|
||||||
for (int i = 0; i < max_grid_id_; ++i) {
|
for (int i = 0; i < max_grid_id_; ++i) {
|
||||||
|
map_cells_.push_back(list_head());
|
||||||
INIT_LIST_HEAD(&map_cells_[i]);
|
INIT_LIST_HEAD(&map_cells_[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,10 +63,6 @@ void MapService::UnInit()
|
|||||||
e->holder = nullptr;
|
e->holder = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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)
|
||||||
|
@ -31,7 +31,7 @@ class MapService
|
|||||||
bool TriIntersect(glm::vec3 t1[3], glm::vec3 t2[3]);
|
bool TriIntersect(glm::vec3 t1[3], glm::vec3 t2[3]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
list_head* map_cells_ = nullptr;
|
std::vector<list_head> map_cells_;
|
||||||
int map_width_ = 0;
|
int map_width_ = 0;
|
||||||
int map_height_ = 0;
|
int map_height_ = 0;
|
||||||
int cell_width_ = 0;
|
int cell_width_ = 0;
|
||||||
|
@ -64,7 +64,6 @@ std::string TraceMgr::GetBackTrace()
|
|||||||
data += strings[i];
|
data += strings[i];
|
||||||
data += "\n";
|
data += "\n";
|
||||||
}
|
}
|
||||||
free(strings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user