From 5cadee74c20d67613b267991f44cb30bf583bc28 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 21 Sep 2019 21:43:17 +0200 Subject: [PATCH] Fix a few compiler warnings --- 3rdParty/Storm/Source/storm.h | 2 +- SourceX/DiabloUI/credits.cpp | 2 +- SourceX/DiabloUI/diabloui.cpp | 12 +++++++----- SourceX/DiabloUI/diabloui.h | 2 +- SourceX/DiabloUI/progress.cpp | 2 +- SourceX/miniwin/ddraw.cpp | 4 ++-- SourceX/storm/storm.cpp | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index 301cf77c3..efd698364 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -62,7 +62,7 @@ typedef struct _WSIZE } WSIZE, *PWSIZE; #ifdef __cplusplus -static float infinity = std::numeric_limits::infinity(); +//static float infinity = std::numeric_limits::infinity(); struct CCritSect { CRITICAL_SECTION m_critsect; diff --git a/SourceX/DiabloUI/credits.cpp b/SourceX/DiabloUI/credits.cpp index 3046140fb..8e15f0006 100644 --- a/SourceX/DiabloUI/credits.cpp +++ b/SourceX/DiabloUI/credits.cpp @@ -505,7 +505,7 @@ void credts_Render() lastYbase = ybase; if (font != NULL) { - SDL_Color color = palette->colors[224], black_color = {0, 0, 0}; + SDL_Color color = palette->colors[224], black_color = {0, 0, 0, 0}; SDL_Surface *text_surface, *shadow_surface; for (int i = 0; i < lineCount; i++) { if (creditLine + i < 0) { diff --git a/SourceX/DiabloUI/diabloui.cpp b/SourceX/DiabloUI/diabloui.cpp index 53ca170e3..02899354d 100644 --- a/SourceX/DiabloUI/diabloui.cpp +++ b/SourceX/DiabloUI/diabloui.cpp @@ -471,8 +471,8 @@ BOOL UiValidPlayerName(char *name) if (strpbrk(name, ",<>%&\\\"?*#/:") || strpbrk(name, " ")) return false; - for (char *letter = name; *letter; letter++) - if (*letter < 0x20 || *letter > 0x7E && *letter < 0xC0) + for (BYTE *letter = (BYTE *)name; *letter; letter++) + if (*letter < 0x20 || (*letter > 0x7E && *letter < 0xC0)) return false; return true; @@ -553,14 +553,14 @@ BOOL UiCreatePlayerDescription(_uiheroinfo *info, DWORD mode, char *desc) return true; } -void DrawArt(int screenX, int screenY, Art *art, int nFrame, int drawW) +void DrawArt(int screenX, int screenY, Art *art, int nFrame, DWORD drawW) { BYTE *src = (BYTE *)art->data + (art->width * art->height * nFrame); BYTE *dst = &gpBuffer[screenX + 64 + (screenY + SCREEN_Y) * BUFFER_WIDTH]; drawW = drawW ? drawW : art->width; - for (int i = 0; i < art->height && i + screenY < SCREEN_HEIGHT; i++, src += art->width, dst += BUFFER_WIDTH) { - for (int j = 0; j < art->width && j + screenX < SCREEN_WIDTH; j++) { + for (DWORD i = 0; i < art->height && i + screenY < SCREEN_HEIGHT; i++, src += art->width, dst += BUFFER_WIDTH) { + for (DWORD j = 0; j < art->width && j + screenX < SCREEN_WIDTH; j++) { if (j < drawW && (!art->masked || src[j] != art->mask)) dst[j] = src[j]; } @@ -785,6 +785,8 @@ void UiRenderItems(UI_Item *items, int size) continue; if (SelectedItem == items[i].value) DrawSelector(&items[i]); + DrawArtStr(&items[i]); + break; case UI_BUTTON: case UI_TEXT: DrawArtStr(&items[i]); diff --git a/SourceX/DiabloUI/diabloui.h b/SourceX/DiabloUI/diabloui.h index 755bfeaab..182ab02f0 100644 --- a/SourceX/DiabloUI/diabloui.h +++ b/SourceX/DiabloUI/diabloui.h @@ -101,7 +101,7 @@ bool UiFocusNavigation(SDL_Event *event); bool UiItemMouseEvents(SDL_Event *event, UI_Item *items, int size); int GetAnimationFrame(int frames, int fps = 60); int GetCenterOffset(int w, int bw = 0); -void DrawArt(int screenX, int screenY, Art *art, int nFrame = 0, int drawW = 0); +void DrawArt(int screenX, int screenY, Art *art, int nFrame = 0, DWORD drawW = 0); void DrawLogo(int t = 0, int size = LOGO_MED); void DrawMouse(); void LoadArt(char *pszFile, Art *art, int frames = 1, PALETTEENTRY *pPalette = NULL); diff --git a/SourceX/DiabloUI/progress.cpp b/SourceX/DiabloUI/progress.cpp index 86953936a..579cd0fb6 100644 --- a/SourceX/DiabloUI/progress.cpp +++ b/SourceX/DiabloUI/progress.cpp @@ -22,7 +22,7 @@ void progress_Load(char *msg) LoadArt("ui_art\\but_sml.pcx", &ButImage, 15); if (font != NULL) { - SDL_Color color = { 243, 243, 243 }; + SDL_Color color = { 243, 243, 243, 0 }; msgSurface = TTF_RenderUTF8_Solid(font, msg, color); cancleSurface = TTF_RenderUTF8_Solid(font, "Cancel", color); diff --git a/SourceX/miniwin/ddraw.cpp b/SourceX/miniwin/ddraw.cpp index ef4c164d2..86d16479f 100644 --- a/SourceX/miniwin/ddraw.cpp +++ b/SourceX/miniwin/ddraw.cpp @@ -241,7 +241,7 @@ HRESULT StubPalette::GetCaps(LPDWORD lpdwCaps) HRESULT StubPalette::GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) { - for (int i = 0; i < dwNumEntries; i++) { + for (DWORD i = 0; i < dwNumEntries; i++) { lpEntries[i].peFlags = 0; lpEntries[i].peRed = system_palette[i].peRed; lpEntries[i].peGreen = system_palette[i].peGreen; @@ -252,7 +252,7 @@ HRESULT StubPalette::GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, HRESULT StubPalette::SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries) { - for (int i = 0; i < dwCount; i++) { + for (DWORD i = 0; i < dwCount; i++) { system_palette[i].peFlags = 0; system_palette[i].peRed = lpEntries[i].peRed; system_palette[i].peGreen = lpEntries[i].peGreen; diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index 78ba2a3ac..900f27b49 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -157,7 +157,7 @@ BOOL SFileOpenFile(const char *filename, HANDLE *phFile) if (directFileAccess) { char directPath[DVL_MAX_PATH] = "\0"; - for (int i = 0; i < strlen(filename); i++) { + for (size_t i = 0; i < strlen(filename); i++) { directPath[i] = AsciiToLowerTable_Path[filename[i]]; } result = SFileOpenFileEx((HANDLE)0, directPath, 0xFFFFFFFF, phFile);