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 |
… | |
… | |
23 | |
24 | |
24 | /* |
25 | /* |
25 | * General convenience functions for crossfire. |
26 | * General convenience functions for crossfire. |
26 | */ |
27 | */ |
27 | |
28 | |
|
|
29 | #include <cstdlib> |
|
|
30 | #include <sys/types.h> |
|
|
31 | #include <unistd.h> |
|
|
32 | #include <sys/time.h> |
|
|
33 | #include <time.h> |
|
|
34 | #include <signal.h> |
|
|
35 | |
28 | #include <global.h> |
36 | #include <global.h> |
29 | #include <funcpoint.h> |
37 | #include <funcpoint.h> |
30 | #include <material.h> |
38 | #include <material.h> |
31 | |
39 | |
32 | #include <sys/time.h> |
|
|
33 | #include <time.h> |
|
|
34 | #include <glib.h> |
40 | #include <glib.h> |
35 | |
41 | |
36 | /* |
42 | /* |
37 | * The random functions here take luck into account when rolling random |
43 | * The random functions here take luck into account when rolling random |
38 | * dice or numbers. This function has less of an impact the larger the |
44 | * dice or numbers. This function has less of an impact the larger the |
… | |
… | |
543 | return; |
549 | return; |
544 | } |
550 | } |
545 | |
551 | |
546 | ///////////////////////////////////////////////////////////////////////////// |
552 | ///////////////////////////////////////////////////////////////////////////// |
547 | |
553 | |
|
|
554 | void |
|
|
555 | fork_abort (const char *msg) |
|
|
556 | { |
|
|
557 | LOG (llevError, "fork abort: %s\n", msg); |
|
|
558 | if (!fork ()) |
|
|
559 | { |
|
|
560 | signal (SIGABRT, SIG_DFL); |
|
|
561 | abort (); |
|
|
562 | } |
|
|
563 | |
|
|
564 | } |
548 | void *salloc_ (int n) throw (std::bad_alloc) |
565 | void *salloc_ (int n) throw (std::bad_alloc) |
549 | { |
566 | { |
550 | void *ptr = g_slice_alloc (n); |
567 | void *ptr = g_slice_alloc (n); |
551 | |
568 | |
552 | if (!ptr) |
569 | if (!ptr) |