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

@@ -22,7 +22,7 @@ Gui *Gui::fetch_global_pointer(lua_State *L) {
return result;
}
void Gui::menu_item(const std::string &action, const std::string &label) {
void Gui::menu_item(const eng::string &action, const eng::string &label) {
GuiElt elt;
elt.type_ = GuiElt::TYPE_MENU_ITEM;
elt.action_ = action;
@@ -30,7 +30,7 @@ void Gui::menu_item(const std::string &action, const std::string &label) {
elts_.push_back(elt);
}
bool Gui::has_action(const std::string &action) const {
bool Gui::has_action(const eng::string &action) const {
for (const GuiElt &elt : elts_) {
if (elt.action_ == action) {
return true;
@@ -39,15 +39,15 @@ bool Gui::has_action(const std::string &action) const {
return false;
}
std::string Gui::get_action(int index) {
eng::string Gui::get_action(int index) {
if ((index < 0) || (index >= int(elts_.size()))) {
return "";
}
return elts_[index].action();
}
std::string Gui::menu_debug_string() const {
std::ostringstream oss;
eng::string Gui::menu_debug_string() const {
eng::ostringstream oss;
int index = 0;
for (const GuiElt &elt : elts()) {
oss << index << " " << elt.label() << std::endl;
@@ -60,8 +60,8 @@ LuaDefine(gui_menu_item, "action,label", "add a menu item to the current gui") {
Gui *gui = Gui::fetch_global_pointer(L);
LuaArg laction, llabel;
LuaStack LS(L, laction, llabel);
std::string action = LS.ckstring(laction);
std::string label = LS.ckstring(llabel);
eng::string action = LS.ckstring(laction);
eng::string label = LS.ckstring(llabel);
if (!util::has_prefix(action, "cb_")) {
luaL_error(L, "menuitem callbacks must start with cb_");
}