From 28e1a2378dd88f0f4482f00d8fc492d34b24e0e4 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 7 Oct 2018 15:03:30 +1100 Subject: [PATCH] replace some usages of uint16/uint32 with just int --- src/Drawer2D.c | 2 +- src/Drawer2D.h | 2 +- src/EntityComponents.c | 2 +- src/Event.c | 18 +++++++++--------- src/Event.h | 14 +++++++------- src/Formats.c | 40 ++++++++++++++++++++++------------------ src/Gui.h | 2 +- src/Menus.c | 10 +++++----- src/Options.c | 2 +- src/Options.h | 10 +++++----- src/Platform.c | 2 +- src/Platform.h | 2 +- src/Screens.c | 2 +- src/ServerConnection.c | 2 +- src/ServerConnection.h | 2 +- src/Utils.c | 4 ++-- src/Utils.h | 2 +- src/Widgets.c | 8 ++++---- src/Widgets.h | 10 +++++----- 19 files changed, 70 insertions(+), 66 deletions(-) diff --git a/src/Drawer2D.c b/src/Drawer2D.c index 4776aab48..3bbe39b54 100644 --- a/src/Drawer2D.c +++ b/src/Drawer2D.c @@ -20,7 +20,7 @@ void DrawTextArgs_MakeEmpty(struct DrawTextArgs* args, FontDesc* font, bool useS args->UseShadow = useShadow; } -void Drawer2D_MakeFont(FontDesc* desc, uint16_t size, uint16_t style) { +void Drawer2D_MakeFont(FontDesc* desc, int size, int style) { if (Drawer2D_BitmappedText) { desc->Handle = NULL; desc->Size = size; diff --git a/src/Drawer2D.h b/src/Drawer2D.h index 0a403be87..b1f19fb5d 100644 --- a/src/Drawer2D.h +++ b/src/Drawer2D.h @@ -11,7 +11,7 @@ struct Texture; void DrawTextArgs_Make(struct DrawTextArgs* args, STRING_REF const String* text, FontDesc* font, bool useShadow); void DrawTextArgs_MakeEmpty(struct DrawTextArgs* args, FontDesc* font, bool useShadow); -NOINLINE_ void Drawer2D_MakeFont(FontDesc* desc, uint16_t size, uint16_t style); +NOINLINE_ void Drawer2D_MakeFont(FontDesc* desc, int size, int style); /* Whether chat text should be drawn and measuring using the currently bitmapped font, false uses the font supplied as the DrawTextArgs argument supplied to the function. */ diff --git a/src/EntityComponents.c b/src/EntityComponents.c index 11887da52..1459c0540 100644 --- a/src/EntityComponents.c +++ b/src/EntityComponents.c @@ -514,7 +514,7 @@ static void ShadowComponent_DrawCircle(VertexP3fT2fC4b** vertices, struct Entity Vector3 min = Block_MinBB[data[0].Block], max = Block_MaxBB[data[0].Block]; ShadowComponent_DrawCoords(vertices, entity, &data[0], x + min.X, z + min.Z, x + max.X, z + max.Z); - UInt32 i; + int i; for (i = 1; i < 4; i++) { if (data[i].Block == BLOCK_AIR) return; Vector3 nMin = Block_MinBB[data[i].Block], nMax = Block_MaxBB[data[i].Block]; diff --git a/src/Event.c b/src/Event.c index b0e130fcd..6e3762055 100644 --- a/src/Event.c +++ b/src/Event.c @@ -2,7 +2,7 @@ #include "ErrorHandler.h" static void Event_RegisterImpl(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { if (handlers->Handlers[i] == handler && handlers->Objs[i] == obj) { ErrorHandler_Fail("Attempt to register event handler that was already registered"); @@ -19,7 +19,7 @@ static void Event_RegisterImpl(struct Event_Void* handlers, void* obj, Event_Voi } static void Event_UnregisterImpl(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) { - UInt32 i, j; + int i, j; for (i = 0; i < handlers->Count; i++) { if (handlers->Handlers[i] != handler || handlers->Objs[i] != obj) continue; @@ -38,7 +38,7 @@ static void Event_UnregisterImpl(struct Event_Void* handlers, void* obj, Event_V } void Event_RaiseVoid(struct Event_Void* handlers) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { handlers->Handlers[i](handlers->Objs[i]); } @@ -51,7 +51,7 @@ void Event_UnregisterVoid(struct Event_Void* handlers, void* obj, Event_Void_Cal } void Event_RaiseInt(struct Event_Int* handlers, int arg) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { handlers->Handlers[i](handlers->Objs[i], arg); } @@ -64,7 +64,7 @@ void Event_UnregisterInt(struct Event_Int* handlers, void* obj, Event_Int_Callba } void Event_RaiseFloat(struct Event_Float* handlers, float arg) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { handlers->Handlers[i](handlers->Objs[i], arg); } @@ -78,7 +78,7 @@ void Event_UnregisterFloat(struct Event_Float* handlers, void* obj, Event_Float_ } void Event_RaiseEntry(struct Event_Entry* handlers, struct Stream* stream, const String* name) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { handlers->Handlers[i](handlers->Objs[i], stream, name); } @@ -91,7 +91,7 @@ void Event_UnregisterEntry(struct Event_Entry* handlers, void* obj, Event_Entry_ } void Event_RaiseBlock(struct Event_Block* handlers, Vector3I coords, BlockID oldBlock, BlockID block) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { handlers->Handlers[i](handlers->Objs[i], coords, oldBlock, block); } @@ -104,7 +104,7 @@ void Event_UnregisterBlock(struct Event_Block* handlers, void* obj, Event_Block_ } void Event_RaiseMouseMove(struct Event_MouseMove* handlers, int xDelta, int yDelta) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { handlers->Handlers[i](handlers->Objs[i], xDelta, yDelta); } @@ -117,7 +117,7 @@ void Event_UnregisterMouseMove(struct Event_MouseMove* handlers, void* obj, Even } void Event_RaiseChat(struct Event_Chat* handlers, const String* msg, int msgType) { - UInt32 i; + int i; for (i = 0; i < handlers->Count; i++) { handlers->Handlers[i](handlers->Objs[i], msg, msgType); } diff --git a/src/Event.h b/src/Event.h index 2095115dd..a6ed1a102 100644 --- a/src/Event.h +++ b/src/Event.h @@ -13,43 +13,43 @@ struct Stream; typedef void (*Event_Void_Callback)(void* obj); struct Event_Void { Event_Void_Callback Handlers[EVENT_MAX_CALLBACKS]; - void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; + void* Objs[EVENT_MAX_CALLBACKS]; int Count; }; typedef void (*Event_Int_Callback)(void* obj, int argument); struct Event_Int { Event_Int_Callback Handlers[EVENT_MAX_CALLBACKS]; - void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; + void* Objs[EVENT_MAX_CALLBACKS]; int Count; }; typedef void (*Event_Float_Callback)(void* obj, float argument); struct Event_Float { Event_Float_Callback Handlers[EVENT_MAX_CALLBACKS]; - void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; + void* Objs[EVENT_MAX_CALLBACKS]; int Count; }; typedef void (*Event_Entry_Callback)(void* obj, struct Stream* stream, const String* name); struct Event_Entry { Event_Entry_Callback Handlers[EVENT_MAX_CALLBACKS]; - void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; + void* Objs[EVENT_MAX_CALLBACKS]; int Count; }; typedef void (*Event_Block_Callback)(void* obj, Vector3I coords, BlockID oldBlock, BlockID block); struct Event_Block { Event_Block_Callback Handlers[EVENT_MAX_CALLBACKS]; - void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; + void* Objs[EVENT_MAX_CALLBACKS]; int Count; }; typedef void (*Event_MouseMove_Callback)(void* obj, int xDelta, int yDelta); struct Event_MouseMove { Event_MouseMove_Callback Handlers[EVENT_MAX_CALLBACKS]; - void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; + void* Objs[EVENT_MAX_CALLBACKS]; int Count; }; typedef void (*Event_Chat_Callback)(void* obj, const String* msg, int msgType); struct Event_Chat { Event_Chat_Callback Handlers[EVENT_MAX_CALLBACKS]; - void* Objs[EVENT_MAX_CALLBACKS]; UInt32 Count; + void* Objs[EVENT_MAX_CALLBACKS]; int Count; }; void Event_RaiseVoid(struct Event_Void* handlers); diff --git a/src/Formats.c b/src/Formats.c index bc28926ed..b0ea08035 100644 --- a/src/Formats.c +++ b/src/Formats.c @@ -219,6 +219,7 @@ struct NbtTag { union { uint8_t Value_U8; int16_t Value_I16; + uint16_t Value_U16; int32_t Value_I32; float Value_F32; uint8_t DataSmall[NBT_SMALL_SIZE]; @@ -236,6 +237,11 @@ static int16_t NbtTag_I16(struct NbtTag* tag) { return tag->Value_I16; } +static uint16_t NbtTag_U16(struct NbtTag* tag) { + if (tag->TagID != NBT_I16) ErrorHandler_Fail("Expected I16 NBT tag"); + return tag->Value_U16; +} + static float NbtTag_F32(struct NbtTag* tag) { if (tag->TagID != NBT_F32) ErrorHandler_Fail("Expected F32 NBT tag"); return tag->Value_F32; @@ -359,9 +365,9 @@ static bool IsTag(struct NbtTag* tag, const char* tagName) { *--------------------------------------------------ClassicWorld format----------------------------------------------------* *#########################################################################################################################*/ static bool Cw_Callback_1(struct NbtTag* tag) { - if (IsTag(tag, "X")) { World_Width = (uint16_t)NbtTag_I16(tag); return true; } - if (IsTag(tag, "Y")) { World_Height = (uint16_t)NbtTag_I16(tag); return true; } - if (IsTag(tag, "Z")) { World_Length = (uint16_t)NbtTag_I16(tag); return true; } + if (IsTag(tag, "X")) { World_Width = NbtTag_U16(tag); return true; } + if (IsTag(tag, "Y")) { World_Height = NbtTag_U16(tag); return true; } + if (IsTag(tag, "Z")) { World_Length = NbtTag_U16(tag); return true; } if (IsTag(tag, "UUID")) { if (tag->DataSize != sizeof(World_Uuid)) ErrorHandler_Fail("Map UUID must be 16 bytes"); @@ -395,15 +401,13 @@ static bool Cw_Callback_2(struct NbtTag* tag) { } BlockID cw_curID; -int16_t cw_colR, cw_colG, cw_colB; +uint16_t cw_colR, cw_colG, cw_colB; static PackedCol Cw_ParseCol(PackedCol defValue) { - int16_t r = cw_colR, g = cw_colG, b = cw_colB; - if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) { - return defValue; - } else { - PackedCol col = PACKEDCOL_CONST((uint8_t)r, (uint8_t)g, (uint8_t)b, 255); - return col; - } + uint16_t r = cw_colR, g = cw_colG, b = cw_colB; + if (r > 255 || g > 255 || b > 255) return defValue; + + PackedCol col = PACKEDCOL_CONST((uint8_t)r, (uint8_t)g, (uint8_t)b, 255); + return col; } static bool Cw_Callback_4(struct NbtTag* tag) { @@ -412,7 +416,7 @@ static bool Cw_Callback_4(struct NbtTag* tag) { struct LocalPlayer*p = &LocalPlayer_Instance; if (IsTag(tag->Parent, "ClickDistance")) { - if (IsTag(tag, "Distance")) { p->ReachDistance = NbtTag_I16(tag) / 32.0f; return true; } + if (IsTag(tag, "Distance")) { p->ReachDistance = NbtTag_U16(tag) / 32.0f; return true; } } if (IsTag(tag->Parent, "EnvWeatherType")) { if (IsTag(tag, "WeatherType")) { Env_SetWeather(NbtTag_U8(tag)); return true; } @@ -477,9 +481,9 @@ static bool Cw_Callback_5(struct NbtTag* tag) { if (!IsTag(tag->Parent->Parent->Parent->Parent, "Metadata")) return false; if (IsTag(tag->Parent->Parent, "EnvColors")) { - if (IsTag(tag, "R")) { cw_colR = NbtTag_I16(tag); return true; } - if (IsTag(tag, "G")) { cw_colG = NbtTag_I16(tag); return true; } - if (IsTag(tag, "B")) { cw_colB = NbtTag_I16(tag); return true; } + if (IsTag(tag, "R")) { cw_colR = NbtTag_U16(tag); return true; } + if (IsTag(tag, "G")) { cw_colG = NbtTag_U16(tag); return true; } + if (IsTag(tag, "B")) { cw_colB = NbtTag_U16(tag); return true; } } if (IsTag(tag->Parent->Parent, "BlockDefinitions") && Game_AllowCustomBlocks) { @@ -608,7 +612,7 @@ struct JFieldDesc { struct JClassDesc { char ClassName[JNAME_SIZE]; - uint16_t FieldsCount; + int FieldsCount; struct JFieldDesc Fields[22]; }; @@ -659,7 +663,7 @@ static ReturnCode Dat_ReadClassDesc(struct Stream* stream, struct JClassDesc* de desc->FieldsCount = Stream_GetU16_BE(tmp); if (desc->FieldsCount > Array_Elems(desc->Fields)) return DAT_ERR_JCLASS_FIELDS; - Int32 i; + int i; for (i = 0; i < desc->FieldsCount; i++) { if ((res = Dat_ReadFieldDesc(stream, &desc->Fields[i]))) return res; } @@ -758,7 +762,7 @@ ReturnCode Dat_Load(struct Stream* stream) { struct JClassDesc obj; if ((res = Dat_ReadClassDesc(&compStream, &obj))) return res; - Int32 i; + int i; Vector3* spawn = &LocalPlayer_Instance.Spawn; for (i = 0; i < obj.FieldsCount; i++) { struct JFieldDesc* field = &obj.Fields[i]; diff --git a/src/Gui.h b/src/Gui.h index c12946eeb..31b25f9b6 100644 --- a/src/Gui.h +++ b/src/Gui.h @@ -110,7 +110,7 @@ struct TextAtlas { struct Texture Tex; int Offset, CurX, FontSize; float uScale; - Int32 Widths[TEXTATLAS_MAX_WIDTHS]; + int16_t Widths[TEXTATLAS_MAX_WIDTHS]; }; void TextAtlas_Make(struct TextAtlas* atlas, const String* chars, FontDesc* font, const String* prefix); void TextAtlas_Free(struct TextAtlas* atlas); diff --git a/src/Menus.c b/src/Menus.c index 1387efc1a..ef443b403 100644 --- a/src/Menus.c +++ b/src/Menus.c @@ -1913,7 +1913,7 @@ static void MenuOptionsScreen_GetFPS(String* raw) { String_AppendConst(raw, FpsLimit_Names[Game_FpsLimit]); } static void MenuOptionsScreen_SetFPS(const String* raw) { - UInt32 method = Utils_ParseEnum(raw, FpsLimit_VSync, FpsLimit_Names, Array_Elems(FpsLimit_Names)); + int method = Utils_ParseEnum(raw, FpsLimit_VSync, FpsLimit_Names, Array_Elems(FpsLimit_Names)); Game_SetFpsLimit(method); String value = String_FromReadonly(FpsLimit_Names[method]); @@ -2125,13 +2125,13 @@ static void MenuOptionsScreen_Enum(void* screen, void* widget) { struct MenuInputValidator* v = &s->Validators[index]; const char** names = v->Meta_Enum.Names; - UInt32 count = v->Meta_Enum.Count; + int count = v->Meta_Enum.Count; char valueBuffer[STRING_SIZE]; String value = String_FromArray(valueBuffer); btn->GetValue(&value); - UInt32 raw = (Utils_ParseEnum(&value, 0, names, count) + 1) % count; + int raw = (Utils_ParseEnum(&value, 0, names, count) + 1) % count; String newValue = String_FromReadonly(names[raw]); MenuOptionsScreen_Set(s, index, &newValue); } @@ -2221,7 +2221,7 @@ static void ClassicOptionsScreen_GetViewDist(String* v) { } } static void ClassicOptionsScreen_SetViewDist(const String* v) { - UInt32 raw = Utils_ParseEnum(v, 0, ViewDist_Names, ViewDist_Count); + int raw = Utils_ParseEnum(v, 0, ViewDist_Names, ViewDist_Count); int dist = raw == ViewDist_Far ? 512 : (raw == ViewDist_Normal ? 128 : (raw == ViewDist_Short ? 32 : 8)); Game_UserSetViewDistance(dist); } @@ -2322,7 +2322,7 @@ static void EnvSettingsScreen_SetShadowCol(const String* v) { Env_SetShadowCol(M static void EnvSettingsScreen_GetWeather(String* v) { String_AppendConst(v, Weather_Names[Env_Weather]); } static void EnvSettingsScreen_SetWeather(const String* v) { - UInt32 raw = Utils_ParseEnum(v, 0, Weather_Names, Array_Elems(Weather_Names)); + int raw = Utils_ParseEnum(v, 0, Weather_Names, Array_Elems(Weather_Names)); Env_SetWeather(raw); } diff --git a/src/Options.c b/src/Options.c index 66b0294df..560c96a40 100644 --- a/src/Options.c +++ b/src/Options.c @@ -100,7 +100,7 @@ float Options_GetFloat(const char* key, float min, float max, float defValue) { return value; } -UInt32 Options_GetEnum(const char* key, UInt32 defValue, const char** names, UInt32 namesCount) { +int Options_GetEnum(const char* key, int defValue, const char** names, int namesCount) { String str; if (!Options_TryGetValue(key, &str)) return defValue; return Utils_ParseEnum(&str, defValue, names, namesCount); diff --git a/src/Options.h b/src/Options.h index a17a4d228..d21364c1f 100644 --- a/src/Options.h +++ b/src/Options.h @@ -76,11 +76,11 @@ StringsBuffer Options_Values; NOINLINE_ bool Options_HasAnyChanged(void); NOINLINE_ void Options_Free(void); -NOINLINE_ void Options_Get(const char* key, String* value, const char* defValue); -NOINLINE_ int Options_GetInt(const char* key, int min, int max, int defValue); -NOINLINE_ bool Options_GetBool(const char* key, bool defValue); -NOINLINE_ float Options_GetFloat(const char* key, float min, float max, float defValue); -NOINLINE_ UInt32 Options_GetEnum(const char* key, UInt32 defValue, const char** names, UInt32 namesCount); +NOINLINE_ void Options_Get(const char* key, String* value, const char* defValue); +NOINLINE_ int Options_GetInt(const char* key, int min, int max, int defValue); +NOINLINE_ bool Options_GetBool(const char* key, bool defValue); +NOINLINE_ float Options_GetFloat(const char* key, float min, float max, float defValue); +NOINLINE_ int Options_GetEnum(const char* key, int defValue, const char** names, int namesCount); NOINLINE_ void Options_SetBool(const char* keyRaw, bool value); NOINLINE_ void Options_SetInt(const char* keyRaw, int value); diff --git a/src/Platform.c b/src/Platform.c index 7bed84f9c..5d47ad267 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -726,7 +726,7 @@ void Font_GetNames(StringsBuffer* buffer) { } } -void Font_Make(FontDesc* desc, const String* fontName, uint16_t size, uint16_t style) { +void Font_Make(FontDesc* desc, const String* fontName, int size, int style) { desc->Size = size; desc->Style = style; if (!norm_fonts.Count) Font_Init(); diff --git a/src/Platform.h b/src/Platform.h index c9d3d1da6..3f51dc50d 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -87,7 +87,7 @@ void Waitable_Wait(void* handle); void Waitable_WaitFor(void* handle, UInt32 milliseconds); NOINLINE_ void Font_GetNames(StringsBuffer* buffer); -NOINLINE_ void Font_Make(FontDesc* desc, const String* fontName, uint16_t size, uint16_t style); +NOINLINE_ void Font_Make(FontDesc* desc, const String* fontName, int size, int style); NOINLINE_ void Font_Free(FontDesc* desc); NOINLINE_ Size2D Platform_TextMeasure(struct DrawTextArgs* args); NOINLINE_ Size2D Platform_TextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, PackedCol col); diff --git a/src/Screens.c b/src/Screens.c index 36a35cd43..afc0f5f0b 100644 --- a/src/Screens.c +++ b/src/Screens.c @@ -1268,7 +1268,7 @@ static bool HUDScreen_MouseDown(void* screen, int x, int y, MouseButton btn) { static void HUDScreen_Init(void* screen) { struct HUDScreen* s = screen; - uint16_t size = Drawer2D_BitmappedText ? 16 : 11; + int size = Drawer2D_BitmappedText ? 16 : 11; Drawer2D_MakeFont(&s->PlayerFont, size, FONT_STYLE_NORMAL); ChatScreen_MakeInstance(); diff --git a/src/ServerConnection.c b/src/ServerConnection.c index 9491868db..5cb7b3ea5 100644 --- a/src/ServerConnection.c +++ b/src/ServerConnection.c @@ -459,7 +459,7 @@ static void MPConnection_Tick(struct ScheduledTask* task) { net_ticks++; } -void Net_Set(uint8_t opcode, Net_Handler handler, uint16_t packetSize) { +void Net_Set(uint8_t opcode, Net_Handler handler, int packetSize) { Net_Handlers[opcode] = handler; Net_PacketSizes[opcode] = packetSize; } diff --git a/src/ServerConnection.h b/src/ServerConnection.h index 2d0a8c994..47d7c1873 100644 --- a/src/ServerConnection.h +++ b/src/ServerConnection.h @@ -72,6 +72,6 @@ void ServerConnection_MakeComponent(struct IGameComponent* comp); typedef void (*Net_Handler)(uint8_t* data); uint16_t Net_PacketSizes[OPCODE_COUNT]; Net_Handler Net_Handlers[OPCODE_COUNT]; -void Net_Set(uint8_t opcode, Net_Handler handler, uint16_t size); +void Net_Set(uint8_t opcode, Net_Handler handler, int size); void Net_SendPacket(void); #endif diff --git a/src/Utils.c b/src/Utils.c index 9223e72b7..fae34542a 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -98,8 +98,8 @@ void DateTime_HttpDate(TimeMS ms, String* str) { String_Format3(str, " %p2:%p2:%p2 GMT", &hour, &min, &sec); } -UInt32 Utils_ParseEnum(const String* text, UInt32 defValue, const char** names, UInt32 namesCount) { - UInt32 i; +int Utils_ParseEnum(const String* text, int defValue, const char** names, int namesCount) { + int i; for (i = 0; i < namesCount; i++) { if (String_CaselessEqualsConst(text, names[i])) return i; } diff --git a/src/Utils.h b/src/Utils.h index d5d1bf3b8..122b62dc0 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -22,7 +22,7 @@ TimeMS DateTime_TotalMs(DateTime* time); void DateTime_FromTotalMs(DateTime* time, TimeMS ms); void DateTime_HttpDate(TimeMS ms, String* str); -UInt32 Utils_ParseEnum(const String* text, UInt32 defValue, const char** names, UInt32 namesCount); +NOINLINE_ int Utils_ParseEnum(const String* text, int defValue, const char** names, int namesCount); bool Utils_IsValidInputChar(char c, bool supportsCP437); bool Utils_IsUrlPrefix(const String* value, int index); diff --git a/src/Widgets.c b/src/Widgets.c index d4a67dfa7..e59c0c13b 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -1399,7 +1399,7 @@ struct MenuInputValidator MenuInputValidator_Path(void) { return v; } -struct MenuInputValidator MenuInputValidator_Enum(const char** names, UInt32 namesCount) { +struct MenuInputValidator MenuInputValidator_Enum(const char** names, int namesCount) { struct MenuInputValidator v; v.VTABLE = NULL; v.Meta_Enum.Names = names; @@ -1934,7 +1934,7 @@ static void PlayerListWidget_DeleteGroup(struct PlayerListWidget* w, int* i) { (*i)--; } -static void PlayerListWidget_AddGroup(struct PlayerListWidget* w, uint16_t id, int* index) { +static void PlayerListWidget_AddGroup(struct PlayerListWidget* w, int id, int* index) { int i; for (i = Array_Elems(w->IDs) - 1; i > (*index); i--) { w->IDs[i] = w->IDs[i - 1]; @@ -1949,7 +1949,7 @@ static void PlayerListWidget_AddGroup(struct PlayerListWidget* w, uint16_t id, i w->NamesCount++; } -static int PlayerListWidget_GetGroupCount(struct PlayerListWidget* w, uint16_t id, int idx) { +static int PlayerListWidget_GetGroupCount(struct PlayerListWidget* w, int id, int idx) { String group = TabList_UNSAFE_GetGroup(id); int count = 0; @@ -2029,7 +2029,7 @@ static void PlayerListWidget_SortEntries(struct PlayerListWidget* w) { i = 0; List_SortCompare = PlayerListWidget_PlayerCompare; while (i < w->NamesCount) { - uint16_t id = w->IDs[i]; + int id = w->IDs[i]; PlayerListWidget_AddGroup(w, id, &i); int count = PlayerListWidget_GetGroupCount(w, id, i); PlayerListWidget_QuickSort(i, i + (count - 1)); diff --git a/src/Widgets.h b/src/Widgets.h index df5c9dd65..a7c3746e2 100644 --- a/src/Widgets.h +++ b/src/Widgets.h @@ -25,7 +25,7 @@ typedef void (*Button_Set)(const String* raw); struct ButtonWidget { Widget_Layout struct Texture Texture; - uint16_t MinWidth; + int MinWidth; const char* OptName; Button_Get GetValue; @@ -93,12 +93,12 @@ struct InputWidget { Size2D LineSizes[INPUTWIDGET_MAX_LINES]; /* size of each line in pixels */ struct Texture InputTex; String Prefix; - uint16_t PrefixWidth, PrefixHeight; + int PrefixWidth, PrefixHeight; bool ConvertPercents; uint8_t Padding; bool ShowCaret; - uint16_t CaretWidth; + int CaretWidth; int CaretX, CaretY; /* Coordinates of caret in lines */ int CaretPos; /* Position of caret, -1 for at end of string */ PackedCol CaretCol; @@ -122,7 +122,7 @@ struct MenuInputValidatorVTABLE { struct MenuInputValidator { struct MenuInputValidatorVTABLE* VTABLE; union { - struct { const char** Names; UInt32 Count; } Meta_Enum; + struct { const char** Names; int Count; } Meta_Enum; struct { int Min, Max; } Meta_Int; struct { float Min, Max; } Meta_Float; }; @@ -133,7 +133,7 @@ struct MenuInputValidator MenuInputValidator_Int(int min, int max); struct MenuInputValidator MenuInputValidator_Seed(void); struct MenuInputValidator MenuInputValidator_Float(float min, float max); struct MenuInputValidator MenuInputValidator_Path(void); -struct MenuInputValidator MenuInputValidator_Enum(const char** names, UInt32 namesCount); +struct MenuInputValidator MenuInputValidator_Enum(const char** names, int namesCount); struct MenuInputValidator MenuInputValidator_String(void); struct MenuInputWidget {