Migrated engine to using dlmalloc through eng::
This commit is contained in:
@@ -14,21 +14,21 @@ void World::tangible_walkto(int64_t id, int64_t animid, float x, float y) {
|
||||
}
|
||||
|
||||
|
||||
std::string World::tangible_anim_debug_string(int64_t id) const {
|
||||
eng::string World::tangible_anim_debug_string(int64_t id) const {
|
||||
const Tangible *t = tangible_get(id);
|
||||
if (t == 0) return "no such tangible";
|
||||
return t->anim_queue_.steps_debug_string();
|
||||
}
|
||||
|
||||
|
||||
std::string World::tangible_id_pool_debug_string(int64_t id) const {
|
||||
eng::string World::tangible_id_pool_debug_string(int64_t id) const {
|
||||
const Tangible *t = tangible_get(id);
|
||||
if (t == 0) return "no such tangible";
|
||||
return t->id_player_pool_.debug_string();
|
||||
}
|
||||
|
||||
|
||||
std::string World::tangible_ids_debug_string() const {
|
||||
eng::string World::tangible_ids_debug_string() const {
|
||||
util::IdVector idv;
|
||||
for (const auto &pair : tangibles_) {
|
||||
idv.push_back(pair.first);
|
||||
@@ -37,8 +37,8 @@ std::string World::tangible_ids_debug_string() const {
|
||||
return util::id_vector_debug_string(idv);
|
||||
}
|
||||
|
||||
std::string World::tangibles_near_debug_string(int64_t actor, int64_t distance) {
|
||||
std::ostringstream result;
|
||||
eng::string World::tangibles_near_debug_string(int64_t actor, int64_t distance) {
|
||||
eng::ostringstream result;
|
||||
for (int64_t id : get_near(actor, distance, true, false)) {
|
||||
const Tangible *tan = tangible_get(id);
|
||||
const AnimStep &aqback = tan->anim_queue_.back();
|
||||
@@ -47,13 +47,13 @@ std::string World::tangibles_near_debug_string(int64_t actor, int64_t distance)
|
||||
return result.str();
|
||||
}
|
||||
|
||||
std::string World::tangible_pprint(int64_t id) const {
|
||||
eng::string World::tangible_pprint(int64_t id) const {
|
||||
lua_State *L = state();
|
||||
LuaVar tangibles, tan, meta;
|
||||
LuaStack LS(L, tangibles, tan, meta);
|
||||
LS.rawget(tangibles, LuaRegistry, "tangibles");
|
||||
LS.rawget(tan, tangibles, id);
|
||||
std::ostringstream oss;
|
||||
eng::ostringstream oss;
|
||||
if (LS.istable(tan)) {
|
||||
LS.getmetatable(meta, tan);
|
||||
LS.clearmetatable(tan);
|
||||
@@ -66,12 +66,12 @@ std::string World::tangible_pprint(int64_t id) const {
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string World::numbered_tables_debug_string() const {
|
||||
eng::string World::numbered_tables_debug_string() const {
|
||||
lua_State *L = state();
|
||||
LuaVar ntmap, tab, tid;
|
||||
LuaStack LS(L, ntmap, tab, tid);
|
||||
std::vector<std::string> result;
|
||||
std::ostringstream oss;
|
||||
eng::vector<eng::string> result;
|
||||
eng::ostringstream oss;
|
||||
|
||||
// Fetch the numbered tables map.
|
||||
LS.rawget(ntmap, LuaRegistry, "ntmap");
|
||||
@@ -90,19 +90,19 @@ std::string World::numbered_tables_debug_string() const {
|
||||
}
|
||||
LS.result();
|
||||
std::sort(result.begin(), result.end());
|
||||
for (const std::string &s : result) {
|
||||
for (const eng::string &s : result) {
|
||||
oss << s << ";";
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string World::paired_tables_debug_string(lua_State *master) const {
|
||||
eng::string World::paired_tables_debug_string(lua_State *master) const {
|
||||
lua_State *synch = state();
|
||||
LuaVar mntmap, sntmap, mtab, stab, mtid, stid;
|
||||
LuaStack MLS(master, mntmap, mtab, mtid);
|
||||
LuaStack SLS(synch, sntmap, stab, stid);
|
||||
std::vector<std::pair<std::string, std::string>> result;
|
||||
std::ostringstream oss;
|
||||
eng::vector<eng::pair<eng::string, eng::string>> result;
|
||||
eng::ostringstream oss;
|
||||
|
||||
// Fetch the numbered tables map.
|
||||
MLS.rawget(mntmap, LuaRegistry, "ntmap");
|
||||
@@ -115,8 +115,8 @@ std::string World::paired_tables_debug_string(lua_State *master) const {
|
||||
MLS.rawget(mtab, mntmap, i);
|
||||
SLS.rawget(stab, sntmap, i);
|
||||
if (MLS.istable(mtab) && SLS.istable(stab)) {
|
||||
std::string mname = "unknown";
|
||||
std::string sname = "unknown";
|
||||
eng::string mname = "unknown";
|
||||
eng::string sname = "unknown";
|
||||
MLS.rawget(mtid, mtab, "TID");
|
||||
if (MLS.isstring(mtid)) {
|
||||
mname = MLS.ckstring(mtid);
|
||||
@@ -137,7 +137,7 @@ std::string World::paired_tables_debug_string(lua_State *master) const {
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
void World::tangible_set_string(int64_t id, const std::string &path, const std::string &value) {
|
||||
void World::tangible_set_string(int64_t id, const eng::string &path, const eng::string &value) {
|
||||
lua_State *L = state();
|
||||
LuaVar tangibles, tab, subtab;
|
||||
LuaStack LS(L, tangibles, tab, subtab);
|
||||
@@ -150,11 +150,11 @@ void World::tangible_set_string(int64_t id, const std::string &path, const std::
|
||||
// Split the path parts into the table names and final part.
|
||||
util::StringVec pathparts = util::split(path, '.');
|
||||
assert(pathparts.size() >= 1);
|
||||
std::string finalpart = pathparts.back();
|
||||
eng::string finalpart = pathparts.back();
|
||||
pathparts.pop_back();
|
||||
|
||||
// Create subtables as necessary.
|
||||
for (const std::string &subname : pathparts) {
|
||||
for (const eng::string &subname : pathparts) {
|
||||
LS.rawget(subtab, tab, subname);
|
||||
if (LS.isnil(subtab)) {
|
||||
LS.set(subtab, LuaNewTable);
|
||||
@@ -170,7 +170,7 @@ void World::tangible_set_string(int64_t id, const std::string &path, const std::
|
||||
assert(stack_is_clear());
|
||||
}
|
||||
|
||||
void World::tangible_copy_global(int64_t id, const std::string &path, const std::string &global) {
|
||||
void World::tangible_copy_global(int64_t id, const eng::string &path, const eng::string &global) {
|
||||
lua_State *L = state();
|
||||
LuaVar tangibles, tab, subtab, globtab, value;
|
||||
LuaStack LS(L, tangibles, tab, subtab, globtab, value);
|
||||
@@ -183,11 +183,11 @@ void World::tangible_copy_global(int64_t id, const std::string &path, const std:
|
||||
// Split the path parts into the table names and final part.
|
||||
util::StringVec pathparts = util::split(path, '.');
|
||||
assert(pathparts.size() >= 1);
|
||||
std::string finalpart = pathparts.back();
|
||||
eng::string finalpart = pathparts.back();
|
||||
pathparts.pop_back();
|
||||
|
||||
// Create subtables as necessary.
|
||||
for (const std::string &subname : pathparts) {
|
||||
for (const eng::string &subname : pathparts) {
|
||||
LS.rawget(subtab, tab, subname);
|
||||
if (LS.isnil(subtab)) {
|
||||
LS.set(subtab, LuaNewTable);
|
||||
@@ -204,7 +204,7 @@ void World::tangible_copy_global(int64_t id, const std::string &path, const std:
|
||||
LS.result();
|
||||
}
|
||||
|
||||
void World::tangible_set_class(int64_t id, const std::string &c) const {
|
||||
void World::tangible_set_class(int64_t id, const eng::string &c) const {
|
||||
LuaVar tangibles, tan, meta, sclass;
|
||||
LuaStack LS(state(), tangibles, tan, meta, sclass);
|
||||
LS.rawget(tangibles, LuaRegistry, "tangibles");
|
||||
@@ -220,7 +220,7 @@ void World::tangible_set_class(int64_t id, const std::string &c) const {
|
||||
LS.result();
|
||||
}
|
||||
|
||||
std::string World::tangible_get_class(int64_t id) const {
|
||||
eng::string World::tangible_get_class(int64_t id) const {
|
||||
LuaVar tangibles, tan, meta, sclass;
|
||||
LuaStack LS(state(), tangibles, tan, meta, sclass);
|
||||
LS.rawget(tangibles, LuaRegistry, "tangibles");
|
||||
@@ -228,7 +228,7 @@ std::string World::tangible_get_class(int64_t id) const {
|
||||
assert(LS.istable(tan));
|
||||
LS.getmetatable(meta, tan);
|
||||
LS.rawget(sclass, meta, "__index");
|
||||
std::string result = LS.classname(sclass);
|
||||
eng::string result = LS.classname(sclass);
|
||||
LS.result();
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user