[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-devel] New options handling
From: |
Daniel Heck |
Subject: |
[Enigma-devel] New options handling |
Date: |
Sun, 16 Nov 2003 19:52:47 +0100 |
As I mentioned a few days ago I made a couple of changes to the way
Enigma deals with persistent data (i.e. options and user scores). Until
now things like this were stored in C++ structures or variables and a
tolua wrapper exported the data to Lua scripts. But there were a few
problems with this approach:
1) Defining options that are strings or vectors wasn't easy (mainly
toluas fault)
2) Adding a new option required changing three files: options.hh,
options.cc, enigma-lua.pkg
3) options.hh is included by almost any source file; adding an options
forces a recompile of almost the whole project
4) older versions of Enigma do not simply ignore options and level
information they do not understand, they throw it away. Ugly.
It took me some time to throw out the old code and replace it, but the
result is a lot better and more flexible than what we had before. The
changes in detail:
1) Persistent data is now stored in Lua tables. That way options from
newer versions don't get thrown away and it's easy to store data of
almost every data type.
2) Default values for options are now declared in data/startup.lua.
This file also contains Lua functions for loading and saving the state
from and to .enigmarc
3) On the C++ side, you cannot access the options as variables any
more; you have to use the functions provided in options.hh. E.g
options::GetBool ("FullScreen")
or
options::SetOption("SoundVolume", 1.0)
The new .enigmarc format should be backwards-compatible with the old
one. Please complain loudly if it isn't. And make a backup copy before
you try the new code!
Cheers
Daniel
--
Daniel Heck
http://www.rzuser.uni-heidelberg.de/~dheck/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Enigma-devel] New options handling,
Daniel Heck <=