Apply the new ground_level method.
[crawl.git] / crawl-ref / source / msvc.h
blobfb64c50ec9012ea9647734e6d254c3d96c850879
1 /*
2 * File: msvc.h
3 * Summary: Header file for MSVC compiles
4 * Written by: Paul Du Bois
5 */
7 #ifndef __msvc_h
8 #define __msvc_h
10 #if defined(TARGET_COMPILER_VC)
12 #include <io.h>
13 #include <math.h>
15 #define fileno _fileno
16 #define itoa _itoa
17 #define snprintf _snprintf
18 #define strcasecmp _stricmp
19 #define strdup _strdup
20 #define stricmp _stricmp
21 #define strlwr _strlwr
22 #define strncasecmp _strnicmp
23 #define strnicmp _strnicmp
24 #define unlink _unlink
25 #define ftruncate _chsize
26 #define putenv _putenv
28 // No va_copy in MSVC
29 #if !defined(va_copy)
30 #define va_copy(dst, src) \
31 ((void) memcpy(&(dst), &(src), sizeof(va_list)))
32 #endif
34 #pragma warning(disable : 4290)
35 #pragma warning(disable : 4351)
36 // bool -> int
37 #pragma warning(disable : 4800)
39 // struct vs class XXX: fix these some day!
40 #pragma warning(disable : 4099)
42 // truncating conversions XXX: fix these too!
43 #pragma warning(disable : 4244)
46 // ----------------------------------------------------------------------
47 // dirent.h replacement
48 // ----------------------------------------------------------------------
50 #define DT_DIR 4
51 #define DT_REG 8
53 struct DIR;
54 struct dirent
56 // ino_t d_ino;
57 unsigned short d_reclen;
58 unsigned char d_type;
59 unsigned short d_namlen;
60 char d_name[255];
63 DIR* opendir(const char* path);
64 dirent* readdir(DIR*);
65 int closedir(DIR*);
67 inline double round(double x)
69 if (x >= 0.0)
70 return floor(x + 0.5);
71 else
72 return ceil(x - 0.5);
75 #endif /* defined(TARGET_COMPILER_VC) */
77 #endif