Browse Source

Typedef for WCHAR on non-windows systems and warning-disable remove for windows

louyihua 9 years ago
parent
commit
f8ecb44987
6 changed files with 17 additions and 18 deletions
  1. 4 4
      codepage.h
  2. 4 6
      common.h
  3. 3 3
      fight.c
  4. 2 2
      palcommon.c
  5. 2 2
      palcommon.h
  6. 2 1
      yj1.c

+ 4 - 4
codepage.h

@@ -32,7 +32,7 @@ extern "C"
 {
 #endif
 
-static unsigned short cptbl_gbk[126][192] = {
+static WCHAR cptbl_gbk[126][192] = {
   {
     0x4E02,0x4E04,0x4E05,0x4E06,0x4E0F,0x4E12,0x4E17,0x4E1F,0x4E20,0x4E21,0x4E23,0x4E26,0x4E29,0x4E2E,0x4E2F,0x4E31,
     0x4E33,0x4E35,0x4E37,0x4E3C,0x4E40,0x4E41,0x4E42,0x4E44,0x4E46,0x4E4A,0x4E51,0x4E55,0x4E57,0x4E5A,0x4E5B,0x4E62,
@@ -1799,7 +1799,7 @@ static unsigned short cptbl_gbk[126][192] = {
   },
 };
 
-static unsigned short cptbl_big5[126][160] = {
+static WCHAR cptbl_big5[126][160] = {
   {
     0xEEB8,0xEEB9,0xEEBA,0xEEBB,0xEEBC,0xEEBD,0xEEBE,0xEEBF,0xEEC0,0xEEC1,0xEEC2,0xEEC3,0xEEC4,0xEEC5,0xEEC6,0xEEC7,
     0xEEC8,0xEEC9,0xEECA,0xEECB,0xEECC,0xEECD,0xEECE,0xEECF,0xEED0,0xEED1,0xEED2,0xEED3,0xEED4,0xEED5,0xEED6,0xEED7,
@@ -3314,7 +3314,7 @@ static unsigned short cptbl_big5[126][160] = {
   },
 };
 
-static unsigned short cptbl_jis[60][192] = {
+static WCHAR cptbl_jis[60][192] = {
   {
     0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B,0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E,
     0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD,0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0xFF3C,
@@ -4157,7 +4157,7 @@ static unsigned short cptbl_jis[60][192] = {
   },
 };
 
-static unsigned short cptbl_jis_half[64] = {
+static WCHAR cptbl_jis_half[64] = {
 	0xF8F0, 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0xFF66, 0xFF67,
 	0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F,
 	0xFF70, 0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF76, 0xFF77,

+ 4 - 6
common.h

@@ -166,11 +166,7 @@ FILE *MY_fopen(const char *path, const char *mode);
 #define vsnprintf _vsnprintf
 
 #ifdef _MSC_VER
-#pragma warning (disable:4018)
-#pragma warning (disable:4028)
 #pragma warning (disable:4244)
-#pragma warning (disable:4305)
-#pragma warning (disable:4761)
 #pragma warning (disable:4996)
 #endif
 
@@ -186,6 +182,7 @@ typedef const BYTE *LPCBYTE;
 #else
 
 #include <unistd.h>
+#include <wchar.h>
 
 #define CONST               const
 #ifndef FALSE
@@ -196,6 +193,7 @@ typedef const BYTE *LPCBYTE;
 #endif
 #define VOID                void
 typedef char                CHAR;
+typedef wchar_t             WCHAR;
 typedef short               SHORT;
 typedef long                LONG;
 
@@ -217,8 +215,8 @@ typedef void               *LPVOID;
 typedef const void         *LPCVOID;
 typedef CHAR               *LPSTR;
 typedef const CHAR         *LPCSTR;
-typedef USHORT             *LPWSTR;
-typedef const USHORT       *LPCWSTR;
+typedef WCHAR              *LPWSTR;
+typedef const WCHAR        *LPCWSTR;
 
 #endif
 

+ 3 - 3
fight.c

@@ -1423,7 +1423,7 @@ PAL_BattleStartFrame(
                g_Battle.ActionQueue[j].fIsEnemy = TRUE;
                g_Battle.ActionQueue[j].wIndex = i;
                g_Battle.ActionQueue[j].wDexterity = PAL_GetEnemyDexterity(i);
-               g_Battle.ActionQueue[j].wDexterity *= RandomFloat(0.9, 1.1);
+               g_Battle.ActionQueue[j].wDexterity *= RandomFloat(0.9f, 1.1f);
 
                j++;
 
@@ -1432,7 +1432,7 @@ PAL_BattleStartFrame(
                   g_Battle.ActionQueue[j].fIsEnemy = TRUE;
                   g_Battle.ActionQueue[j].wIndex = i;
                   g_Battle.ActionQueue[j].wDexterity = PAL_GetEnemyDexterity(i);
-                  g_Battle.ActionQueue[j].wDexterity *= RandomFloat(0.9, 1.1);
+                  g_Battle.ActionQueue[j].wDexterity *= RandomFloat(0.9f, 1.1f);
 
                   j++;
                }
@@ -1504,7 +1504,7 @@ PAL_BattleStartFrame(
                      wDexterity /= 2;
                   }
 
-                  wDexterity *= RandomFloat(0.9, 1.1);
+                  wDexterity *= RandomFloat(0.9f, 1.1f);
 
                   g_Battle.ActionQueue[j].wDexterity = wDexterity;
                }

+ 2 - 2
palcommon.c

@@ -489,7 +489,7 @@ PAL_FBPBlitToSurface(
    return 0;
 }
 
-UINT
+INT
 PAL_RLEGetWidth(
    LPCBITMAPRLE    lpBitmapRLE
 )
@@ -528,7 +528,7 @@ PAL_RLEGetWidth(
    return lpBitmapRLE[0] | (lpBitmapRLE[1] << 8);
 }
 
-UINT
+INT
 PAL_RLEGetHeight(
    LPCBITMAPRLE       lpBitmapRLE
 )

+ 2 - 2
palcommon.h

@@ -77,12 +77,12 @@ PAL_FBPBlitToSurface(
    SDL_Surface      *lpDstSurface
 );
 
-UINT
+INT
 PAL_RLEGetWidth(
    LPCBITMAPRLE      lpBitmapRLE
 );
 
-UINT
+INT
 PAL_RLEGetHeight(
    LPCBITMAPRLE      lpBitmapRLE
 );

+ 2 - 1
yj1.c

@@ -421,7 +421,8 @@ Decompress(
    INT           DestSize
 )
 {
-   unsigned int len = 0, ptr = 0, Length = 0;
+   int Length;
+   unsigned int len = 0, ptr = 0;
    unsigned char* src = (unsigned char*)Source + 4;
    unsigned char* dest;
    Tree tree;