Imported kball_final_src_16dec2004.tar.gz
[kball.git] / src / gerror.cpp
blob114fb198eed0048824619e6bdbcc98494534c54c
1 /*
2 -----------------------------------------------
3 Generic Allegro Project Template
4 By Kronoman - July 2003
5 In loving memory of my father
6 -----------------------------------------------
7 gerror.c
8 -----------------------------------------------
9 Error messages
10 -----------------------------------------------
13 #ifndef GERROR_C
14 #define GERROR_C
16 #include "gerror.h"
18 /* --------------------------------------------------------
19 raise_error()
20 Goes back to text mode, shows the message
21 and ends the program
22 -------------------------------------------------------- */
23 void raise_error(AL_CONST char *msg, ...)
25 char *buf;
26 /* exits the graphics mode */
27 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
29 /* creates the buffer */
30 buf = (char *)malloc(4096);
31 if (buf == NULL)
33 allegro_message("raise_error(): There is a error, and I'm out of virtual memory to show the error message. :^(\n"); }
34 else
36 /* parse the variable parameters */
37 va_list ap;
38 va_start(ap, msg);
39 uvszprintf(buf, 4096, msg, ap);
40 va_end(ap);
42 allegro_message("%s\n", buf);
43 free(buf);
45 exit(-1); /* abort the program */
48 #endif