]>
Commit | Line | Data |
---|---|---|
fb37ecc7 | 1 | #include <fstream> |
85ce9d3e | 2 | #include <string.h> |
20d5d721 | 3 | #include <stdlib.h> |
85ce9d3e | 4 | #include <stdio.h> |
5 | #include "extern.h" | |
9bafc40d | 6 | #include "flags.h" |
85ce9d3e | 7 | |
fb37ecc7 | 8 | using std::ifstream; |
33ac4371 | 9 | using std::cerr; |
10 | using std::endl; | |
fb37ecc7 | 11 | |
624c0352 | 12 | int load_config_file(char *config); |
85ce9d3e | 13 | void unload_config_file(); |
85ce9d3e | 14 | |
15 | /* Random Configuration Stuff Goes Here until I code it to load from a .conf file :)*/ | |
16 | ||
17 | char *s_GameServ; // GameServ's nickname | |
18 | char *gshost; // GameServ's Hostname | |
19 | char *gsident; // GameServ's ident/username | |
20 | char *servername; // GameServ's Server | |
21 | char *c_Forest; // Forest channel | |
22 | char *c_ForestTopic; // Forest Channel Topic | |
45a84400 | 23 | char *adminpass; // Administrator password |
bf2cabcd | 24 | char *welcomemsg; // Welcome Message |
448a1531 | 25 | char *ignoreserverslist; // Servernames to ignore |
5431156e | 26 | char *nsname; // NickServ's name |
27 | char *nspass; // GameServ's NickServ Password | |
28 | ||
922daad7 | 29 | int welcomedelay; // Welcome Message Delay |
30 | int updateperiod; // Seconds until another player database update | |
20d5d721 | 31 | int forestfights; // Forest fights per day |
8450c018 | 32 | int maxafightdistance; // Max levels above a player they can fight player->player |
33 | int maxbfightdistance; // Max levels below a player they can fight player->player | |
40251952 | 34 | int maxidletime; // Max time (in seconds) a player can be idle for |
35 | int idlecheckperiod; // Period for checking every player's idle time | |
14e24ba1 | 36 | int level1expire; // Days for level 1 players to expire |
37 | int defaultexpire; // Days for other levels to expire | |
1ee4a31b | 38 | int maxitems; // Maximum amount of items a player can carry |
4bcfa863 | 39 | long refreshperiod; // Period for refreshing players |
1fe6fccd | 40 | long rolloverperiod; // Period for rolling over forest fights |
41 | long configflags; // Holds the binary representation of some boolean values | |
42 | long maxforestfights; // Maximum amount of forest fights to roll over | |
7fdd9c86 | 43 | long numrolloverfights; // Number of forest fights to roll over |
85ce9d3e | 44 | |
45 | // Remote server stuff. This is used for the outgoing connection gameserv needs to make | |
46 | // to a real ircd. | |
47 | char *remoteserver; // Server to connect to | |
285f72cf | 48 | char *localhost; // Hostname of the local address to bind to |
49 | int remoteport; // Port to connect to on remoteserver | |
85ce9d3e | 50 | char *remotepass; // Password for the server link |
51 | ||
3f107f27 | 52 | char *storeitemdata; // File to store the items available in the store |
c7bceafd | 53 | char *tavernitemdata; // File to store the items available in the tavern |
ec4605a9 | 54 | char *itemdata; // File to store the items in |
85ce9d3e | 55 | char *playerdata; // File to store player data in |
8e800549 | 56 | char *dragondata; // File to store current dragon data in |
57 | char *masterdata; // File to store the master data in | |
c260a8d7 | 58 | char *newsdata; // File to store news data in |
69ae096c | 59 | char *pidfile; // Process ID file |
85ce9d3e | 60 | |
e1c41a84 | 61 | #if defined(P10) |
62 | char *gsnum = "[]AAA"; // GameServ Numeric | |
63 | #endif | |
64 | ||
85ce9d3e | 65 | void unload_config_file() |
66 | { | |
3f107f27 | 67 | if (s_GameServ) |
68 | delete [] s_GameServ; | |
69 | if (gshost) | |
70 | delete [] gshost; | |
71 | if (gsident) | |
72 | delete [] gsident; | |
73 | if (servername) | |
74 | delete [] servername; | |
75 | if (c_Forest) | |
76 | delete [] c_Forest; | |
77 | if (c_ForestTopic) | |
78 | delete [] c_ForestTopic; | |
79 | if (remoteserver) | |
80 | delete [] remoteserver; | |
285f72cf | 81 | if (localhost) |
82 | delete [] localhost; | |
3f107f27 | 83 | if (remotepass) |
84 | delete [] remotepass; | |
85 | if (playerdata) | |
86 | delete [] playerdata; | |
87 | if (storeitemdata) | |
88 | delete [] storeitemdata; | |
89 | if (tavernitemdata) | |
90 | delete [] tavernitemdata; | |
91 | if (itemdata) | |
92 | delete [] itemdata; | |
93 | if (dragondata) | |
94 | delete [] dragondata; | |
95 | if (masterdata) | |
96 | delete [] masterdata; | |
97 | if (adminpass) | |
98 | delete [] adminpass; | |
99 | if (welcomemsg) | |
100 | delete [] welcomemsg; | |
101 | if (pidfile) | |
102 | delete [] pidfile; | |
103 | if (ignoreserverslist) | |
104 | delete [] ignoreserverslist; | |
105 | if (newsdata) | |
106 | delete [] newsdata; | |
107 | if (nsname) | |
108 | delete [] nsname; | |
109 | if (nspass) | |
110 | delete [] nspass; | |
9bafc40d | 111 | |
3f107f27 | 112 | configflags = 0; |
85ce9d3e | 113 | } |
bf2cabcd | 114 | |
624c0352 | 115 | int load_config_file(char *config) |
85ce9d3e | 116 | { |
117 | char *buf, *directive, *value; | |
69ae096c | 118 | |
7fdd9c86 | 119 | #define numdirectives 39 |
85ce9d3e | 120 | |
121 | unload_config_file(); | |
122 | ||
1e1b5312 | 123 | struct DIRECTIVE { |
124 | bool done; | |
125 | char *desc; | |
126 | }; | |
127 | ||
128 | DIRECTIVE directives[numdirectives]; | |
129 | ||
130 | directives[0].desc = "s_GameServ - GameServ Nickname"; | |
131 | directives[1].desc = "GSHOST - GameServ Hostname"; | |
132 | directives[2].desc = "GSIDENT - GameServ Ident"; | |
133 | directives[3].desc = "SERVERNAME - Pseudo Server's Name"; | |
134 | directives[4].desc = "C_FOREST - Forest Channel"; | |
135 | directives[5].desc = "C_FORESTTOPIC - Topic for the Forest Channel"; | |
136 | directives[6].desc = "REMOTESERVER - Server for gameserv to connect to (ip or hostname)"; | |
137 | directives[7].desc = "REMOTEPORT - Port on the remote server to connect to"; | |
138 | directives[8].desc = "REMOTEPASS - Password on the remote server"; | |
139 | directives[9].desc = "PLAYERDATA - File to store the player saves in"; | |
5c449fde | 140 | directives[10].desc = "SAVEDNOTICE - True/False as to wether or not to tell the forest "\ |
141 | "channel that the player database has been saved"; | |
1e1b5312 | 142 | directives[11].desc = "ADMINPASS - Password to identify as an admin with"; |
143 | directives[12].desc = "WELCOMEDELAY - Delay (in seconds) to wait before welcoming new users to the network"; | |
144 | directives[13].desc = "FORESTFIGHTS - Number of forest fights players get every day"; | |
145 | directives[14].desc = "UPDATEPERIOD - Number of seconds between every player data save"; | |
18b84d11 | 146 | directives[15].desc = "PIDFILE - Filename to store the gameserv process ID in"; |
147 | directives[16].desc = "MAXAFIGHTDISTANCE - The maximum number of levels above you "\ | |
8450c018 | 148 | "that you can fight player->player"; |
18b84d11 | 149 | directives[17].desc = "MAXBFIGHTDISTANCE - The maximum number of levels below you "\ |
8450c018 | 150 | "that you can fight player->player"; |
18b84d11 | 151 | directives[18].desc = "MAXIDLETIME - The maximum amount of time (in seconds) "\ |
40251952 | 152 | "that a player can be idle before something happens"; |
18b84d11 | 153 | directives[19].desc = "IDLECHECKPERIOD - The period (in seconds) in which the entire "\ |
40251952 | 154 | "players list will be checked for idlers. See also: "\ |
155 | "MAXIDLETIME"; | |
18b84d11 | 156 | directives[20].desc = "LISTENONC_FOREST - True/False as to "\ |
448a1531 | 157 | "whether or not to listen for forest "\ |
158 | "commands on the forest channel"; | |
c260a8d7 | 159 | directives[21].desc = "NEWSDATA - File to store daily news in"; |
4bcfa863 | 160 | directives[22].desc = "REFRESHPERIOD - Period (in seconds) to "\ |
161 | "refresh players"; | |
14e24ba1 | 162 | directives[23].desc = "LEVEL1EXPIRE - Amount of days until a "\ |
163 | "level 1 player's account is deleted due to "\ | |
164 | "inactivity."; | |
165 | directives[24].desc = "DEFAULTEXPIRE - Amount of days until a "\ | |
166 | "level 2 and above player's account is "\ | |
167 | "deleted due to inactivity"; | |
5431156e | 168 | directives[25].desc = "USENICKSERV - True/False as to wether or not "\ |
169 | "GameServ should identify with NickServ"; | |
170 | directives[26].desc = "NSNAME - Your network's NickServ nickname"; | |
171 | directives[27].desc = "NSPASS - GameServ's NickServ Password"; | |
8e800549 | 172 | directives[28].desc = "DRAGONDATA - File to store the current "\ |
173 | "dragon's stats in"; | |
174 | directives[29].desc = "MASTERDATA - File to store the level master stats in"; | |
ec4605a9 | 175 | directives[30].desc = "ITEMDATA - File to store the items in"; |
c7bceafd | 176 | directives[31].desc = "TAVERNITEMDATA - File in which to store the items that are available in the tavern"; |
1ee4a31b | 177 | directives[32].desc = "MAXITEMS - Maximum number of items a player can carry"; |
3f107f27 | 178 | directives[33].desc = "STOREITEMDATA - File in which to store the items that are available in the store"; |
285f72cf | 179 | directives[34].desc = "LOCALHOST - Local hostname or IP to bind to when connecting to the remote server"; |
1fe6fccd | 180 | directives[35].desc = "ROLLOVERFORESTFIGHTS - True/False as to wether or not to roll over forest fights "\ |
181 | "into the next day"; | |
182 | directives[36].desc = "MAXFORESTFIGHTS - Maximum amount of forest fights to roll over"; | |
183 | directives[37].desc = "ROLLOVERPERIOD - Period (in seconds) to rollover forest fights"; | |
7fdd9c86 | 184 | directives[38].desc = "NUMROLLOVERFIGHTS - Number of forest fights to roll over"; |
1e1b5312 | 185 | |
9bafc40d | 186 | configflags = 0; |
187 | ||
1e1b5312 | 188 | for (int count = 0; count < numdirectives; count++) |
189 | { | |
190 | directives[count].done = false; | |
191 | } | |
192 | ||
85ce9d3e | 193 | ifstream infile; |
194 | infile.open(config); | |
195 | if (infile.fail()) | |
196 | { | |
fb37ecc7 | 197 | log("Error opening %s", config); |
33ac4371 | 198 | cerr << "Error opening " << config << endl; |
624c0352 | 199 | return 0; |
85ce9d3e | 200 | } |
201 | ||
1e1b5312 | 202 | buf = new char[1024]; |
203 | ||
85ce9d3e | 204 | while (infile.getline(buf, 1024, '\n')) |
205 | { | |
9f8c2acc | 206 | #ifdef DEBUGMODE |
33ac4371 | 207 | log("Config file entry buf: %s", buf); |
9f8c2acc | 208 | #endif |
85ce9d3e | 209 | |
9cc5ab57 | 210 | if (buf[0] == '#' || buf[0] == ' ' || buf[0] == '\0' || buf[0] == '\n' || buf[0] == '\r') |
85ce9d3e | 211 | continue; |
212 | ||
213 | directive = strtok(buf, " "); | |
214 | ||
20d5d721 | 215 | if (stricmp(directive, "DIE") == 0) |
216 | { | |
217 | value = strtok(NULL, ""); | |
fb37ecc7 | 218 | log("You should read the entire %s file!", config); |
33ac4371 | 219 | cerr << "You should read the entire " << config << " file!" |
220 | << endl; | |
1e1b5312 | 221 | delete []buf; |
20d5d721 | 222 | exit(0); |
223 | } | |
85ce9d3e | 224 | if (stricmp(directive, "S_GAMESERV") == 0) |
225 | { | |
226 | value = strtok(NULL, " "); | |
227 | s_GameServ = new char[strlen(value) + 1]; | |
228 | strcpy(s_GameServ, value); | |
1e1b5312 | 229 | directives[0].done = true; |
85ce9d3e | 230 | } |
231 | else if (stricmp(directive, "GSHOST") == 0) | |
232 | { | |
233 | value = strtok(NULL, " "); | |
234 | gshost = new char[strlen(value) + 1]; | |
235 | strcpy(gshost, value); | |
1e1b5312 | 236 | directives[1].done = true; |
85ce9d3e | 237 | } |
238 | else if (stricmp(directive, "GSIDENT") == 0) | |
239 | { | |
240 | value = strtok(NULL, " "); | |
241 | gsident = new char[strlen(value) + 1]; | |
242 | strcpy(gsident, value); | |
1e1b5312 | 243 | directives[2].done = true; |
85ce9d3e | 244 | } |
245 | else if (stricmp(directive, "SERVERNAME") == 0) | |
246 | { | |
247 | value = strtok(NULL, " "); | |
248 | servername = new char[strlen(value) + 1]; | |
249 | strcpy(servername, value); | |
1e1b5312 | 250 | directives[3].done = true; |
85ce9d3e | 251 | } |
252 | else if (stricmp(directive, "C_FOREST") == 0) | |
253 | { | |
254 | value = strtok(NULL, " "); | |
255 | c_Forest = new char[strlen(value) + 1]; | |
256 | strcpy(c_Forest, value); | |
1e1b5312 | 257 | directives[4].done = true; |
85ce9d3e | 258 | } |
259 | else if (stricmp(directive, "C_FORESTTOPIC") == 0) | |
260 | { | |
261 | value = strtok(NULL, ""); | |
262 | c_ForestTopic = new char[strlen(value) + 1]; | |
263 | strcpy(c_ForestTopic, value); | |
1e1b5312 | 264 | directives[5].done = true; |
85ce9d3e | 265 | } |
266 | else if (stricmp(directive, "REMOTESERVER") == 0) | |
267 | { | |
268 | value = strtok(NULL, " "); | |
269 | remoteserver = new char[strlen(value) + 1]; | |
270 | strcpy(remoteserver, value); | |
1e1b5312 | 271 | directives[6].done = true; |
85ce9d3e | 272 | } |
273 | else if (stricmp(directive, "REMOTEPORT") == 0) | |
274 | { | |
275 | value = strtok(NULL, " "); | |
285f72cf | 276 | remoteport = stringtoint(value); |
1e1b5312 | 277 | directives[7].done = true; |
85ce9d3e | 278 | } |
279 | else if (stricmp(directive, "REMOTEPASS") == 0) | |
280 | { | |
281 | value = strtok(NULL, ""); | |
282 | remotepass = new char[strlen(value) + 1]; | |
283 | strcpy(remotepass, value); | |
1e1b5312 | 284 | directives[8].done = true; |
85ce9d3e | 285 | } |
286 | else if (stricmp(directive, "PLAYERDATA") == 0) | |
287 | { | |
288 | value = strtok(NULL, ""); | |
289 | playerdata = new char[strlen(value) + 1]; | |
290 | strcpy(playerdata, value); | |
1e1b5312 | 291 | directives[9].done = true; |
85ce9d3e | 292 | } |
5c449fde | 293 | else if (stricmp(directive, "SAVEDNOTICE") == 0) |
4dde2ed9 | 294 | { |
295 | value = strtok(NULL, ""); | |
5c449fde | 296 | if (stricmp(value, "TRUE") == 0) |
297 | setSavedNotice(); | |
1e1b5312 | 298 | directives[10].done = true; |
4dde2ed9 | 299 | } |
45a84400 | 300 | else if (stricmp(directive, "ADMINPASS") == 0) |
301 | { | |
302 | value = strtok(NULL, ""); | |
303 | adminpass = new char[strlen(value) + 1]; | |
304 | strcpy(adminpass, value); | |
1e1b5312 | 305 | directives[11].done = true; |
45a84400 | 306 | } |
922daad7 | 307 | else if (stricmp(directive, "WELCOMEDELAY") == 0) |
bf2cabcd | 308 | { |
309 | value = strtok(NULL, " "); | |
922daad7 | 310 | welcomedelay = stringtoint(value); |
1e1b5312 | 311 | directives[12].done = true; |
922daad7 | 312 | } |
20d5d721 | 313 | else if (stricmp(directive, "FORESTFIGHTS") == 0) |
314 | { | |
315 | value = strtok(NULL, " "); | |
316 | forestfights = stringtoint(value); | |
1e1b5312 | 317 | directives[13].done = true; |
20d5d721 | 318 | } |
922daad7 | 319 | else if (stricmp(directive, "UPDATEPERIOD") == 0) |
320 | { | |
321 | value = strtok(NULL, " "); | |
322 | updateperiod = stringtoint(value); | |
1e1b5312 | 323 | directives[14].done = true; |
bf2cabcd | 324 | } |
69ae096c | 325 | else if (stricmp(directive, "PIDFILE") == 0) |
326 | { | |
327 | value = strtok(NULL, " "); | |
328 | pidfile = new char[strlen(value) + 1]; | |
329 | strcpy(pidfile, value); | |
18b84d11 | 330 | directives[15].done = true; |
69ae096c | 331 | } |
8450c018 | 332 | else if (stricmp(directive, "MAXAFIGHTDISTANCE") == 0) |
333 | { | |
334 | value = strtok(NULL, " "); | |
335 | maxafightdistance = stringtoint(value); | |
18b84d11 | 336 | directives[16].done = true;; |
8450c018 | 337 | } |
338 | else if (stricmp(directive, "MAXBFIGHTDISTANCE") == 0) | |
339 | { | |
340 | value = strtok(NULL, " "); | |
341 | maxbfightdistance = stringtoint(value); | |
18b84d11 | 342 | directives[17].done = true; |
8450c018 | 343 | } |
40251952 | 344 | else if (stricmp(directive, "MAXIDLETIME") == 0) |
345 | { | |
346 | value = strtok(NULL, " "); | |
347 | maxidletime = stringtoint(value); | |
18b84d11 | 348 | directives[18].done = true; |
40251952 | 349 | } |
350 | else if (stricmp(directive, "IDLECHECKPERIOD") == 0) | |
351 | { | |
352 | value = strtok(NULL, " "); | |
353 | idlecheckperiod = stringtoint(value); | |
18b84d11 | 354 | directives[19].done = true; |
40251952 | 355 | } |
ff7d02f3 | 356 | else if (stricmp(directive, "LISTENONC_FOREST") == 0) |
357 | { | |
358 | value = strtok(NULL, " "); | |
359 | if (stricmp(value, "TRUE") == 0) | |
6f727d4c | 360 | setListenOnCF(); |
ff7d02f3 | 361 | |
18b84d11 | 362 | directives[20].done = true; |
363 | } | |
c260a8d7 | 364 | else if (stricmp(directive, "NEWSDATA") == 0) |
365 | { | |
366 | value = strtok(NULL, " "); | |
367 | newsdata = new char [strlen(value) + 1]; | |
368 | strcpy(newsdata, value); | |
369 | directives[21].done = true; | |
370 | } | |
4bcfa863 | 371 | else if (stricmp(directive, "REFRESHPERIOD") == 0) |
372 | { | |
373 | value = strtok(NULL, " "); | |
374 | refreshperiod = stringtoint(value); | |
375 | directives[22].done = true; | |
376 | } | |
14e24ba1 | 377 | else if (stricmp(directive, "LEVEL1EXPIRE") == 0) |
378 | { | |
379 | value = strtok(NULL, " "); | |
380 | level1expire = stringtoint(value); | |
381 | directives[23].done = true; | |
382 | } | |
383 | else if (stricmp(directive, "DEFAULTEXPIRE") == 0) | |
384 | { | |
385 | value = strtok(NULL, " "); | |
386 | defaultexpire = stringtoint(value); | |
387 | directives[24].done = true; | |
388 | } | |
5431156e | 389 | else if (stricmp(directive, "USENICKSERV") == 0) |
390 | { | |
391 | value = strtok(NULL, " "); | |
392 | if (stricmp(value, "TRUE") == 0) | |
393 | { | |
394 | setUseNickServ(); | |
395 | } | |
396 | ||
397 | directives[25].done = true; | |
398 | } | |
399 | else if (stricmp(directive, "NSNAME") == 0) | |
400 | { | |
401 | value = strtok(NULL, ""); | |
402 | nsname = new char[strlen(value) + 1]; | |
403 | strcpy(nsname, value); | |
404 | directives[26].done = true; | |
405 | } | |
406 | else if (stricmp(directive, "NSPASS") == 0) | |
407 | { | |
408 | value = strtok(NULL, ""); | |
409 | nspass = new char[strlen(value) + 1]; | |
410 | strcpy(nspass, value); | |
411 | directives[27].done = true; | |
412 | } | |
8e800549 | 413 | else if (stricmp(directive, "DRAGONDATA") == 0) |
414 | { | |
415 | value = strtok(NULL, ""); | |
416 | dragondata = new char[strlen(value) + 1]; | |
417 | strcpy(dragondata, value); | |
418 | directives[28].done = true; | |
419 | } | |
420 | else if (stricmp(directive, "MASTERDATA") == 0) | |
421 | { | |
422 | value = strtok(NULL, ""); | |
423 | masterdata = new char[strlen(value) + 1]; | |
424 | strcpy(masterdata, value); | |
425 | directives[29].done = true; | |
426 | } | |
ec4605a9 | 427 | else if (stricmp(directive, "ITEMDATA") == 0) |
428 | { | |
429 | value = strtok(NULL, ""); | |
430 | itemdata = new char[strlen(value) + 1]; | |
431 | strcpy(itemdata, value); | |
432 | directives[30].done = true; | |
433 | } | |
c7bceafd | 434 | else if (stricmp(directive, "TAVERNITEMDATA") == 0) |
435 | { | |
436 | value = strtok(NULL, ""); | |
d1927afc | 437 | tavernitemdata = new char[strlen(value) + 1]; |
438 | strcpy(tavernitemdata, value); | |
c7bceafd | 439 | directives[31].done = true; |
440 | } | |
1ee4a31b | 441 | else if (stricmp(directive, "MAXITEMS") == 0) |
442 | { | |
443 | value = strtok(NULL, ""); | |
444 | maxitems = stringtoint(value); | |
445 | directives[32].done = true; | |
446 | } | |
3f107f27 | 447 | else if (stricmp(directive, "STOREITEMDATA") == 0) |
448 | { | |
449 | value = strtok(NULL, ""); | |
450 | storeitemdata = new char[strlen(value) + 1]; | |
451 | strcpy(storeitemdata, value); | |
452 | directives[33].done = true; | |
453 | } | |
285f72cf | 454 | else if (stricmp(directive, "LOCALHOST") == 0) |
455 | { | |
456 | value = strtok(NULL, ""); | |
457 | localhost = new char[strlen(value) + 1]; | |
458 | strcpy(localhost, value); | |
459 | directives[34].done = true; | |
460 | } | |
1fe6fccd | 461 | else if (stricmp(directive, "ROLLOVERFORESTFIGHTS") == 0) |
462 | { | |
463 | value = strtok(NULL, " "); | |
464 | if (stricmp(value, "TRUE") == 0) | |
465 | { | |
466 | setRolloverForestFights(); | |
467 | } | |
7fdd9c86 | 468 | else |
469 | { | |
470 | directives[36].done = true; | |
471 | directives[37].done = true; | |
472 | directives[38].done = true; | |
473 | } | |
1fe6fccd | 474 | directives[35].done = true; |
475 | } | |
476 | else if (stricmp(directive, "MAXFORESTFIGHTS") == 0) | |
477 | { | |
478 | value = strtok(NULL, ""); | |
479 | maxforestfights = stringtoint(value); | |
480 | directives[36].done = true; | |
481 | } | |
482 | else if (stricmp(directive, "ROLLOVERPERIOD") == 0) | |
483 | { | |
484 | value = strtok(NULL, ""); | |
485 | rolloverperiod = stringtoint(value); | |
486 | directives[37].done = true; | |
487 | } | |
7fdd9c86 | 488 | else if (stricmp(directive, "NUMROLLOVERFIGHTS") == 0) |
489 | { | |
490 | value = strtok(NULL, ""); | |
491 | numrolloverfights = stringtoint(value); | |
492 | directives[38].done = true; | |
493 | } | |
18b84d11 | 494 | else if (stricmp(directive, "WELCOMEMSG") == 0) |
495 | { | |
496 | // This directive is optional | |
497 | value = strtok(NULL, ""); | |
498 | welcomemsg = new char[strlen(value) + 1]; | |
499 | strcpy(welcomemsg, value); | |
500 | setWelcome(); | |
ff7d02f3 | 501 | } |
9bafc40d | 502 | else if (stricmp(directive, "USEPRIVMSG") == 0) |
503 | { | |
504 | // This directive is optional | |
6f727d4c | 505 | setUsePrivmsg(); |
506 | } | |
507 | else if (stricmp(directive, "BOPER") == 0) | |
508 | { | |
509 | // This directive is optional | |
510 | setBOper(); | |
9bafc40d | 511 | } |
448a1531 | 512 | else if (stricmp(directive, "IGNORESERVERS") == 0) |
513 | { | |
514 | // This directive is optional | |
515 | value = strtok(NULL, ""); | |
516 | ignoreserverslist = new char[strlen(value) + 1]; | |
517 | strcpy(ignoreserverslist, value); | |
518 | } | |
85ce9d3e | 519 | else |
520 | { | |
9f8c2acc | 521 | #ifdef DEBUGMODE |
522 | log("Unknown Directive. Buffer: %s", buf); | |
33ac4371 | 523 | cerr << "Unknown " << config << " directive. Buffer: " |
524 | << buf << endl; | |
9f8c2acc | 525 | #endif |
85ce9d3e | 526 | continue; |
527 | } | |
85ce9d3e | 528 | } |
1cf88153 | 529 | delete [] buf; |
85ce9d3e | 530 | infile.close(); |
1e1b5312 | 531 | |
532 | int nonemissing = 1; | |
533 | for (int count2 = 0; count2 < numdirectives; count2++) | |
534 | { | |
535 | if (!directives[count2].done) | |
536 | { | |
537 | cerr << "Missing config directive: " << directives[count2].desc << endl; | |
538 | nonemissing = 0; | |
539 | } | |
540 | } | |
541 | ||
542 | return nonemissing; | |
85ce9d3e | 543 | } |