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

@@ -88,7 +88,7 @@ class PlaneItem {
private:
PlaneMap *pmap_;
std::string plane_;
eng::string plane_;
float x_, y_, z_;
int64_t id_;
@@ -100,7 +100,7 @@ public:
void set_id(int64_t id) { id_ = id; }
int64_t id() const { return id_; }
const std::string &plane() const { return plane_; }
const eng::string &plane() const { return plane_; }
const float x() const { return x_; }
const float y() const { return y_; }
const float z() const { return z_; }
@@ -108,18 +108,18 @@ public:
void untrack();
void track(PlaneMap *pmap);
void set_pos(const std::string &plane, float x, float y, float z);
void set_pos(const eng::string &plane, float x, float y, float z);
void set_xyz(float x, float y, float z) { set_pos(plane_, x, y, z); }
};
class PlaneMap {
friend class PlaneItem;
private:
using EltVec = std::vector<PlaneItem *>;
using Plane = std::map<int64_t, EltVec>;
std::map<std::string, Plane> planes_;
void remove(const std::string &plane, int64_t cell, PlaneItem *client);
void insert(const std::string &plane, int64_t cell, PlaneItem *client);
using EltVec = eng::vector<PlaneItem *>;
using Plane = eng::map<int64_t, EltVec>;
eng::map<eng::string, Plane> planes_;
void remove(const eng::string &plane, int64_t cell, PlaneItem *client);
void insert(const eng::string &plane, int64_t cell, PlaneItem *client);
public:
using IdVector = util::IdVector;
@@ -133,13 +133,13 @@ public:
// omit - if true, remove the special ID from the list.
// if false, prepend the special ID to the head of the list.
//
IdVector scan_radius(const std::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const;
IdVector scan_radius_unsorted(const std::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const;
IdVector scan_radius(const eng::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const;
IdVector scan_radius_unsorted(const eng::string &plane, float x, float y, float radius, bool exclude_nowhere, int64_t special, bool omit) const;
private:
// unit testing stuff.
friend int lfn_unittests_planemap(lua_State *L);
EltVec get_cell(const std::string &plane, int64_t cell) const;
EltVec get_cell(const eng::string &plane, int64_t cell) const;
int total_cells() const;
void clear() { planes_.clear(); }
};