]> jfr.im git - irc/gameservirc.git/blame - gameserv/configscript.cpp
Implemented a log command, and changed all output to go to a log file. Currently...
[irc/gameservirc.git] / gameserv / configscript.cpp
CommitLineData
f8656e40 1#include <fstream>
2#include <iostream>
3
f8656e40 4using std::cout;
42ec1800 5using std::cin;
6using std::endl;
f8656e40 7using std::ofstream;
8
9f8c2acc 9char menu(int page = 1);
f8656e40 10
11int main()
12{
13 ofstream outfile;
14
15 outfile.open("options.h");
16 if (outfile.fail())
17 {
9cc5ab57 18 cout << "Error opening options.h" << endl;
f8656e40 19 return 1;
20 }
21 char c = 0;
22
23 do {
24 c = menu();
25 switch(c)
26 {
27 case '1':
28 outfile << "#define UNREAL" << endl;
29 outfile << "#undef BAHAMUT" << endl;
30 break;
31 case '2':
32 outfile << "#undef UNREAL" << endl;
33 outfile << "#define BAHAMUT" << endl;
34 break;
35 default:
9f8c2acc 36 break;
f8656e40 37 }
173302fe 38 }while (c == 'Q' || c == 'q' || (int(c) < 48) || (int(c) > 57));
f8656e40 39
9f8c2acc 40 do {
41 c = menu(2);
42 switch(c)
43 {
44 case 'y':
45 case 'Y':
46 outfile << "#define DEBUGMODE" << endl;
47 break;
48 case 'n':
49 case 'N':
50 outfile << "#undef DEBUGMODE" << endl;
51 break;
52 default:
53 break;
54 }
55 }while (c != 'y' && c != 'Y' && c != 'n' && c != 'N');
f8656e40 56 outfile.close();
57return 0;
58}
59
9f8c2acc 60char menu(int page)
f8656e40 61{
62 char selection = 0;
63
9f8c2acc 64 if (page == 2)
65 {
66 cout << "Do you want to enable debug mode? (Y/N): ";
67 }
68 else
69 {
70 cout << "Choose your IRCD" << endl;
71 cout << "1. Unreal3.x\r\n"
72 << "2. bahamut-1.4.x" << endl;
73 cout << "Make your selection: ";
74 }
75
f8656e40 76 cin >> selection;
77 return selection;
78}