User Preferences file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Wargus |
Fix Released
|
Critical
|
Joris Dauphin |
Bug Description
Sometimes we add new options to preferences file. If user has valid preferences file and upgrade to new Wargus version (in which was change introduced) and do not delete or fix preferences file, Stratagus show similar lua error:
[string "/usr/share/
stack traceback:
[C]: in function 'SetMouseScroll
[string "/usr/share/
It is cased by script scripts/
Load("preferenc
if (wc2.preferences == nil) then
wc2.preferences = { ... }
end
...
SetMouseScrollS
So with old config wc2.preferences
What do you think, how to fix this problem? It is possible to patch lua functions (SetMouseScroll
if (wc2.preference
wc2.preferenc
fi
This is blocker which should be fixed before 2.2.7. Also this affects all games (not only Wargus).
Changed in wargus: | |
status: | Confirmed → Fix Committed |
assignee: | nobody → Joris Dauphin (joris-dauphin) |
Changed in wargus: | |
status: | Fix Committed → Fix Released |
I think the best solution should be something like:
-- 8< stratagus.lua 8< --
wc2 = {}
wc2.preferences = {}
-- set default preference .option1 = value1 .option2 = value2 .option3 = value3 .option4 = value4
wc2.preferences
wc2.preferences
wc2.preferences
wc2.preferences
-- ...
-- overwrite options with user preference. es.lua" )
Load("preferenc
-- Use options now wc2.preferences .option1)
UseOption1(
-- ...
-- >8 --
and
-- 8< preference.lua 8< -- .option1 = my_value1 .option2 = my_value2 .option3 = my_value3 .option4 = my_value4
if (wc2 == nil) then wc2 = {} end
if (wc2.preferences == nil) then wc2.preferences = {} end
wc2.preferences
wc2.preferences
wc2.preferences
wc2.preferences
...
-- >8 --