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