Reject [terrain] with unknown terrain type

This commit is contained in:
Toom 2024-05-21 12:34:41 +03:00 committed by GitHub
parent e262954c13
commit 9e08a78bf5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -463,6 +463,9 @@ end
function wml_actions.terrain(cfg)
local terrain = cfg.terrain or wml.error("[terrain] missing required terrain= attribute")
local layer = cfg.layer or 'both'
if not (wesnoth.terrain_types[terrain] or (layer == "overlay" and terrain == "^")) then
wml.error("[terrain] invalid terrain="..terrain)
end
if layer ~= 'both' and layer ~= 'overlay' and layer ~= 'base' then
wml.error('[terrain] invalid layer=')
end