From ff8889bc7ef1d83d4805406cd3a01807d541548b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 29 Aug 2018 05:30:08 +1000 Subject: [PATCH] C client: fix a few compile errors --- src/Chat.c | 4 ++-- src/Game.c | 2 +- src/Menus.c | 6 +++--- src/NixWindow.c | 4 ++-- src/Options.c | 2 +- src/Options.h | 12 ++++++------ src/Platform.c | 2 +- src/Widgets.c | 3 +-- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Chat.c b/src/Chat.c index d54690d22..360006f58 100644 --- a/src/Chat.c +++ b/src/Chat.c @@ -386,8 +386,8 @@ static void ResolutionCommand_Execute(STRING_PURE String* args, Int32 argsCount) } else { struct Size2D size = { width, height }; Window_SetClientSize(size); - Options_SetInt32(OPT_WINDOW_WIDTH, width); - Options_SetInt32(OPT_WINDOW_HEIGHT, height); + Options_SetInt(OPT_WINDOW_WIDTH, width); + Options_SetInt(OPT_WINDOW_HEIGHT, height); } } diff --git a/src/Game.c b/src/Game.c index 2e47dc55e..832af56fd 100644 --- a/src/Game.c +++ b/src/Game.c @@ -143,7 +143,7 @@ bool Game_ChangeTerrainAtlas(struct Bitmap* atlas) { void Game_SetViewDistance(Int32 distance, bool userDist) { if (userDist) { Game_UserViewDistance = distance; - Options_SetInt32(OPT_VIEW_DISTANCE, distance); + Options_SetInt(OPT_VIEW_DISTANCE, distance); } distance = min(distance, Game_MaxViewDistance); diff --git a/src/Menus.c b/src/Menus.c index 52bc48031..f50b66d41 100644 --- a/src/Menus.c +++ b/src/Menus.c @@ -366,7 +366,7 @@ static void ListScreen_UpdatePage(struct ListScreen* screen) { screen->Buttons[6].Disabled = screen->CurrentIndex >= end; if (Game_ClassicMode) return; - UInt8 pageBuffer[STRING_SIZE]; + char pageBuffer[STRING_SIZE]; String page = String_FromArray(pageBuffer); Int32 num = (screen->CurrentIndex / LIST_SCREEN_ITEMS) + 1; Int32 pages = Math_CeilDiv(screen->Entries.Count, LIST_SCREEN_ITEMS); @@ -2263,7 +2263,7 @@ static void ClassicOptionsScreen_GetMusic(STRING_TRANSIENT String* v) { Menu_Get static void ClassicOptionsScreen_SetMusic(STRING_PURE String* v) { Game_MusicVolume = String_CaselessEqualsConst(v, "ON") ? 100 : 0; Audio_SetMusic(Game_MusicVolume); - Options_SetInt32(OPT_MUSIC_VOLUME, Game_MusicVolume); + Options_SetInt(OPT_MUSIC_VOLUME, Game_MusicVolume); } static void ClassicOptionsScreen_GetInvert(STRING_TRANSIENT String* v) { Menu_GetBool(v, Game_InvertMouse); } @@ -2295,7 +2295,7 @@ static void ClassicOptionsScreen_GetSounds(STRING_TRANSIENT String* v) { Menu_Ge static void ClassicOptionsScreen_SetSounds(STRING_PURE String* v) { Game_SoundsVolume = String_CaselessEqualsConst(v, "ON") ? 100 : 0; Audio_SetSounds(Game_SoundsVolume); - Options_SetInt32(OPT_SOUND_VOLUME, Game_SoundsVolume); + Options_SetInt(OPT_SOUND_VOLUME, Game_SoundsVolume); } static void ClassicOptionsScreen_GetShowFPS(STRING_TRANSIENT String* v) { Menu_GetBool(v, Game_ShowFPS); } diff --git a/src/NixWindow.c b/src/NixWindow.c index 29a1e3576..fad892415 100644 --- a/src/NixWindow.c +++ b/src/NixWindow.c @@ -205,9 +205,9 @@ void Window_Create(Int32 x, Int32 y, Int32 width, Int32 height, STRING_REF Strin Window_Exists = true; } -char clipboard_copy_buffer[String_BufferSize(256)]; +char clipboard_copy_buffer[256]; String clipboard_copy_text = String_FromArray(clipboard_copy_buffer); -char clipboard_paste_buffer[String_BufferSize(256)]; +char clipboard_paste_buffer[256]; String clipboard_paste_text = String_FromArray(clipboard_paste_buffer); void Window_GetClipboardText(STRING_TRANSIENT String* value) { diff --git a/src/Options.c b/src/Options.c index b23d6b00c..d9a4bcb88 100644 --- a/src/Options.c +++ b/src/Options.c @@ -129,7 +129,7 @@ void Options_SetBool(const char* keyRaw, bool value) { } } -void Options_SetInt32(const char* keyRaw, Int32 value) { +void Options_SetInt(const char* keyRaw, Int32 value) { char numBuffer[STRING_INT_CHARS]; String numStr = String_FromArray(numBuffer); String_AppendInt32(&numStr, value); diff --git a/src/Options.h b/src/Options.h index a01b2affc..ff1f6480d 100644 --- a/src/Options.h +++ b/src/Options.h @@ -76,15 +76,15 @@ StringsBuffer Options_Values; bool Options_HasAnyChanged(void); void Options_Free(void); -void Options_Get(const char* key, STRING_TRANSIENT String* value, const char* defValue); -Int32 Options_GetInt(const char* key, Int32 min, Int32 max, Int32 defValue); -bool Options_GetBool(const char* key, bool defValue); +void Options_Get(const char* key, STRING_TRANSIENT String* value, const char* defValue); +Int32 Options_GetInt(const char* key, Int32 min, Int32 max, Int32 defValue); +bool Options_GetBool(const char* key, bool defValue); Real32 Options_GetFloat(const char* key, Real32 min, Real32 max, Real32 defValue); -UInt32 Options_GetEnum(const char* key, UInt32 defValue, const char** names, UInt32 namesCount); +UInt32 Options_GetEnum(const char* key, UInt32 defValue, const char** names, UInt32 namesCount); void Options_SetBool(const char* keyRaw, bool value); -void Options_SetInt32(const char* keyRaw, Int32 value); -void Options_Set(const char* keyRaw, STRING_PURE String* value); +void Options_SetInt(const char* keyRaw, Int32 value); +void Options_Set(const char* keyRaw, STRING_PURE String* value); void Options_Load(void); void Options_Save(void); #endif diff --git a/src/Platform.c b/src/Platform.c index 10f0cc309..1bd39b062 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -435,7 +435,7 @@ ReturnCode Directory_Enum(STRING_PURE String* path, void* obj, Directory_EnumCal return result; } -ReturnCode File_GetModifiedTime_MS(STRING_PURE String* path, DateTime* time) { +ReturnCode File_GetModifiedTime_MS(STRING_PURE String* path, UInt64* time) { char str[600]; Platform_ConvertString(str, path); struct stat sb; if (stat(str, &sb) == -1) return errno; diff --git a/src/Widgets.c b/src/Widgets.c index a29b0ff6a..5b00160b7 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -1320,9 +1320,8 @@ void InputWidget_Create(struct InputWidget* widget, struct FontDesc* font, STRIN /*########################################################################################################################* -*---------------------------------------------------struct MenuInputValidator----------------------------------------------------* +*---------------------------------------------------MenuInputValidator----------------------------------------------------* *#########################################################################################################################*/ -static bool MenuInputValidator_AlwaysValidChar(struct MenuInputValidator* v, char c) { return true; } static bool MenuInputValidator_AlwaysValidString(struct MenuInputValidator* v, STRING_PURE String* s) { return true; } static void HexColValidator_GetRange(struct MenuInputValidator* v, STRING_TRANSIENT String* range) {