Adapted the code to lua 5.3 and the new version of opengl for glDeleteTextures.
This commit is contained in:
parent
05d1cac88f
commit
2451f512b5
3 changed files with 23 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -26,3 +26,5 @@ obj-*
|
||||||
./stratagus.suo
|
./stratagus.suo
|
||||||
./tolua.cpp
|
./tolua.cpp
|
||||||
./tolua.cpp.rule
|
./tolua.cpp.rule
|
||||||
|
build
|
||||||
|
.vscode
|
||||||
|
|
|
@ -2124,9 +2124,14 @@ void InitLua()
|
||||||
Lua = luaL_newstate();
|
Lua = luaL_newstate();
|
||||||
|
|
||||||
for (const luaL_Reg *lib = lualibs; lib->func; ++lib) {
|
for (const luaL_Reg *lib = lualibs; lib->func; ++lib) {
|
||||||
|
#if LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 502
|
||||||
|
luaL_requiref(Lua, lib->name, lib->func, 1);
|
||||||
|
lua_pop(Lua, 1);
|
||||||
|
#else
|
||||||
lua_pushcfunction(Lua, lib->func);
|
lua_pushcfunction(Lua, lib->func);
|
||||||
lua_pushstring(Lua, lib->name);
|
lua_pushstring(Lua, lib->name);
|
||||||
lua_call(Lua, 1, 0);
|
lua_call(Lua, 1, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
tolua_stratagus_open(Lua);
|
tolua_stratagus_open(Lua);
|
||||||
lua_settop(Lua, 0); // discard any results
|
lua_settop(Lua, 0); // discard any results
|
||||||
|
@ -2306,9 +2311,16 @@ static std::string SaveGlobal(lua_State *l, bool is_root, std::vector<std::strin
|
||||||
lua_pop(l, 1); // pop the value
|
lua_pop(l, 1); // pop the value
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string lhsLine;
|
std::string lhsLine;
|
||||||
if (tablesName.empty() == false) {
|
if (tablesName.empty() == false) {
|
||||||
if (type_key == LUA_TSTRING) {
|
if (type_key == LUA_TSTRING) {
|
||||||
|
/*if(key.empty()) {
|
||||||
|
lua_pop(l, 1);
|
||||||
|
lua_pop(l, 1);
|
||||||
|
return res;
|
||||||
|
}*/
|
||||||
lhsLine = tablesName + "." + key;
|
lhsLine = tablesName + "." + key;
|
||||||
} else if (type_key == LUA_TNUMBER) {
|
} else if (type_key == LUA_TNUMBER) {
|
||||||
lua_pushvalue(l, -2);
|
lua_pushvalue(l, -2);
|
||||||
|
@ -2331,13 +2343,17 @@ static std::string SaveGlobal(lua_State *l, bool is_root, std::vector<std::strin
|
||||||
key = key + "[" + lua_tostring(l, -1) + "]";
|
key = key + "[" + lua_tostring(l, -1) + "]";
|
||||||
lua_pop(l, 1);
|
lua_pop(l, 1);
|
||||||
}
|
}
|
||||||
lua_pushvalue(l, -1);
|
|
||||||
//res += "if (" + lhsLine + " == nil) then " + lhsLine + " = {} end\n";
|
//res += "if (" + lhsLine + " == nil) then " + lhsLine + " = {} end\n";
|
||||||
|
if(std::find(blockTableNames.begin(), blockTableNames.end(), key) == blockTableNames.end()
|
||||||
|
&& key != "[]")
|
||||||
|
{
|
||||||
|
lua_pushvalue(l, -1);
|
||||||
blockTableNames.push_back(key);
|
blockTableNames.push_back(key);
|
||||||
res += SaveGlobal(l, false, blockTableNames);
|
res += SaveGlobal(l, false, blockTableNames);
|
||||||
blockTableNames.pop_back();
|
blockTableNames.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lua_pop(l, 1); /* pop the value */
|
lua_pop(l, 1); /* pop the value */
|
||||||
}
|
}
|
||||||
lua_pop(l, 1); // pop the table
|
lua_pop(l, 1); // pop the table
|
||||||
|
|
|
@ -1652,7 +1652,7 @@ bool CGraphic::DeleteColorCyclingTextures() {
|
||||||
if (!ColorCyclingTextures) return false;
|
if (!ColorCyclingTextures) return false;
|
||||||
for (int i = 0; i < NumColorCycles; i++) {
|
for (int i = 0; i < NumColorCycles; i++) {
|
||||||
glDeleteTextures(NumTextures, ColorCyclingTextures[i]);
|
glDeleteTextures(NumTextures, ColorCyclingTextures[i]);
|
||||||
delete[] ColorCyclingTextures[i];
|
//delete[] ColorCyclingTextures[i]; //glDeleteTextures already deletes the array
|
||||||
}
|
}
|
||||||
delete[] ColorCyclingTextures;
|
delete[] ColorCyclingTextures;
|
||||||
ColorCyclingTextures = NULL;
|
ColorCyclingTextures = NULL;
|
||||||
|
|
Loading…
Reference in a new issue