From 631305035af4007716a6e6fa62bd2b87a606fd2c Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 24 Apr 2019 20:33:00 +0200 Subject: [PATCH] Brute fix compile errors --- DiabloUI/diabloui.h | 2 +- DiabloUI/progress.cpp | 2 +- Source/list.h | 15 ++++++++------- Source/msg.cpp | 2 +- SourceS/miniwin.h | 2 +- SourceS/miniwin/misc.h | 3 ++- SourceS/miniwin/misc_macro.h | 3 +++ SourceX/DiabloUI/diabloui.cpp | 3 --- SourceX/DiabloUI/diabloui.h | 3 --- SourceX/dx.cpp | 10 +++++++--- SourceX/miniwin/misc.cpp | 5 +++++ 11 files changed, 29 insertions(+), 21 deletions(-) diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h index 92ef8c56f..cf90ab574 100644 --- a/DiabloUI/diabloui.h +++ b/DiabloUI/diabloui.h @@ -35,7 +35,7 @@ BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty); BOOL __stdcall UiCreditsDialog(int a1); BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4); -int __stdcall UiProgressDialog(HWND window, char *msg, int a3, void *fnfunc, int a5); +int UiProgressDialog(HWND window, char *msg, int a3, void *fnfunc, int a5); int __stdcall UiProfileGetString(); void __cdecl UiProfileCallback(); void __cdecl UiProfileDraw(); diff --git a/DiabloUI/progress.cpp b/DiabloUI/progress.cpp index 17cf93e77..7058e1d90 100644 --- a/DiabloUI/progress.cpp +++ b/DiabloUI/progress.cpp @@ -10,7 +10,7 @@ signed int Progress_10009480() { return 0; } // 1002A2EC: using guessed type int dword_1002A2EC; // ref: 0x1000948B -int __stdcall UiProgressDialog(HWND window, char *msg, int enable, int(__cdecl *fnfunc)(), int rate) { return 0; } +int UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc)(), int rate) { return 0; } /* { HWND v5; // eax BOOL result; // eax diff --git a/Source/list.h b/Source/list.h index 49706c9d0..d1c10f56e 100644 --- a/Source/list.h +++ b/Source/list.h @@ -6,6 +6,7 @@ #include // for offsetof #include // for typeid +DEVILUTION_BEGIN_NAMESPACE #ifdef _MSC_VER #pragma warning (disable : 4291) // no matching operator delete found #endif @@ -63,13 +64,13 @@ private: TList &operator=(const TList &); // replacement new/delete operators for Storm objects - static __forceinline T *SNew(size_t extralen, int flags) + static __inline T *SNew(size_t extralen, int flags) { void *obj = SMemAlloc(sizeof(T) + extralen, (char *)OBJECT_NAME(T), SLOG_OBJECT, flags | (1<<3)); return new (obj) T(); } - static __forceinline void SDelete(T *node) + static __inline void SDelete(T *node) { node->~T(); SMemFree(node, (char *)OBJECT_NAME(T), SLOG_OBJECT, 0); @@ -105,14 +106,14 @@ void TList::DeleteAll() //============================================================================= template -__forceinline T *TList::Head() +__inline T *TList::Head() { return m_link.Next(); } //============================================================================= template -__forceinline TLink *TList::GetLinkFromNode(T *node) const +__inline TLink *TList::GetLinkFromNode(T *node) const { // assert(m_offset != (size_t) -1); // return (TLink *) ((size_t) node + m_offset); @@ -196,9 +197,7 @@ public: T *Next() { - if ((int)m_nextNode <= 0) return NULL; - return m_nextNode; } TLink *NextLink(size_t offset = -1) @@ -225,7 +224,7 @@ public: nextLink->m_prevLink = this; } - __forceinline void InsertAfter(T *node, TLink *prevLink, const size_t &offset) + __inline void InsertAfter(T *node, TLink *prevLink, const size_t &offset) { m_prevLink = prevLink; m_nextNode = prevLink->m_nextNode; @@ -257,3 +256,5 @@ void TLink::Unlink() m_nextNode = NULL; } } + +DEVILUTION_END_NAMESPACE diff --git a/Source/msg.cpp b/Source/msg.cpp index f769c9f6a..6c415a265 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -79,7 +79,7 @@ BOOL msg_wait_resync() sgbRecvCmd = CMD_DLEVEL_END; gbBufferMsgs = 1; sgdwOwnerWait = GetTickCount(); - success = UiProgressDialog(ghMainWnd, "Waiting for game data...", 1, msg_wait_for_turns, 20); + //success = UiProgressDialog(ghMainWnd, "Waiting for game data...", 1, msg_wait_for_turns, 20); gbBufferMsgs = 0; if (!success) { msg_free_packets(); diff --git a/SourceS/miniwin.h b/SourceS/miniwin.h index 7ced093c0..192f80359 100644 --- a/SourceS/miniwin.h +++ b/SourceS/miniwin.h @@ -31,8 +31,8 @@ #include "miniwin/thread.h" #include "miniwin/rand.h" #include "storm_full.h" +#include "miniwin/misc_macro.h" #ifdef DEVILUTION_ENGINE -#include "miniwin/misc_macro.h" #include "miniwin/com_macro.h" #endif diff --git a/SourceS/miniwin/misc.h b/SourceS/miniwin/misc.h index 958fe17e6..51238bea3 100644 --- a/SourceS/miniwin/misc.h +++ b/SourceS/miniwin/misc.h @@ -332,6 +332,7 @@ UINT WINAPI GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALET int WINAPIV wsprintfA(LPSTR, LPCSTR, ...); int WINAPIV wvsprintfA(LPSTR dest, LPCSTR format, va_list arglist); int __cdecl _strcmpi(const char *_Str1, const char *_Str2); +int __cdecl _strnicmp(const char *_Str1, const char *_Str2, int n); char *__cdecl _itoa(int _Value, char *_Dest, int _Radix); char *__cdecl _strlwr(char *str); @@ -354,7 +355,7 @@ typedef struct _WIN32_FIND_DATAA { DWORD dwFileType; DWORD dwCreatorType; WORD wFinderFlags; -} WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA; +} WIN32_FIND_DATAA, WIN32_FIND_DATA, *LPWIN32_FIND_DATAA; typedef void *LPOVERLAPPED; diff --git a/SourceS/miniwin/misc_macro.h b/SourceS/miniwin/misc_macro.h index 6a03a95f6..555ba3a61 100644 --- a/SourceS/miniwin/misc_macro.h +++ b/SourceS/miniwin/misc_macro.h @@ -42,6 +42,9 @@ #define WM_QUIT DVL_WM_QUIT +#define NOERROR 0 +#define FILE_ATTRIBUTE_DIRECTORY 1 + #define PeekMessage PeekMessageA #define DispatchMessage DispatchMessageA #define PostMessage PostMessageA diff --git a/SourceX/DiabloUI/diabloui.cpp b/SourceX/DiabloUI/diabloui.cpp index 59115ff4a..7e052b411 100644 --- a/SourceX/DiabloUI/diabloui.cpp +++ b/SourceX/DiabloUI/diabloui.cpp @@ -29,9 +29,6 @@ bool UiItemsWraps; char *UiTextInput; int UiTextInputLen; -int SCREEN_WIDTH = 640; -int SCREEN_HEIGHT = 480; - int fadeValue = 0; int SelectedItem = 0; diff --git a/SourceX/DiabloUI/diabloui.h b/SourceX/DiabloUI/diabloui.h index 70a37eb7b..e30e8f643 100644 --- a/SourceX/DiabloUI/diabloui.h +++ b/SourceX/DiabloUI/diabloui.h @@ -81,9 +81,6 @@ extern Art ArtBackground; extern Art ArtCursor; extern Art ArtHero; -extern int SCREEN_WIDTH; -extern int SCREEN_HEIGHT; - typedef enum TXT_JUST { JustLeft = 0, JustCentre = 1, diff --git a/SourceX/dx.cpp b/SourceX/dx.cpp index 926d2b017..9e1b474dd 100644 --- a/SourceX/dx.cpp +++ b/SourceX/dx.cpp @@ -443,12 +443,16 @@ void sdl_present_surface() surface_dirty = false; } -void j_lock_buf_priv(BYTE idx) +void lock_buf(BYTE idx) { - j_unlock_buf_priv(idx); // what is idx? } -void j_unlock_buf_priv(BYTE idx) +void unlock_buf(BYTE idx) +{ + unlock_buf_priv(); // what is idx? +} + +void unlock_buf_priv() { gpBufEnd -= (uintptr_t)gpBufEnd; diff --git a/SourceX/miniwin/misc.cpp b/SourceX/miniwin/misc.cpp index 2e147b98c..8e15073e0 100644 --- a/SourceX/miniwin/misc.cpp +++ b/SourceX/miniwin/misc.cpp @@ -49,6 +49,11 @@ int _strcmpi(const char *_Str1, const char *_Str2) return strcasecmp(_Str1, _Str2); } +int _strnicmp(const char *_Str1, const char *_Str2, int n) { + DUMMY(); + return strcasecmp(_Str1, _Str2); +} + char *_itoa(int _Value, char *_Dest, int _Radix) { switch (_Radix) {