Skip to content

Commit

Permalink
THoT S05 Fix bug: Lua error
Browse files Browse the repository at this point in the history
If there is no place to put the spawn, skip spawning any more units rather than throw a Lua error.
  • Loading branch information
GregoryLundberg committed Oct 11, 2016
1 parent 8c3c557 commit 3300dd3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions data/campaigns/The_Hammer_of_Thursagan/lua/spawns.lua
Expand Up @@ -14,6 +14,7 @@ function wml_actions.spawn_units(cfg)
for i=1,count do
local locs = wesnoth.get_locations({T["not"] { T.filter {} } , T["and"] { x = x, y = y, radius = 1 } })
if #locs == 0 then locs = wesnoth.get_locations({T["not"] { T.filter {} } , T["and"] { x = x, y = y, radius = 2 } }) end
if #locs == 0 then break end

local unit_type = helper.rand(types)
local loc_i = helper.rand("1.."..#locs)
Expand Down

0 comments on commit 3300dd3

Please sign in to comment.