- added more lua debug info

This commit is contained in:
SoftCoder 2013-12-30 14:00:04 -08:00
parent 450e23c85c
commit 5613b0739e
3 changed files with 18 additions and 2 deletions

@ -1 +1 @@
Subproject commit 69b5a991e721d6e79c4dc7b364b8bf0ae987c6d1
Subproject commit 30b3eb105b08137b2388287a97fa65c39fe3746b

View File

@ -454,6 +454,8 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
loadGame(this->rootNode);
this->rootNode = NULL;
if(LuaScript::getDebugModeEnabled() == true) printf("Calling onLoad luaSavedGameData.size() = %d\n",(int)luaSavedGameData.size());
luaScript.beginCall("onLoad");
luaScript.endCall();
}
@ -1983,11 +1985,18 @@ void ScriptManager::addMessageToQueue(ScriptManagerMessage msg) {
}
void ScriptManager::storeSaveGameData(string name, string value) {
if(LuaScript::getDebugModeEnabled() == true) printf("storeSaveGameData name [%s] value [%s]\n",name.c_str(),value.c_str());
luaSavedGameData[name] = value;
}
string ScriptManager::loadSaveGameData(string name) {
return luaSavedGameData[name];
string value = luaSavedGameData[name];
if(LuaScript::getDebugModeEnabled() == true) printf("loadSaveGameData result name [%s] value [%s]\n",name.c_str(),value.c_str());
return value;
}
// ========================== lua callbacks ===============================================
@ -4895,6 +4904,8 @@ void ScriptManager::saveGame(XmlNode *rootNode) {
luaScript.beginCall("onSave");
luaScript.endCall();
if(LuaScript::getDebugModeEnabled() == true) printf("After onSave luaSavedGameData.size() = %d\n",(int)luaSavedGameData.size());
for(std::map<string, string>::iterator iterMap = luaSavedGameData.begin();
iterMap != luaSavedGameData.end(); ++iterMap) {
@ -5021,6 +5032,9 @@ void ScriptManager::loadGame(const XmlNode *rootNode) {
// LuaScript luaScript;
vector<XmlNode *> savedGameDataItemNodeList = scriptManagerNode->getChildList("SavedGameDataItem");
if(LuaScript::getDebugModeEnabled() == true) printf("In loadGame savedGameDataItemNodeList.size() = %d\n",(int)savedGameDataItemNodeList.size());
for(unsigned int i = 0; i < savedGameDataItemNodeList.size(); ++i) {
XmlNode *node = savedGameDataItemNodeList[i];
string key = node->getAttribute("key")->getValue();

View File

@ -56,6 +56,8 @@ public:
~LuaScript();
static void setDebugModeEnabled(bool value) { debugModeEnabled = value; }
static bool getDebugModeEnabled() { return debugModeEnabled; }
static void setDisableSandbox(bool value) { disableSandbox = value; }
void loadCode(string code, string name);