mirror of
https://github.com/minetest/minetest.git
synced 2024-12-28 00:47:29 +01:00
Fix #4111 ("Provided world path doesn't exist" if choosing singleplayer on first run")
Bug and whitespace error fixed (Zeno)
This commit is contained in:
parent
997002703b
commit
9d3d43f334
@ -77,13 +77,28 @@ local function init_globals()
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
local world_list = core.get_worlds()
|
||||
local world_index = table.indexof(world_list, "singleplayerworld")
|
||||
local world_index
|
||||
|
||||
if world_index == -1 then
|
||||
local found_singleplayerworld = false
|
||||
for i, world in ipairs(world_list) do
|
||||
if world.name == "singleplayerworld" then
|
||||
found_singleplayerworld = true
|
||||
world_index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not found_singleplayerworld then
|
||||
core.create_world("singleplayerworld", 1)
|
||||
|
||||
world_list = core.get_worlds()
|
||||
world_index = table.indexof(world_list, "singleplayerworld")
|
||||
|
||||
for i, world in ipairs(world_list) do
|
||||
if world.name == "singleplayerworld" then
|
||||
world_index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
gamedata.worldindex = world_index
|
||||
|
Loading…
Reference in New Issue
Block a user