Skip to content

Commit

Permalink
Fix minetest#4111 ("Provided world path doesn't exist" if choosing si…
Browse files Browse the repository at this point in the history
…ngleplayer on first run")

Bug and whitespace error fixed (Zeno)
  • Loading branch information
Rui authored and Zeno- committed May 12, 2016
1 parent 9970027 commit 9d3d43f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions builtin/mainmenu/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

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 world_index == -1 then
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
Expand Down

0 comments on commit 9d3d43f

Please sign in to comment.