00001
00002
00003
00004
00005
00006
00007
00008
00021
00022
00023 #include <stdio.h>
00024 #include <ctype.h>
00025 #include <string.h>
00026 #include <time.h>
00027 #include <stddef.h>
00028 #include <stdarg.h>
00029 #include <stdlib.h>
00030
00031
00032 #ifdef HAVE_ACDEFS_H
00033 #include "acdefs.h"
00034 #endif
00035
00036 #ifdef UNIX
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 #include <unistd.h>
00041 #include <sys/types.h>
00042 #include <sys/stat.h>
00043 #ifdef __cplusplus
00044 }
00045 #endif
00046 #endif
00047
00048
00049 #include "snprintf.h"
00050
00051
00052 #include "timestuff.h"
00053
00054
00055 namespace Xconq {
00056 typedef signed char Z8;
00057 typedef unsigned char Byte;
00058 typedef short Z16;
00059 typedef unsigned short Z16u;
00060 #ifdef HAVE_ACDEFS_H
00061 #if (SIZEOF_INT == 4)
00062 typedef int Z32;
00063 typedef unsigned int Z32u;
00064 #else
00065 typedef long Z32;
00066 typedef unsigned long Z32u;
00067 #endif // sizeof int == 4
00068 #if (SIZEOF_LONG == 8)
00069 typedef long Z64;
00070 typedef unsigned long Z64u;
00071 #else
00072 typedef long long Z64;
00073 typedef unsigned long long Z64u;
00074 #endif // sizeof long == 8
00075 #else
00076
00077 typedef int Z32;
00078 typedef unsigned int Z32u;
00079
00080 typedef long long Z64;
00081 typedef unsigned long long Z64u;
00082 #endif
00083 }
00084
00085
00086 #ifndef offsetof
00087 #define offsetof(TYPE,FLD) \
00088 ((unsigned int) (((char *) (&(((TYPE *) NULL)->FLD))) - ((char *) NULL)))
00089 #endif
00090
00091
00092 #ifndef INT_MAX
00093 #define INT_MAX 2147483647
00094 #endif
00095 #ifndef INT_MIN
00096 #define INT_MIN (-INT_MAX -1)
00097 #endif
00098
00099
00100 #if (defined (MAC) && !defined (AVOID_OBSTACK))
00101 #define AVOID_OBSTACK
00102 #endif
00103
00104
00105
00106 #ifndef NEWSFILE
00107
00108 #ifdef WIN32
00109 #define NEWSFILE "XconqNews.txt"
00110 #else
00111 #define NEWSFILE "XconqNews"
00112 #endif
00113 #endif
00114
00115 #ifndef SCOREFILE
00116
00117 #ifdef WIN32
00118 #define SCOREFILE "XconqScores.txt"
00119 #else
00120 #define SCOREFILE "XconqScores"
00121 #endif
00122 #endif
00123 #ifndef OLD_SCOREFILE
00124 #define OLD_SCOREFILE "scores.xcq"
00125 #endif
00126
00127 #ifndef STATSFILE
00128
00129 #ifdef WIN32
00130 #define STATSFILE "XconqStats.txt"
00131 #else
00132 #define STATSFILE "XconqStats"
00133 #endif
00134 #endif
00135
00136 #ifndef SAVEFILE
00137
00138 #define SAVEFILE "Save.xcq"
00139 #endif
00140
00141
00142 #ifndef CHECKPOINTFILE
00143
00144 #define CHECKPOINTFILE "check.xcq"
00145 #endif
00146
00147 #ifndef ERRORFILE
00148
00149 #define ERRORFILE "ErrorSave.xcq"
00150 #endif
00151
00152 #ifndef PREFERENCESFILE
00153
00154 #ifdef WIN32
00155 #define PREFERENCESFILE "XconqPrefs.txt"
00156 #else
00157 #define PREFERENCESFILE "XconqPrefs"
00158 #endif
00159 #endif
00160 #ifndef OLD_PREFERENCESFILE
00161 #define OLD_PREFERENCESFILE "prefs.xcq"
00162 #endif
00163
00164
00165
00166 #ifndef STANDARD_GAME
00167
00168 #define STANDARD_GAME "standard"
00169 #endif
00170
00171
00172
00173 #ifndef INTRO_GAME
00174
00175 #define INTRO_GAME "intro"
00176 #endif
00177
00178
00179 #ifndef DEFAULTWIDTH
00180
00188 #define DEFAULTWIDTH 60
00189 #endif
00190 #ifndef DEFAULTHEIGHT
00191
00195 #define DEFAULTHEIGHT 30
00196 #endif
00197
00198 #ifndef DEFAULTCIRCUMFERENCE
00199
00204 #define DEFAULTCIRCUMFERENCE 360
00205 #endif
00206
00207 #ifndef MAXSIDES
00208
00219 #define MAXSIDES 15
00220 #endif
00221
00223 #define MAXAITYPES 10
00224
00230 #define BUFSIZE 255
00231
00237 #define BLURBSIZE 480
00238
00244 #define PATH_SIZE 8192
00245
00251 #define TBUFSIZE 300
00252
00253
00254
00255
00261 #define RUDE
00262
00268 #define DESIGNERS
00269
00274 #define DEBUGGING
00275 #include <assert.h>
00276 #if (0)
00277 #define NDEBUG
00278 #endif