msvc_kludges.h

Go to the documentation of this file.
00001 //
00002 // MSVC Kludges... and precompiled header for Exult
00003 //
00004 // DO NOT INCLUDE
00005 //
00006 // This files allows Exult, and it's tools, to compile under the very non
00007 // standards compilent MSVC. It also serves as a precompiled header to greatly
00008 // improve compile times in MSVC.
00009 //
00010 
00011 #ifndef MSVC_KLUDGES_H
00012 #define MSVC_KLUDGES_H
00013 
00014 #define HAVE_SSTREAM 1
00015 
00016 // Firstly some things that need to be defined
00017 #define VERSION "1.2"
00018 #define EXULT_DATADIR "data/"
00019 #define SIZEOF_SHORT 2
00020 #define SIZEOF_INT 4
00021 #define SIZEOF_LONG 4
00022 #define DONT_HAVE_HASH_SET
00023 #define DONT_HAVE_HASH_MAP
00024 //#define HAVE_OPENGL
00025 //#define FUDGE_SAMPLE_RATES
00026 #define USE_FMOPL_MIDI
00027 
00028 #ifndef WIN32
00029 #error WTF!
00030 #endif
00031 
00032 // No GDI
00033 #define NOGDI
00034 
00035 // Settings for debug builds
00036 #ifndef NDEBUG
00037 
00038 #define USE_EXULTSTUDIO
00039 #define ENABLE_MIDISFX
00040 #define COLOURLESS_REALLY_HATES_THE_BG_SFX
00041 #define FORCE_44KHZ
00042 
00043 #ifndef DEBUG
00044 //#define DEBUG 1
00045 #endif
00046 
00047 #endif
00048 
00049 // Yeah, lets do unicode compiles
00050 //#define UNICODE
00051 
00052 // Don't need everything in the windows headers
00053 #define WIN32_LEAN_AND_MEAN
00054 
00055 // Disable some warnings
00056 #pragma warning (disable: 4786) // Debug Len > 255
00057 #pragma warning (disable: 4355) // 'this' : used in base member initializer list
00058 
00059 #ifndef ENABLE_EXTRA_WARNINGS
00060 //#pragma warning (disable: 4101) // unreferenced local variable
00061 //#pragma warning (disable: 4309) // truncation of constant value
00062 #pragma warning (disable: 4305) // truncation from 'const int' to 'char'
00063 #pragma warning (disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
00064 #endif
00065 
00066 //
00067 // Hacks for MSVC 6
00068 //
00069 #if (_MSC_VER == 1200)
00070 
00071 // Define size_t, but don't define tm, we'll define that later
00072 #define _TM_DEFINED
00073 #include <wctype.h>
00074 #undef _TM_DEFINED
00075 
00076 #define _SIZE_T_DEFINED
00077 
00078 // we can't put cstdio into std because MSVC MUST have it in the global namespace
00079 #include <cstdio>
00080 
00081 // Now put the headers that should be in std into the std namespace
00082 namespace std {
00083 
00084 extern "C" {
00085 
00086   #include <wchar.h>
00087   #include <sys/types.h>
00088   //#include <sys/stat.h>
00089   #include <errno.h>
00090   #include <ctype.h>
00091   #include <signal.h>
00092   #include <cstdlib>
00093   #include <cstring>
00094   #include <ctime>
00095   #include <cmath>
00096   #include <cstdarg>
00097   #include <malloc.h>
00098 
00099 };
00100   // Kludge to make Exult think that size_t has been put into the
00101   // std namespace
00102   typedef ::size_t size_t2;
00103   #define size_t size_t2
00104 
00105   // These are declared/defined in <cstdio> and the need to be in 
00106   // the std namespace
00107   using ::FILE;
00108   using ::fread;
00109   using ::va_list;
00110   using ::fopen;
00111   using ::fclose;
00112   using ::fwrite;
00113   using ::remove;
00114   using ::printf;
00115 }
00116 
00117 // These get put in std when they otherwise should be, or are required by other headers
00118 using std::memcmp;
00119 using std::memset;
00120 using std::mbstate_t;
00121 using std::size_t;
00122 using std::time_t;
00123 using std::_fsize_t;
00124 using std::tm;
00125 using std::_dev_t;
00126 using std::_ino_t;
00127 using std::_off_t;
00128 using std::isspace;
00129 using std::_alloca;
00130 using std::wcslen;
00131 using std::strtol;
00132 
00133 // Nope, stat isn't defined
00134 #ifdef _STAT_DEFINED
00135 #undef _STAT_DEFINED
00136 #endif
00137 #include <sys/stat.h>
00138 
00139 //
00140 // Hacks for MSVC 7
00141 //
00142 #elif (_MSC_VER == 1300)
00143 
00144 #include <cctype>
00145 #define HAVE_SYS_STAT_H
00146 #define inline __forceinline
00147 
00148 #else
00149 
00150 #error Unknown Version of MSVC being used. Edit "msvc_include.h" and add your version
00151 
00152 #endif
00153 
00154 // We've got snprintf
00155 #define HAVE_SNPRINTF
00156 #define snprintf _snprintf
00157 
00158 // When doing a DEBUG compile we will output to the console
00159 // However, SDL doesn't want us to do that
00160 #ifdef DEBUG
00161 //#define SDL_main main
00162 #endif
00163 
00164 // Some often used headers that could be included in out precompiled header
00165 #include <fstream>
00166 #include <sstream>
00167 #include <exception>
00168 #include <vector>
00169 #include <iostream>
00170 #include <iomanip>
00171 #include <set>
00172 #include <map>
00173 #include <assert.h>
00174 #include <fcntl.h>
00175 #include <direct.h>
00176 #include <windows.h>
00177 #include <mmsystem.h>
00178 #include <windef.h>
00179 
00180 using std::getline;
00181 
00182 // Why oh why!
00183 // MSVC thinks near and far are actually supposed to be used with pointers
00184 // but because they are no longer used, it consequently causes an error
00185 #undef near
00186 #define near ex_near
00187 #undef far
00188 #define far ex_far
00189 #undef FAR
00190 #define FAR
00191 #undef NEAR
00192 #define NEAR
00193 
00194 // We need this defined
00195 #define __STRING(x) #x
00196 
00197 #ifdef DEBUG
00198 #define STRICTUNZIP
00199 #define STRICTZIP
00200 #endif
00201 
00202 // Only include these headers if we are actually compiling Exult
00203 #ifdef EXULT
00204 
00205 #ifndef HAVE_ZIP_SUPPORT
00206 #define HAVE_ZIP_SUPPORT
00207 #endif
00208 
00209 #ifdef USING_PRECOMPILED_HEADER
00210 #include <SDL.h>
00211 
00212 #include "../actions.h"
00213 #include "../actors.h"
00214 #include "../args.h"
00215 #include "../bggame.h"
00216 #include "../browser.h"
00217 #include "../cheat.h"
00218 #include "../cheat_screen.h"
00219 #include "../combat.h"
00220 #include "../delobjs.h"
00221 #include "../dir.h"
00222 #include "../effects.h"
00223 #include "../headers/exceptions.h"
00224 #include "../headers/common_types.h"
00225 #include "../exult.h"
00226 #include "../exult_constants.h"
00227 #include "../exult_types.h"
00228 #include "../exultmenu.h"
00229 #include "../fnames.h"
00230 #include "../frameseq.h"
00231 #include "../game.h"
00232 #include "../gameclk.h"
00233 #include "../gamewin.h"
00234 #include "../headers/gamma.h"
00235 #include "../hash_utils.h"
00236 #include "../keyactions.h"
00237 #include "../keys.h"
00238 #include "../lists.h"
00239 #include "../menulist.h"
00240 #include "../mouse.h"
00241 #include "../npcnear.h"
00242 #include "../npctime.h"
00243 #include "../palette.h"
00244 #include "../paths.h"
00245 #include "../ready.h"
00246 #include "../rect.h"
00247 #include "../schedule.h"
00248 #include "../segfile.h"
00249 #include "../shapeid.h"
00250 #include "../sigame.h"
00251 #include "../tiles.h"
00252 #include "../tqueue.h"
00253 #include "../txtscroll.h"
00254 #include "../vec.h"
00255 #include "../flic/playfli.h"
00256 #include "../pathfinder/Astar.h"
00257 #include "../pathfinder/PathFinder.h"
00258 #include "../pathfinder/Zombie.h"
00259 #include "../objs/animate.h"
00260 #include "../objs/barge.h"
00261 #include "../objs/chunks.h"
00262 #include "../objs/chunkter.h"
00263 #include "../objs/citerate.h"
00264 #include "../objs/contain.h"
00265 #include "../objs/egg.h"
00266 #include "../objs/flags.h"
00267 #include "../objs/iregobjs.h"
00268 #include "../objs/jawbone.h"
00269 #include "../objs/objiter.h"
00270 #include "../objs/objlist.h"
00271 #include "../objs/objs.h"
00272 #include "../objs/ordinfo.h"
00273 #include "../objs/spellbook.h"
00274 #include "../objs/virstone.h"
00275 #include "../conf/Configuration.h"
00276 #include "../conf/XMLEntity.h"
00277 #include "../usecode/conversation.h"
00278 #include "../usecode/keyring.h"
00279 #include "../usecode/ucinternal.h"
00280 #include "../usecode/ucmachine.h"
00281 #include "../usecode/ucsched.h"
00282 #include "../usecode/ucscriptop.h"
00283 #include "../usecode/useval.h"
00284 #include "../audio/Audio.h"
00285 #include "../audio/conv.h"
00286 #include "../audio/Midi.h"
00287 #include "../audio/soundtest.h"
00288 #include "../audio/xmidi.h"
00289 #include "../gumps/Actor_gump.h"
00290 #include "../gumps/AudioOptions_gump.h"
00291 #include "../gumps/Book_gump.h"
00292 #include "../gumps/CombatStats_gump.h"
00293 #include "../gumps/Face_button.h"
00294 #include "../gumps/Face_stats.h"
00295 #include "../gumps/File_gump.h"
00296 #include "../gumps/Gamemenu_gump.h"
00297 #include "../gumps/Gump.h"
00298 #include "../gumps/Gump_button.h"
00299 #include "../gumps/Gump_manager.h"
00300 #include "../gumps/Gump_ToggleButton.h"
00301 #include "../gumps/gump_types.h"
00302 #include "../gumps/gump_utils.h"
00303 #include "../gumps/Gump_widget.h"
00304 #include "../gumps/Jawbone_gump.h"
00305 #include "../gumps/misc_buttons.h"
00306 #include "../gumps/Modal_gump.h"
00307 #include "../gumps/Newfile_gump.h"
00308 #include "../gumps/Paperdoll_gump.h"
00309 #include "../gumps/Scroll_gump.h"
00310 #include "../gumps/Sign_gump.h"
00311 #include "../gumps/Slider_gump.h"
00312 #include "../gumps/Spellbook_gump.h"
00313 #include "../gumps/Stats_gump.h"
00314 #include "../gumps/Text_button.h"
00315 #include "../gumps/Text_gump.h"
00316 #include "../gumps/VideoOptions_gump.h"
00317 #include "../gumps/Yesno_gump.h"
00318 #include "../imagewin/ibuf8.h"
00319 #include "../imagewin/imagebuf.h"
00320 #include "../imagewin/imagewin.h"
00321 #include "../imagewin/iwin8.h"
00322 #include "../shapes/bodies.h"
00323 #include "../shapes/font.h"
00324 #include "../shapes/fontvga.h"
00325 #include "../shapes/items.h"
00326 #include "../shapes/monstinf.h"
00327 #include "../shapes/shapeinf.h"
00328 #include "../shapes/shapevga.h"
00329 #include "../shapes/u7drag.h"
00330 #include "../shapes/vgafile.h"
00331 
00332 #endif //USING_PRECOMPILED_HEADER
00333 
00334 //#include "../files/zip/zip_u7file.h"
00335 #endif
00336 
00337 // We will probably always want these
00338 #ifdef USING_PRECOMPILED_HEADER
00339 #include "../files/databuf.h"
00340 #include "../files/Flat.h"
00341 #include "../files/Flex.h"
00342 #include "../files/IFF.h"
00343 #include "../files/listfiles.h"
00344 #include "../files/Table.h"
00345 #include "../files/U7file.h"
00346 #include "../files/utils.h"
00347 #include "../files/crc.h"
00348 #endif //USING_PRECOMPILED_HEADER
00349 // Don't want SDL Parachute
00350 #define NO_SDL_PARACHUTE
00351 
00352 #define CHUNK_OBJ_DUMP
00353 
00354 #endif /* !MSVC_KLUDGES_H */
00355 
00356 

Generated on Mon Jul 9 14:42:48 2007 for ExultEngine by  doxygen 1.5.1