Mercurial > projects > mde
diff mde/lookup/Options.d @ 86:79d816b3e2d2
New InitStage system, Screen & Screen.Drawable, separate testing and guiDemo binaries.
This (and the previous) commit are the result of several quite significant changes to mde. All the unittests run, but it hasn't had a huge amount of testing so don't be surprised if bugs show up.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 12 Sep 2008 17:36:14 +0100 |
parents | 56c0ddd90193 |
children | 97e6dce08037 |
line wrap: on
line diff
--- a/mde/lookup/Options.d Thu Sep 11 11:33:51 2008 +0100 +++ b/mde/lookup/Options.d Fri Sep 12 17:36:14 2008 +0100 @@ -136,7 +136,6 @@ assert (c !is null); // Instance must be created before calling addOptionsClass assert (((cast(ID) i) in subClasses) is null); // Don't allow a silent replacement } body { - debug logger.trace ("Adding Options subClass: "~i); subClasses[cast(ID) i] = c; } @@ -169,27 +168,18 @@ } void save () { if (!changed) return; // no changes to save - // Types: - // interface IDataSection {...} - // class Options {...} - // alias char[] ID; - // IDataSection[ID] ds.sec; - // Options[ID] subClasses; + debug logger.trace ("Saving options..."); + DataSet ds = new DataSet(); - foreach (id, subOpts; subClasses) { + foreach (id, subOpts; subClasses) ds.sec[id] = subOpts.optionChanges; - debug logger.trace ("Saving options section: "~id); - } - foreach (i,s; ds.sec) - debug logger.trace ("sec ID length: {}", i.length); - debug logger.trace ("0"); // Read locally-stored options try { IReader reader; reader = confDir.makeMTReader (fileName, PRIORITY.HIGH_ONLY, ds); reader.dataSecCreator = delegate IDataSection(ID id) { - debug logger.trace ("New section to save ignored: "~id); + debug logger.warn ("New section appearing in options.mtt during save (ignored & overwritten): "~id); return null; // All recognised sections are already in the dataset. }; reader.read; @@ -201,15 +191,9 @@ } try { - debug logger.trace ("1"); IWriter writer; - foreach (i,s; ds.sec) - debug logger.trace ("sec ID length: {}", i.length); - debug logger.trace ("2"); - writer = confDir.makeMTWriter (fileName, ds); // FIXME - sometimes SIGSEGV - debug logger.trace ("3"); - writer.write(); // FIXME - this is causing hang at exit! - debug logger.trace ("4"); + writer = confDir.makeMTWriter (fileName, ds); + writer.write(); } catch (Exception e) { logger.error ("Saving options aborted: "~e.msg); }