… | |
… | |
24 | |
24 | |
25 | /* |
25 | /* |
26 | * General convenience functions for crossfire. |
26 | * General convenience functions for crossfire. |
27 | */ |
27 | */ |
28 | |
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 | |
29 | #include <global.h> |
36 | #include <global.h> |
30 | #include <funcpoint.h> |
37 | #include <funcpoint.h> |
31 | #include <material.h> |
38 | #include <material.h> |
32 | |
39 | |
33 | #include <sys/time.h> |
|
|
34 | #include <time.h> |
|
|
35 | #include <glib.h> |
40 | #include <glib.h> |
36 | |
41 | |
37 | /* |
42 | /* |
38 | * The random functions here take luck into account when rolling random |
43 | * The random functions here take luck into account when rolling random |
39 | * 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 |
… | |
… | |
544 | return; |
549 | return; |
545 | } |
550 | } |
546 | |
551 | |
547 | ///////////////////////////////////////////////////////////////////////////// |
552 | ///////////////////////////////////////////////////////////////////////////// |
548 | |
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 | } |
549 | void *salloc_ (int n) throw (std::bad_alloc) |
565 | void *salloc_ (int n) throw (std::bad_alloc) |
550 | { |
566 | { |
551 | void *ptr = g_slice_alloc (n); |
567 | void *ptr = g_slice_alloc (n); |
552 | |
568 | |
553 | if (!ptr) |
569 | if (!ptr) |