mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-29 22:01:40 +00:00
Preserved item orders at load and save time. (Fix for bug #16771.)
This commit is contained in:
parent
28db7a19d0
commit
bec8a218da
@ -35,7 +35,7 @@ local old_on_save = game_events.on_save
|
||||
function game_events.on_save()
|
||||
local custom_cfg = old_on_save()
|
||||
for i,v in pairs(scenario_items) do
|
||||
for j,w in pairs(v) do
|
||||
for j,w in ipairs(v) do
|
||||
table.insert(custom_cfg, { "item", w })
|
||||
end
|
||||
end
|
||||
@ -44,12 +44,15 @@ end
|
||||
|
||||
local old_on_load = game_events.on_load
|
||||
function game_events.on_load(cfg)
|
||||
for i = #cfg,1,-1 do
|
||||
local i = 1
|
||||
while i <= #cfg do
|
||||
local v = cfg[i]
|
||||
if v[1] == "item" then
|
||||
local v2 = v[2]
|
||||
add_overlay(v2.x, v2.y, v2)
|
||||
table.remove(cfg, i)
|
||||
else
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
old_on_load(cfg)
|
||||
|
@ -1856,6 +1856,9 @@ For game purposes, the races group into factions; for example, orcs often cooper
|
||||
[/event]
|
||||
[/event]
|
||||
|
||||
{PLACE_IMAGE "units/human-outlaws/poacher.png~TC(2,magenta)" 20 14}
|
||||
{PLACE_IMAGE items/cage.png 20 14}
|
||||
|
||||
[item]
|
||||
x,y=8,5
|
||||
image="items/orcish-flag.png"
|
||||
|
Loading…
x
Reference in New Issue
Block a user