]> jfr.im git - irc/gameservirc.git/blame - gameserv/configscript.cpp
Added the new contributed hybrid patch for 1.1.7. Thanks wcampbel!
[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;
e1c41a84 31 outfile << "#undef P10" << endl;
f8656e40 32 break;
33 case '2':
34 outfile << "#undef UNREAL" << endl;
35 outfile << "#define BAHAMUT" << endl;
e1c41a84 36 outfile << "#undef P10" << endl;
37 break;
38 case '3':
39 outfile << "#undef UNREAL" << endl;
40 outfile << "#undef BAHAMUT" << endl;
41 outfile << "#define P10" << endl;
f8656e40 42 break;
43 default:
9f8c2acc 44 break;
f8656e40 45 }
173302fe 46 }while (c == 'Q' || c == 'q' || (int(c) < 48) || (int(c) > 57));
f8656e40 47
9f8c2acc 48 do {
49 c = menu(2);
50 switch(c)
51 {
52 case 'y':
53 case 'Y':
54 outfile << "#define DEBUGMODE" << endl;
55 break;
56 case 'n':
57 case 'N':
58 outfile << "#undef DEBUGMODE" << endl;
59 break;
60 default:
61 break;
62 }
63 }while (c != 'y' && c != 'Y' && c != 'n' && c != 'N');
f8656e40 64 outfile.close();
65return 0;
66}
67
9f8c2acc 68char menu(int page)
f8656e40 69{
70 char selection = 0;
71
9f8c2acc 72 if (page == 2)
73 {
74 cout << "Do you want to enable debug mode? (Y/N): ";
75 }
76 else
77 {
78 cout << "Choose your IRCD" << endl;
e1c41a84 79 cout << "1. Unreal3.x" << endl
80 << "2. bahamut-1.4.x" << endl
81 << "3. ircu 2.10.x (P10)" << endl;
9f8c2acc 82 cout << "Make your selection: ";
83 }
84
f8656e40 85 cin >> selection;
86 return selection;
87}