Mercurial > projects > mde
comparison mde/input/config.d @ 7:b544c3a7c9ca
Some changes to exceptions and a few more debug commands.
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 16 Jan 2008 12:48:07 +0000 |
parents | 9a990644948c |
children | f63f4f41a2dc |
comparison
equal
deleted
inserted
replaced
6:dcb24afa0dce | 7:b544c3a7c9ca |
---|---|
79 * new codes will be defined. | 79 * new codes will be defined. |
80 */ | 80 */ |
81 outQueue[uint] button; | 81 outQueue[uint] button; |
82 outQueue[uint] axis; /// ditto | 82 outQueue[uint] axis; /// ditto |
83 outQueue[uint] mouse; /// ditto | 83 outQueue[uint] mouse; /// ditto |
84 debug uint dnbc; // debug num button configs | |
84 | 85 |
85 char[] name; /// Name for user to save this under. | 86 char[] name; /// Name for user to save this under. |
86 uint[] inheritants; /// Other profiles to inherit. | 87 uint[] inheritants; /// Other profiles to inherit. |
87 | 88 |
88 // FIXME: using uint IDs really isn't nice... | 89 // FIXME: using uint IDs really isn't nice... |
122 // NOTE: this is in some ways dangerous (assuming all DataSections are Configs), but they should be. | 123 // NOTE: this is in some ways dangerous (assuming all DataSections are Configs), but they should be. |
123 debug { | 124 debug { |
124 char tmp[128] = void; | 125 char tmp[128] = void; |
125 logger.info (logger.format (tmp, "Loaded {} config sections.", configs.length)); | 126 logger.info (logger.format (tmp, "Loaded {} config sections.", configs.length)); |
126 foreach (id, cfg; configs) { | 127 foreach (id, cfg; configs) { |
127 logger.trace ("Section "~format!(uint)(id)~": " ~ format!(uint[][uint])(cfg.button)); | 128 logger.trace ("Section "~format!(uint)(id)~": " ~ format!(uint[][uint])(cfg.button) ~ " (" ~ format!(uint)(cfg.dnbc) ~ ")"); |
128 } | 129 } |
129 } | 130 } |
130 } | 131 } |
131 | 132 |
132 private enum QUEUE : ID { BUTTON, AXIS, MOUSE } | 133 private enum QUEUE : ID { BUTTON, AXIS, MOUSE } |
135 void addTag (char[] tp, ID id, char[] dt) { | 136 void addTag (char[] tp, ID id, char[] dt) { |
136 if (tp == "uint[][uint]") { | 137 if (tp == "uint[][uint]") { |
137 if (id == QUEUE.BUTTON) { | 138 if (id == QUEUE.BUTTON) { |
138 button = cast(outQueue[uint]) parse!(uint[][uint]) (dt); | 139 button = cast(outQueue[uint]) parse!(uint[][uint]) (dt); |
139 debug logger.trace ("Added button config: " ~ format!(uint[][uint])(button)); | 140 debug logger.trace ("Added button config: " ~ format!(uint[][uint])(button)); |
141 debug ++dnbc; | |
140 } | 142 } |
141 else if (id == QUEUE.AXIS) axis = cast(outQueue[uint]) parse!(uint[][uint]) (dt); | 143 else if (id == QUEUE.AXIS) axis = cast(outQueue[uint]) parse!(uint[][uint]) (dt); |
142 else if (id == QUEUE.MOUSE) mouse = cast(outQueue[uint]) parse!(uint[][uint]) (dt); | 144 else if (id == QUEUE.MOUSE) mouse = cast(outQueue[uint]) parse!(uint[][uint]) (dt); |
143 else { | 145 else { |
144 char[80] tmp; | 146 char[80] tmp; |
148 else throw new MTUnknownTypeException ("Input Config: only uint[][uint] type supported"); | 150 else throw new MTUnknownTypeException ("Input Config: only uint[][uint] type supported"); |
149 } | 151 } |
150 void writeAll (ItemDelg) { | 152 void writeAll (ItemDelg) { |
151 // FIXME | 153 // FIXME |
152 } | 154 } |
155 debug void debugFunc () { | |
156 logger.trace ("After parse: " ~ format!(uint[][uint])(button) ~ " (" ~ format!(uint)(dnbc) ~ ")"); | |
157 } | |
153 //END File loading/saving code | 158 //END File loading/saving code |
154 } | 159 } |