Migrated engine to using dlmalloc through eng::

This commit is contained in:
2022-02-24 02:17:41 -05:00
parent acc00289fb
commit f467944095
61 changed files with 631 additions and 590 deletions

View File

@@ -6,6 +6,7 @@
#include <cmath>
// Cell X, Y coordinates are packed such that they have 24 bits for X and Y.
// A cell is 10 Meters square.
// Cell ID zero is used to represent an invalid position.
@@ -61,7 +62,7 @@ static int64_t point_cell_id(float x, float y) {
return cell_id(int64_t(cellx), int64_t(celly));
}
void PlaneMap::remove(const std::string &plane, int64_t cellid, PlaneItem *client) {
void PlaneMap::remove(const eng::string &plane, int64_t cellid, PlaneItem *client) {
auto piter = planes_.find(plane);
if (piter == planes_.end()) {
return;
@@ -81,13 +82,13 @@ void PlaneMap::remove(const std::string &plane, int64_t cellid, PlaneItem *clien
}
}
void PlaneMap::insert(const std::string &plane, int64_t cellid, PlaneItem *client) {
void PlaneMap::insert(const eng::string &plane, int64_t cellid, PlaneItem *client) {
Plane &p = planes_[plane];
EltVec &l = p[cellid];
l.push_back(client);
}
void PlaneItem::set_pos(const std::string &plane, float x, float y, float z) {
void PlaneItem::set_pos(const eng::string &plane, float x, float y, float z) {
int64_t old_cell = point_cell_id(x_, y_);
int64_t new_cell = point_cell_id(x, y);
@@ -141,7 +142,7 @@ PlaneMap::~PlaneMap() {
}
}
PlaneMap::EltVec PlaneMap::get_cell(const std::string &plane, int64_t cellid) const {
PlaneMap::EltVec PlaneMap::get_cell(const eng::string &plane, int64_t cellid) const {
PlaneMap::EltVec result;
auto piter = planes_.find(plane);
if (piter != planes_.end()) {
@@ -162,7 +163,7 @@ int PlaneMap::total_cells() const {
return total;
}
PlaneMap::IdVector PlaneMap::scan_radius_unsorted(const std::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const {
PlaneMap::IdVector PlaneMap::scan_radius_unsorted(const eng::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const {
PlaneMap::IdVector result;
if ((special != 0)&&(!omit)) {
result.push_back(special);
@@ -193,7 +194,7 @@ PlaneMap::IdVector PlaneMap::scan_radius_unsorted(const std::string &plane, floa
return result;
}
PlaneMap::IdVector PlaneMap::scan_radius(const std::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const {
PlaneMap::IdVector PlaneMap::scan_radius(const eng::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const {
PlaneMap::IdVector result = scan_radius_unsorted(plane, x, y, radius, exclude_nowhere, special, omit);
if ((special != 0)&&(!omit)) {
std::sort(result.begin() + 1, result.end());