diff --git a/abstractAppState.cpp b/abstractAppState.cpp index 6248558..23a09d0 100644 --- a/abstractAppState.cpp +++ b/abstractAppState.cpp @@ -23,11 +23,11 @@ namespace gameBase { string table = "mappings"; for(int i = firstMapping; i < firstMapping + numMappings; i++){ - Index idIndex = Index(to_string(i + 1), false); - int bind = luaManager->getIntFromTable(table, vector{idIndex, Index("bind", true)}); - Mapping::BindType type = (Mapping::BindType)luaManager->getIntFromTable(table, vector{idIndex, Index("bindType", true)}); - bool action = luaManager->getBoolFromTable(table, vector{idIndex, Index("action", true)}); - int trigger = luaManager->getIntFromTable(table, vector{idIndex, Index("trigger", true)}); + Index idIndex = Index(i + 1); + int bind = luaManager->getIntFromTable(table, vector{idIndex, Index("bind")}); + Mapping::BindType type = (Mapping::BindType)luaManager->getIntFromTable(table, vector{idIndex, Index("bindType")}); + bool action = luaManager->getBoolFromTable(table, vector{idIndex, Index("action")}); + int trigger = luaManager->getIntFromTable(table, vector{idIndex, Index("trigger")}); Mapping *m = new Mapping; m->bind = bind; diff --git a/luaManager.h b/luaManager.h index f74cf8f..776f4ea 100644 --- a/luaManager.h +++ b/luaManager.h @@ -15,9 +15,19 @@ namespace gameBase{ std::string index; bool string; - Index(std::string index, bool string){ + Index(std::string index){ this->index = index; - this->string = string; + this->string = true; + } + + Index(int index){ + this->index = std::to_string(index); + this->string = false; + } + + Index(float index){ + this->index = std::to_string(index); + this->string = false; } };