Skip to content
Snippets Groups Projects
Commit 2eb0dc8f authored by DarkGod's avatar DarkGod
Browse files

If the stone wardens addon can not be enabled due to failed login, savefile...

If the stone wardens addon can not be enabled due to failed login, savefile loading will abord instead of damaging it.
parent 45e858a2
No related branches found
No related tags found
No related merge requests found
......@@ -419,6 +419,12 @@ function _M:loadAddons(mod, saveuse)
else
print("Removing addon "..add.short_name..": DLC class not received")
table.remove(adds, i) removed = true
if saveuse then
-- The savefile requires it, but we couldnt activate it, abord
core.game.setRebootMessage(([[The savefile requires the #YELLOW#%s#WHITE# addon.
Some of its features require being online and could not be enabled. To prevent damaging the savefile loading was aborded.]]):format(add.long_name))
util.showMainMenu()
end
break
end
end
......
......@@ -178,6 +178,11 @@ Safe Mode disabled all graphical options and sets a low FPS. It is not advisable
Please go to the Video Options and try enabling/disabling options and then restarting until you do not get this message.
A usual problem is shaders and thus should be your first target to disable.]], 700)
end
local reboot_message = core.game.getRebootMessage()
if reboot_message then
Dialog:simpleLongPopup("Message", reboot_message, 700)
end
end
function _M:grabAddons()
......
......@@ -542,8 +542,28 @@ static int lua_check_error(lua_State *L)
return 1;
}
static char *reboot_message = NULL;
static int lua_set_reboot_message(lua_State *L)
{
const char *msg = luaL_checkstring(L, 1);
if (reboot_message) { free(reboot_message); }
reboot_message = strdup(msg);
return 0;
}
static int lua_get_reboot_message(lua_State *L)
{
if (reboot_message) {
lua_pushstring(L, reboot_message);
free(reboot_message);
reboot_message = NULL;
} else lua_pushnil(L);
return 1;
}
static const struct luaL_Reg gamelib[] =
{
{"setRebootMessage", lua_set_reboot_message},
{"getRebootMessage", lua_get_reboot_message},
{"reboot", lua_reboot_lua},
{"set_current_game", lua_set_current_game},
{"exit_engine", lua_exit_engine},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment