]> jfr.im git - irc/gameservirc.git/blob - gameserv/configscript.cpp
P10 is now functional. The game is playable, but it does not display text nicknames...
[irc/gameservirc.git] / gameserv / configscript.cpp
1 #include <fstream>
2 #include <iostream>
3
4 using std::cout;
5 using std::cerr;
6 using std::cin;
7 using std::endl;
8 using std::ofstream;
9
10 char menu(int page = 1);
11
12 int main()
13 {
14 ofstream outfile;
15
16 outfile.open("options.h");
17 if (outfile.fail())
18 {
19 cerr << "Error opening options.h" << endl;
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 outfile << "#undef P10" << endl;
32 break;
33 case '2':
34 outfile << "#undef UNREAL" << endl;
35 outfile << "#define BAHAMUT" << endl;
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;
42 break;
43 default:
44 break;
45 }
46 }while (c == 'Q' || c == 'q' || (int(c) < 48) || (int(c) > 57));
47
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');
64 outfile.close();
65 return 0;
66 }
67
68 char menu(int page)
69 {
70 char selection = 0;
71
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;
79 cout << "1. Unreal3.x" << endl
80 << "2. bahamut-1.4.x" << endl
81 << "3. ircu 2.10.x (P10)" << endl;
82 cout << "Make your selection: ";
83 }
84
85 cin >> selection;
86 return selection;
87 }