00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __STRATAGUS_H__
00029 #define __STRATAGUS_H__
00030
00032
00033 #ifdef HAVE_CONFIG_H
00034 #include <config.h>
00035 #endif
00036
00037 #include <stdlib.h>
00038
00039
00040
00041
00042
00043 #ifdef _MSC_VER
00044
00045 #define WIN32_LEAN_AND_MEAN
00046 #define NOUSER
00047
00048 #define inline __inline
00049 #define alloca _alloca
00050
00051 #pragma warning(disable:4244)
00052 #pragma warning(disable:4761)
00053 #pragma warning(disable:4786)
00054 #define abort() _ASSERT(0)
00055 #include <stdio.h>
00056 #define snprintf _snprintf
00057 #define vsnprintf _vsnprintf
00058 #define unlink _unlink
00059 #include <string.h>
00060 #define strdup _strdup
00061 #define strcasecmp _stricmp
00062 #define strncasecmp _strnicmp
00063 #include <io.h>
00064 #define access _access
00065 #define write _write
00066 #include <direct.h>
00067 #define makedir(dir, permissions) _mkdir(dir)
00068
00069 #endif // } _MSC_VER
00070
00071 #ifdef __GNUC__
00072 #ifdef USE_WIN32
00073 #define makedir(dir, permissions) mkdir(dir)
00074 #else
00075 #define makedir(dir, permissions) mkdir(dir, permissions)
00076 #endif
00077 #endif
00078
00079
00080
00081
00082
00088 #define _C_ ,
00089
00091 #define PrintFunction() \
00092 do { fprintf(stdout, "%s:%d: ", __FILE__, __LINE__); } while (0)
00093
00094
00095 #ifdef DEBUG // {
00096
00100 #define Assert(cond) do { if (!(cond)) { \
00101 fprintf(stderr, "Assertion failed at %s:%d: %s\n", __FILE__, __LINE__, #cond); \
00102 abort(); }} while (0)
00103
00107 #define DebugPrint(args) \
00108 do { PrintFunction(); fprintf(stdout, args); } while (0)
00109
00110 #else // }{ DEBUG
00111
00112 #define Assert(cond)
00113 #define DebugPrint(args)
00114
00115 #endif
00116
00117
00118
00119
00120
00121 #include <string>
00122 #include "util.h"
00123 #include "translate.h"
00124
00125
00126
00127
00128
00129 #define _(str) Translate(str)
00130 #define N_(str) str
00131
00132
00133
00134
00135 #ifndef STRATAGUS_LIB_PATH
00136 #define STRATAGUS_LIB_PATH "."
00137 #endif
00138
00139 #ifndef STRATAGUS_HOME_PATH
00140 #ifdef __APPLE__
00141 #define STRATAGUS_HOME_PATH "Library/boswars/"
00142 #elif USE_WIN32
00143 #define STRATAGUS_HOME_PATH "boswars/"
00144 #else
00145 #define STRATAGUS_HOME_PATH ".boswars/"
00146 #endif
00147 #endif
00148
00149
00150
00151
00152
00153 #define PlayerMax 9
00154 #define UnitTypeMax 257
00155 #define UnitMax 2048
00156
00157
00158
00159
00160
00162 #define FRAMES_PER_SECOND 30 // 1/30s
00164 #define CYCLES_PER_SECOND 30 // 1/30s 33ms
00165
00166
00167
00168
00169
00170 extern std::string UserDirectory;
00171 extern std::string StratagusLibPath;
00172
00173 extern std::string ClickMissile;
00174 extern std::string DamageMissile;
00175
00176 extern int SpeedBuild;
00177 extern int SpeedTrain;
00178
00179 extern unsigned long GameCycle;
00180 extern unsigned long FastForwardCycle;
00181
00182 extern std::string CompileOptions;
00183 extern bool SaveGameLoading;
00184
00185 extern void LoadGame(const std::string &filename);
00186 extern void SaveGame(const std::string &filename);
00187
00188 extern void Exit(int err);
00189 extern void ExitFatal(int err);
00190
00191 extern void UpdateDisplay(void);
00192 extern void InitModules(void);
00193 extern void LoadModules(void);
00194 extern void CleanModules(void);
00195 extern void DrawMapArea(void);
00196 extern void GameMainLoop(void);
00197
00199 extern void ShowLoadProgress(const char *fmt, ...);
00200
00202
00203 #endif // !__STRATAGUS_H__