Debian Codegraph @

src/settings.cpp

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 // Copyright 2005 by Anthony Liekens [email protected]
2 #ifdef HAVE_CONFIG_H
3 #include "config.h"
4 #endif
5
6 #include <sys/stat.h>
7
8 #include <cstdio>
9 #include <iostream>
10 #include <sstream>
11 #include <fstream>
12 #include <stdexcept>
13
14 #include <SDL/SDL.h>
15
16 #include "lisp/lisp.hpp"
17 #include "lisp/writer.hpp"
18 #include "lisp/parser.hpp"
19
20 #include "settings.h"
21 #include "input.h"
22
23 using namespace lisp;
24 using namespace std;
25
26 string Settings::fileName = getConfigFilePath() + "qonk.config";
27
28 int Settings::screenWidth = 0;
29 int Settings::screenHeight = 0;
30 bool Settings::fullscreen = false;
31
32 int Settings::gameWidth = 0;
33 int Settings::gameHeight = 0;
34 int Settings::gameOffsetX = 0;
35
36 int Settings::numberOfPlanets = 6;
37 int Settings::numberOfComputerPlayers = 1;
38 bool Settings::enemyVisibility = false;
39
40 Input Settings::inputMap[GA_COUNT][2];
41
42 string
43 Settings::getConfigFilePath(){
44 string pathname = "";
45 #ifdef WINDOWS
46 // Do nothing. Falls back to application directory.
47 #elif MAC_OSX
48 // Get from some mysterious directory ...
49 #else
50 // GNU/LINUX/BSD/POSIX/...
51 if(getenv("HOME")!=NULL) {
52 pathname = getenv("HOME");
53 pathname += "/.qonk/";
54 mkdir(pathname.c_str(), 0755);
55 }
56 #endif
57
58 return pathname;
59 }
60
61 void
62 Settings::init() {
63 // Ensures that input map is zeroed.
64 memset(inputMap, 0, sizeof(inputMap));
65
66 // Those are fixed and not supposed to be changed via a config file.
67 set(GA_TOGGLE_GRAB, IT_KEYBOARD, SDLK_g, 0, 0);
68 set(GA_LEAVE, IT_KEYBOARD, SDLK_ESCAPE, 0, 0);
•69 set(GA_MOVE_CURSOR_H, IT_MOUSEMOTION, 0, 0 , 0);
70 set(GA_MOVE_CURSOR_V, IT_MOUSEMOTION, 1, 0 , 0);
71
72 const lisp::Lisp* root = 0;
73
74 if( !fileExists(fileName))
75 {
76 cout << "configuration was not available - using defaults" << endl;
77 setScreenSize(800, 600);
78 setupDefaultActionMap();
79 return;
80 }
81
82 try
83 {
84 Parser parser;
85 root = parser.parse(fileName);
86 }
87 catch(std::exception& e)
88 {
89 printf("Config file '%s' does not exist, it will be created.\n",
90 fileName.c_str());
91 delete root;
92
93 return;
94 }
95
96 const Lisp *qonkReader = 0;
97 if (!(qonkReader = root->getLisp("qonk-config")))
98 {
99 cout << "configuration file malformed - using defaults" << endl;
100 setScreenSize(800, 600);
101 setupDefaultActionMap();
102
103 delete root;
104
105 return;
106 }
107
108 int configFileVersion = 0;
109 qonkReader->get("configFileVersion", configFileVersion);
110
111 if (configFileVersion < REQUIRED_CONFIG_FILE_VERSION)
112 {
113 cout << "configuration file version " << configFileVersion << " not supported - using default values." << endl;
114 setScreenSize(800, 600);
115 setupDefaultActionMap();
116
117 delete root;
118 // delete qonkReader;
119 return;
120 }
121
122 qonkReader->get("screenWidth", screenWidth);
123 qonkReader->get("screenHeight", screenHeight);
124 setScreenSize(screenWidth, screenHeight);
125
126 qonkReader->get("fullscreen", fullscreen);
127
128 qonkReader->get("planets", numberOfPlanets);
129 qonkReader->get("enemies", numberOfComputerPlayers);
130 qonkReader->get("enemiesVisible", enemyVisibility);
131
132 const Lisp *reader = 0;
133 reader = qonkReader->getLisp("input");
134 if (reader)
135 {
136 readInput(reader, "screenshot", GA_SCREENSHOT);
137 readInput(reader, "pause", GA_PAUSE);
138 readInput(reader, "toggleFullscreen", GA_TOGGLE_FULLSCREEN);
139 readInput(reader, "restartRound", GA_RESTART_ROUND);
140 readInput(reader, "nextRound", GA_NEXT_ROUND);
141
142 readInput(reader, "selectAll", GA_SELECT_ALL);
143 readInput(reader, "toggleEnemyVisibility", GA_TOGGLE_ENEMY_VISIBILITY);
144
145 readInput(reader, "selection", GA_SELECTION);
146
147 readInput(reader, "cursorUp", GA_CURSOR_UP);
148 readInput(reader, "cursorDown", GA_CURSOR_DOWN);
149 readInput(reader, "cursorLeft", GA_CURSOR_LEFT);
150 readInput(reader, "cursorRight", GA_CURSOR_RIGHT);
151
152 readInput(reader, "selectNearestPlanet", GA_SELECT_NEAREST_PLANET);
153 readInput(reader, "moveToNearestPlanet", GA_MOVE_TO_NEAREST_PLANET);
154
155 readInput(reader, "setFleetStrengthSingle", GA_SET_FLEET_STRENGTH_SINGLE);
156 readInput(reader, "fleetStrengthUp", GA_FLEET_STRENGTH_UP);
157 readInput(reader, "fleetStrengthDown", GA_FLEET_STRENGTH_DOWN);
158
159 readInput(reader, "setFleetStrength10", GA_SET_FLEET_STRENGTH_10);
160 readInput(reader, "setFleetStrength20", GA_SET_FLEET_STRENGTH_20);
161 readInput(reader, "setFleetStrength30", GA_SET_FLEET_STRENGTH_30);
162 readInput(reader, "setFleetStrength40", GA_SET_FLEET_STRENGTH_40);
163 readInput(reader, "setFleetStrength50", GA_SET_FLEET_STRENGTH_50);
164 readInput(reader, "setFleetStrength60", GA_SET_FLEET_STRENGTH_60);
165 readInput(reader, "setFleetStrength70", GA_SET_FLEET_STRENGTH_70);
166 readInput(reader, "setFleetStrength80", GA_SET_FLEET_STRENGTH_80);
167 readInput(reader, "setFleetStrength90", GA_SET_FLEET_STRENGTH_90);
168 readInput(reader, "setFleetStrength100", GA_SET_FLEET_STRENGTH_100);
169 }
170 else
171 {
172 cerr << "Input configuration not present or damaged - using defaults" << endl;
173 setupDefaultActionMap();
174 }
175
176 delete root;
177 }
178
179 void
180 Settings::setScreenSize( int width, int height ) {
181 screenWidth = width;
182 screenHeight = height;
183 gameWidth = height;
184 gameHeight = height;
185 gameOffsetX = ( width - height ) / 2;
186 }
187
188 void
189 Settings::store()
190 {
191 Writer *writer = new Writer(fileName);
192
193 try
194 {
195 writer->beginList("qonk-config");
196 writer->writeComment("If the game's supported config file version is higher than this number the configuration is discarded.");
197 writer->write("configFileVersion", CURRENT_CONFIG_FILE_VERSION);
198
199 writer->writeComment("General display properties");
200 writer->write("screenWidth", screenWidth);
201 writer->write("screenHeight", screenHeight);
202 writer->write("fullscreen", fullscreen);
203
204 writer->writeComment("General gameplay properties");
205 writer->write("planets", numberOfPlanets);
206 writer->write("enemies", numberOfComputerPlayers);
207 writer->write("enemiesVisible", enemyVisibility);
208
209 writer->beginList("input");
210
211 writeInput(writer, "screenshot", GA_SCREENSHOT);
212 writeInput(writer, "pause", GA_PAUSE);
213 writeInput(writer, "toggleFullscreen", GA_TOGGLE_FULLSCREEN);
214 writeInput(writer, "restartRound", GA_RESTART_ROUND);
215 writeInput(writer, "nextRound", GA_NEXT_ROUND);
216
217 writeInput(writer, "selectAll", GA_SELECT_ALL);
218 writeInput(writer, "toggleEnemyVisibility", GA_TOGGLE_ENEMY_VISIBILITY);
219
220 writeInput(writer, "selection", GA_SELECTION);
221
222 writeInput(writer, "cursorUp", GA_CURSOR_UP);
223 writeInput(writer, "cursorDown", GA_CURSOR_DOWN);
224 writeInput(writer, "cursorLeft", GA_CURSOR_LEFT);
225 writeInput(writer, "cursorRight", GA_CURSOR_RIGHT);
226
227 writeInput(writer, "selectNearestPlanet", GA_SELECT_NEAREST_PLANET);
228 writeInput(writer, "moveToNearestPlanet", GA_MOVE_TO_NEAREST_PLANET);
229
230 writeInput(writer, "setFleetStrengthSingle", GA_SET_FLEET_STRENGTH_SINGLE);
231 writeInput(writer, "fleetStrengthUp", GA_FLEET_STRENGTH_UP);
232 writeInput(writer, "fleetStrengthDown", GA_FLEET_STRENGTH_DOWN);
233
234 writeInput(writer, "setFleetStrength10", GA_SET_FLEET_STRENGTH_10);
235 writeInput(writer, "setFleetStrength20", GA_SET_FLEET_STRENGTH_20);
236 writeInput(writer, "setFleetStrength30", GA_SET_FLEET_STRENGTH_30);
237 writeInput(writer, "setFleetStrength40", GA_SET_FLEET_STRENGTH_40);
238 writeInput(writer, "setFleetStrength50", GA_SET_FLEET_STRENGTH_50);
239 writeInput(writer, "setFleetStrength60", GA_SET_FLEET_STRENGTH_60);
240 writeInput(writer, "setFleetStrength70", GA_SET_FLEET_STRENGTH_70);
241 writeInput(writer, "setFleetStrength80", GA_SET_FLEET_STRENGTH_80);
242 writeInput(writer, "setFleetStrength90", GA_SET_FLEET_STRENGTH_90);
243 writeInput(writer, "setFleetStrength100", GA_SET_FLEET_STRENGTH_100);
244
245 writer->endList("input");
246
247 writer->endList("qonk-config");
248 }
249 catch (exception &)
250 {
251 cerr << "Could not write config file." << endl;
252 }
253
254 delete writer;
255 }
256
257 void
258 Settings::readInput(const lisp::Lisp* r,
259 const char *node,
260 GameAction action)
261 {
262 string inputTypeName;
263 char *which[] = { "normal", "alternate" };
264
265 const Lisp* nodeReader = r->getLisp(node);
266 if (!nodeReader)
267 return;
268
269 for(int i=0;i<2;i++)
270 {
271 InputType it=IT_NONE;
272 // Every unused id variable *must* be set to
273 // something different than -1. Otherwise
274 // the restored mapping will not be applied.
275 int id0 = -1, id1 = -1, id2 = -1;
276
277 const Lisp *subReader = nodeReader->getLisp(which[i]);
278 if (!subReader)
279 break;
280
281 subReader->get("type", inputTypeName);
282 if (inputTypeName == "keyboard")
283 {
284 it = IT_KEYBOARD;
285 subReader->get("key", id0);
286 id1 = id2 = 0;
287 }
288 else if (inputTypeName == "stickaxis")
289 {
290 it = IT_STICKMOTION;
291 subReader->get("stick", id0);
292 subReader->get("axis", id1);
293 subReader->get("direction", id2);
294 }
295 else if (inputTypeName == "stickbutton")
296 {
297 it = IT_STICKBUTTON;
298 subReader->get("stick", id0);
299 subReader->get("button", id1);
300 id2 = 0;
301 }
302 else if (inputTypeName == "stickhat")
303 {
304 it = IT_STICKHAT;
305 // TODO: Implement me
306 }
307 else if (inputTypeName == "mouseaxis")
308 {
309 it = IT_MOUSEMOTION;
310 subReader->get("axis", id0);
311 subReader->get("direction", id1);
312 id2 = 0;
•313 if(id0 == 0 || id0 == 1)
314 id0 = -1; //ignore old bindings for mouse movement
315 }
316 else if (inputTypeName == "mousebutton")
317 {
318 it = IT_MOUSEBUTTON;
319 subReader->get("button", id0);
320 id1 = id2 = 0;
321 }
322
323 if (id0 != -1 && id1 != -1 && id2 != -1)
324 set(action, it, id0, id1, id2);
325
326 }
327
328 }
329
330 void
331 Settings::unset(GameAction ga)
332 {
333 // Deletes the 2nd entry if it exists or
334 // the first if not.
335 if (inputMap[ga][1].inputType != IT_NONE)
336 inputMap[ga][1].inputType = IT_NONE;
337 else
338 inputMap[ga][0].inputType = IT_NONE;
339 }
340
341 void
342 Settings::unsetDuplicates (GameAction ga, InputType it, int id0, int id1, int id2)
343 {
344 for (int cga = GA_FIRST; cga < GA_COUNT; cga++)
345 {
346 if (cga != ga)
347 {
348 // If the input occurs in any other mapping
349 // delete it properly from there.
350
351 if (inputMap[cga][1].inputType == it
352 && inputMap[cga][1].id0 == id0
353 && inputMap[cga][1].id1 == id1
354 && inputMap[cga][1].id2 == id2)
355 {
356 // Deletes it from the 2nd entry.
357 inputMap[cga][1].inputType = IT_NONE;
358 }
359
360 if (inputMap[cga][0].inputType == it
361 && inputMap[cga][0].id0 == id0
362 && inputMap[cga][0].id1 == id1
363 && inputMap[cga][0].id2 == id2)
364 {
365 // Deletes it from the 1st entry and
366 // shifts the 2nd to the first.
367 inputMap[cga][0] = inputMap[cga][1];
368 inputMap[cga][1].inputType = IT_NONE;
369 }
370 }
371 }
372 }
373
374 void
375 Settings::set(GameAction ga, InputType it, int id0, int id1, int id2)
376 {
377 // Do not change anything if the sensed input already
378 // exists for the game action.
379 if (inputMap[ga][0].inputType == it
380 && inputMap[ga][0].id0 == id0
381 && inputMap[ga][0].id1 == id1
382 && inputMap[ga][0].id2 == id2
383 || inputMap[ga][1].inputType == it
384 && inputMap[ga][1].id0 == id0
385 && inputMap[ga][1].id1 == id1
386 && inputMap[ga][1].id2 == id2)
387 return;
388
389 // Removes the input from all mappings where it occurs.
390 unsetDuplicates(ga, it, id0, id1, id2);
391
392 // Setting a new value is implemented by shifting the value to the
393 // right and applying the new values in the 1st location.
394
395 inputMap[ga][1] = inputMap[ga][0];
396
397 // New input is always placed on the first location.
398 Input &im = inputMap[ga][0];
399
400 im.inputType = it;
401 im.id0 = id0;
402 im.id1 = id1;
403 im.id2 = id2;
404 }
405
406 /**
407 * Connects the given Input with the GameAction.
408 *
409 * TODO: In the future the return value may indicate whether
410 * the input is already in use (conflict) and was rejected.
411 */
412 void
413 Settings::set(GameAction ga, Input &input)
414 {
415 set(ga, input.inputType, input.id0, input.id1, input.id2);
416 }
417
418 void
419 Settings::writeInput(lisp::Writer *writer, const char *node, GameAction action)
420 {
421 writer->beginList(node);
422
423 for (int i=0;i<2;i++)
424 {
425 const Input input = inputMap[action][i];
426 const char *which[] = { "normal", "alternate" };
427
428 if (input.inputType != IT_NONE)
429 {
430 writer->beginList(which[i]);
431
432 switch (input.inputType)
433 {
434 case IT_KEYBOARD:
435 writer->write("type", "keyboard");
436 writer->write("key", input.id0);
437 break;
438 case IT_STICKMOTION:
439 writer->write("type", "stickaxis");
440 writer->write("stick", input.id0);
441 writer->write("axis", input.id1);
442 writer->writeComment("0 is negative/left/up, 1 is positive/right/down");
443 writer->write("direction", input.id2);
444 break;
445 case IT_STICKBUTTON:
446 writer->write("type", "stickbutton");
447 writer->write("stick", input.id0);
448 writer->write("button", input.id1);
449 break;
450 case IT_STICKHAT:
451 // TODO: Implement me
452 break;
453 case IT_MOUSEMOTION:
454 writer->write("type", "mouseaxis");
455 writer->write("axis", input.id0);
456 writer->writeComment("0 is negative/left/up, 1 is positive/right/down");
457 writer->write("direction", input.id1);
458 break;
459 case IT_MOUSEBUTTON:
460 writer->write("type", "mousebutton");
461 writer->writeComment("0 is left, 1 is middle, 2 is right, 3 is wheel up, 4 is wheel down");
462 writer->writeComment("other values denote auxillary buttons");
463 writer->write("button", input.id0);
464 break;
465 }
466 writer->endList(which[i]);
467 }
468
469 }
470
471 writer->endList(node);
472 }
473
474 void
475 Settings::setupDefaultActionMap()
476 {
477 set(GA_SCREENSHOT, IT_KEYBOARD, SDLK_F12, 0, 0);
478 set(GA_PAUSE, IT_KEYBOARD, SDLK_p, 0, 0);
479 set(GA_TOGGLE_FULLSCREEN, IT_KEYBOARD, SDLK_f, 0, 0);
480
481 set(GA_RESTART_ROUND, IT_KEYBOARD, SDLK_r, 0, 0);
482 set(GA_NEXT_ROUND, IT_KEYBOARD, SDLK_n, 0, 0);
483
484 set(GA_SELECT_ALL, IT_KEYBOARD, SDLK_a, 0, 0);
485 set(GA_TOGGLE_ENEMY_VISIBILITY, IT_KEYBOARD, SDLK_e, 0, 0);
486
487 set(GA_SELECTION, IT_MOUSEBUTTON, SDL_BUTTON_LEFT, 0, 0);
488 set(GA_SELECTION, IT_KEYBOARD, SDLK_LSHIFT, 0, 0);
489
490 set(GA_SELECT_NEAREST_PLANET, IT_MOUSEBUTTON, SDL_BUTTON_MIDDLE, 0, 0);
491 set(GA_SELECT_NEAREST_PLANET, IT_KEYBOARD, SDLK_TAB, 0, 0);
492
493 set(GA_MOVE_TO_NEAREST_PLANET, IT_MOUSEBUTTON, SDL_BUTTON_RIGHT, 0, 0);
494 set(GA_MOVE_TO_NEAREST_PLANET, IT_KEYBOARD, SDLK_LCTRL, 0, 0);
495
496 set(GA_CURSOR_LEFT, IT_KEYBOARD, SDLK_LEFT, 0, 0);
497
498 set(GA_CURSOR_RIGHT, IT_KEYBOARD, SDLK_RIGHT, 0, 0);
499
500 set(GA_CURSOR_UP, IT_KEYBOARD, SDLK_UP, 0, 0);
501
502 set(GA_CURSOR_DOWN, IT_KEYBOARD, SDLK_DOWN, 0, 0);
503
504 /* preliminary: cursor control with joystick - works good
505 set(GA_SELECTION, IT_STICKBUTTON, 0, 1, 0);
506 set(GA_SELECT_NEAREST_PLANET, IT_STICKBUTTON, 0, 2, 0);
507 set(GA_MOVE_TO_NEAREST_PLANET, IT_STICKBUTTON, 0, 3, 0);
508 set(GA_CURSOR_LEFT, IT_STICKMOTION, 0, 0, AD_NEGATIVE);
509 set(GA_CURSOR_RIGHT, IT_STICKMOTION, 0, 0, AD_POSITIVE);
510 set(GA_CURSOR_UP, IT_STICKMOTION, 0, 1, AD_NEGATIVE);
511 set(GA_CURSOR_DOWN, IT_STICKMOTION, 0, 1, AD_POSITIVE);
512 */
513
514 set(GA_FLEET_STRENGTH_UP, IT_MOUSEBUTTON, SDL_BUTTON_WHEELUP, 0, 0);
515 set(GA_FLEET_STRENGTH_UP, IT_KEYBOARD, SDLK_PLUS, 0, 0);
516
517 set(GA_FLEET_STRENGTH_DOWN, IT_MOUSEBUTTON, SDL_BUTTON_WHEELDOWN, 0, 0);
518 set(GA_FLEET_STRENGTH_DOWN, IT_KEYBOARD, SDLK_MINUS, 0, 0);
519
520 set(GA_SET_FLEET_STRENGTH_SINGLE, IT_KEYBOARD, SDLK_s, 0, 0);
521 set(GA_SET_FLEET_STRENGTH_10, IT_KEYBOARD, SDLK_1, 0, 0);
522 set(GA_SET_FLEET_STRENGTH_20, IT_KEYBOARD, SDLK_2, 0, 0);
523 set(GA_SET_FLEET_STRENGTH_30, IT_KEYBOARD, SDLK_3, 0, 0);
524 set(GA_SET_FLEET_STRENGTH_40, IT_KEYBOARD, SDLK_4, 0, 0);
525 set(GA_SET_FLEET_STRENGTH_50, IT_KEYBOARD, SDLK_5, 0, 0);
526 set(GA_SET_FLEET_STRENGTH_60, IT_KEYBOARD, SDLK_6, 0, 0);
527 set(GA_SET_FLEET_STRENGTH_70, IT_KEYBOARD, SDLK_7, 0, 0);
528 set(GA_SET_FLEET_STRENGTH_80, IT_KEYBOARD, SDLK_8, 0, 0);
529 set(GA_SET_FLEET_STRENGTH_90, IT_KEYBOARD, SDLK_9, 0, 0);
530 set(GA_SET_FLEET_STRENGTH_100, IT_KEYBOARD, SDLK_0, 0, 0);
531 }
532
533 Input
534 Settings::getInput(GameAction ga)
535 {
536 return inputMap[ga][0];
537 }
538
539 Input
540 Settings::getAltInput(GameAction ga)
541 {
542 return inputMap[ga][1];
543 }
544
545 string
546 Settings::getInputAsString(Input &input)
547 {
548 char msg[512];
549 std::ostringstream stm;
550
551 switch (input.inputType)
552 {
553 case IT_KEYBOARD:
554 snprintf(msg, sizeof(msg), ("%s"), SDL_GetKeyName((SDLKey) input.id0));
555 break;
556 case IT_STICKMOTION:
557 snprintf(msg, sizeof(msg), ("joy %d axis %d %c"),
558 input.id0, input.id1, (input.id2 == AD_NEGATIVE) ? '-' : '+');
559 break;
560 case IT_STICKBUTTON:
561 snprintf(msg, sizeof(msg), ("joy %d button %d"), input.id0, input.id1);
562 break;
563 case IT_STICKHAT:
564 snprintf(msg, sizeof(msg), ("joy %d hat %d"), input.id0, input.id1);
565 break;
566 case IT_MOUSEBUTTON:
567 snprintf(msg, sizeof(msg), ("mouse button %d"), input.id0);
568 break;
569 case IT_MOUSEMOTION:
570 // Axis 0 and 1 represent x and y. Thats for sure. If we get higher
571 // numbers just print those instead.
572 if (input.id0 < 2)
573 snprintf(msg, sizeof(msg), ("mouse %c axis %c"),
574 ((input.id0 == 0) ? 'x' : 'y'), ((input.id1 == AD_NEGATIVE) ? '-' : '+'));
575 else
576 snprintf(msg, sizeof(msg), ("mouse axis %d %c"),
577 input.id0, ((input.id1 == AD_NEGATIVE) ? '-' : '+'));
578
579 break;
580 default:
581 snprintf(msg, sizeof(msg), ("Invalid"));
582 }
583
584 stm << msg;
585
586 return stm.str();
587 }
588
589 string
590 Settings::getAsString(GameAction ga)
591 {
592 Input input = inputMap[ga][0];
593 if (input.inputType != IT_NONE)
594 {
595 stringstream s;
596 s << getInputAsString(input);
597
598 input = inputMap[ga][1];
599 if (input.inputType != IT_NONE)
600 s << " or " << getInputAsString(input);
601
602 return s.str();
603 }
604 else
605 {
606 return string("undefined");
607 }
608 }
609
610 void
611 Settings::printInput(char *msg)
612 {
613 cerr << msg << ":" << endl;
614
615 int size = GA_FIRST + GA_COUNT;
616 for (int i=GA_FIRST; i<size;i++)
617 {
618 Input input = inputMap[i][0];
619 cerr << "normal action: " << i << " - input.inputType: " << input.inputType << " - input.id0: " << input.id0 << endl;
620 input = inputMap[i][1];
621 cerr << " alt action: " << i << " - input.inputType: " << input.inputType << " - input.id0: " << input.id0 << endl << endl;
622 }
623 }
624
625 bool
626 Settings::fileExists( const std::string& fileName ) {
627 std::ifstream infile( fileName.c_str() );
628 bool result = infile.good();
629 infile.close();
630
631 return result;
632 }