1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
3 | |
3 | |
|
|
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | |
7 | |
7 | This program is free software; you can redistribute it and/or modify |
8 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
9 | it under the terms of the GNU General Public License as published by |
… | |
… | |
753 | settings.real_wiz = FALSE; |
754 | settings.real_wiz = FALSE; |
754 | } |
755 | } |
755 | else |
756 | else |
756 | { |
757 | { |
757 | LOG (llevError, "load_settings: Unknown value for " "real_wiz: %s\n", cp); |
758 | LOG (llevError, "load_settings: Unknown value for " "real_wiz: %s\n", cp); |
758 | } |
|
|
759 | } |
|
|
760 | else if (!strcasecmp (buf, "explore_mode")) |
|
|
761 | { |
|
|
762 | if (!strcasecmp (cp, "on") || !strcasecmp (cp, "true")) |
|
|
763 | { |
|
|
764 | settings.explore_mode = TRUE; |
|
|
765 | } |
|
|
766 | else if (!strcasecmp (cp, "off") || !strcasecmp (cp, "false")) |
|
|
767 | { |
|
|
768 | settings.explore_mode = FALSE; |
|
|
769 | } |
|
|
770 | else |
|
|
771 | { |
|
|
772 | LOG (llevError, "load_settings: Unknown value for " "explore_mode: %s\n", cp); |
|
|
773 | } |
759 | } |
774 | } |
760 | } |
775 | else if (!strcasecmp (buf, "spellpoint_level_depend")) |
761 | else if (!strcasecmp (buf, "spellpoint_level_depend")) |
776 | { |
762 | { |
777 | if (!strcasecmp (cp, "on") || !strcasecmp (cp, "true")) |
763 | if (!strcasecmp (cp, "on") || !strcasecmp (cp, "true")) |
… | |
… | |
1231 | |
1217 | |
1232 | void |
1218 | void |
1233 | rec_sigsegv (int i) |
1219 | rec_sigsegv (int i) |
1234 | { |
1220 | { |
1235 | LOG (llevError, "SIGSEGV received.\n"); |
1221 | LOG (llevError, "SIGSEGV received.\n"); |
1236 | fatal_signal (1, 1); |
1222 | cleanup ("SIGSEGV received", 1); |
1237 | } |
1223 | } |
1238 | |
1224 | |
1239 | void |
1225 | void |
1240 | rec_sigint (int i) |
1226 | rec_sigint (int i) |
1241 | { |
1227 | { |
1242 | LOG (llevInfo, "SIGINT received.\n"); |
1228 | LOG (llevInfo, "SIGINT received.\n"); |
1243 | fatal_signal (0, 1); |
1229 | cleanup ("SIGINT received", 0); |
1244 | } |
1230 | } |
1245 | |
1231 | |
1246 | void |
1232 | void |
1247 | rec_sighup (int i) |
1233 | rec_sighup (int i) |
1248 | { |
1234 | { |
1249 | LOG (llevInfo, "SIGHUP received\n"); |
1235 | LOG (llevInfo, "SIGHUP received\n"); |
1250 | |
1236 | |
1251 | if (init_done) |
1237 | cleanup ("SIGHUP received", 0); |
1252 | cleanup (0); |
|
|
1253 | |
|
|
1254 | exit (0); |
|
|
1255 | } |
1238 | } |
1256 | |
1239 | |
1257 | void |
1240 | void |
1258 | rec_sigquit (int i) |
1241 | rec_sigquit (int i) |
1259 | { |
1242 | { |
1260 | LOG (llevInfo, "SIGQUIT received\n"); |
1243 | LOG (llevInfo, "SIGQUIT received\n"); |
1261 | fatal_signal (1, 1); |
1244 | cleanup ("SIGQUIT received", 1); |
1262 | } |
1245 | } |
1263 | |
1246 | |
1264 | void |
1247 | void |
1265 | rec_sigbus (int i) |
1248 | rec_sigbus (int i) |
1266 | { |
1249 | { |
1267 | #ifdef SIGBUS |
|
|
1268 | LOG (llevError, "SIGBUS received\n"); |
1250 | LOG (llevError, "SIGBUS received\n"); |
1269 | fatal_signal (1, 1); |
1251 | cleanup ("SIGBUS received", 1); |
1270 | #endif |
|
|
1271 | } |
1252 | } |
1272 | |
1253 | |
1273 | void |
1254 | void |
1274 | rec_sigterm (int i) |
1255 | rec_sigterm (int i) |
1275 | { |
1256 | { |
1276 | LOG (llevInfo, "SIGTERM received\n"); |
1257 | LOG (llevInfo, "SIGTERM received\n"); |
1277 | fatal_signal (0, 1); |
1258 | cleanup ("SIGTERM received", 0); |
1278 | } |
|
|
1279 | |
|
|
1280 | void |
|
|
1281 | fatal_signal (int make_core, int close_sockets) |
|
|
1282 | { |
|
|
1283 | cleanup (make_core); |
|
|
1284 | } |
1259 | } |
1285 | |
1260 | |
1286 | void |
1261 | void |
1287 | init_signals (void) |
1262 | init_signals (void) |
1288 | { |
1263 | { |
|
|
1264 | signal (SIGPIPE, SIG_IGN); |
1289 | signal (SIGHUP, rec_sighup); |
1265 | signal (SIGHUP, rec_sighup); |
1290 | signal (SIGINT, rec_sigint); |
1266 | signal (SIGINT, rec_sigint); |
1291 | signal (SIGQUIT, rec_sigquit); |
1267 | signal (SIGQUIT, rec_sigquit); |
1292 | signal (SIGSEGV, rec_sigsegv); |
1268 | signal (SIGSEGV, rec_sigsegv); |
1293 | signal (SIGPIPE, SIG_IGN); |
|
|
1294 | #ifdef SIGBUS |
|
|
1295 | signal (SIGBUS, rec_sigbus); |
1269 | signal (SIGBUS, rec_sigbus); |
1296 | #endif |
|
|
1297 | signal (SIGTERM, rec_sigterm); |
1270 | signal (SIGTERM, rec_sigterm); |
1298 | } |
1271 | } |
1299 | |
1272 | |
1300 | /* init_races() - reads the races file in the lib/ directory, then |
1273 | /* init_races() - reads the races file in the lib/ directory, then |
1301 | * overwrites old 'race' entries. This routine allow us to quickly |
1274 | * overwrites old 'race' entries. This routine allow us to quickly |
1302 | * re-configure the 'alignment' of monsters, objects. Useful for |
1275 | * re-configure the 'alignment' of monsters, objects. Useful for |
1303 | * putting together lists of creatures, etc that belong to gods. |
1276 | * putting together lists of creatures, etc that belong to gods. |
1304 | */ |
1277 | */ |
1305 | |
|
|
1306 | void |
1278 | void |
1307 | init_races (void) |
1279 | init_races (void) |
1308 | { |
1280 | { |
1309 | FILE *file; |
1281 | FILE *file; |
1310 | char race[MAX_BUF], fname[MAX_BUF], buf[MAX_BUF], *cp, variable[MAX_BUF]; |
1282 | char race[MAX_BUF], fname[MAX_BUF], buf[MAX_BUF], *cp, variable[MAX_BUF]; |