From ca07e4ef33b19ca59bd4ccaae224a8db95c4640e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 13 Oct 2022 18:56:51 +1100 Subject: [PATCH] Allow using smaller value type tags for 16 bit/32 bit integer NBT value retrieval functions, addresses #966 --- src/Formats.c | 4 ++++ src/interop_cocoa.m | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Formats.c b/src/Formats.c index 28307f3ec..02bf47062 100644 --- a/src/Formats.c +++ b/src/Formats.c @@ -340,6 +340,7 @@ static cc_uint8 NbtTag_U8(struct NbtTag* tag) { static cc_int16 NbtTag_I16(struct NbtTag* tag) { if (tag->type == NBT_I16) return tag->value.i16; + if (tag->type == NBT_I8) return tag->value.u8; tag->result = NBT_ERR_EXPECTED_I16; return 0; @@ -347,6 +348,7 @@ static cc_int16 NbtTag_I16(struct NbtTag* tag) { static cc_uint16 NbtTag_U16(struct NbtTag* tag) { if (tag->type == NBT_I16) return tag->value.u16; + if (tag->type == NBT_I8) return tag->value.u8; tag->result = NBT_ERR_EXPECTED_I16; return 0; @@ -354,6 +356,8 @@ static cc_uint16 NbtTag_U16(struct NbtTag* tag) { static int NbtTag_I32(struct NbtTag* tag) { if (tag->type == NBT_I32) return tag->value.i32; + if (tag->type == NBT_I16) return tag->value.i16; + if (tag->type == NBT_I8) return tag->value.u8; tag->result = NBT_ERR_EXPECTED_I32; return 0; diff --git a/src/interop_cocoa.m b/src/interop_cocoa.m index f3f9036d1..50b8ba71e 100644 --- a/src/interop_cocoa.m +++ b/src/interop_cocoa.m @@ -176,7 +176,7 @@ static void RefreshWindowBounds(void) { - (void)keyDown:(NSEvent *)event { } @end -@interface CCWindowDelegate : NSObject { } +@interface CCWindowDelegate : NSWindowDelegate { } @end @implementation CCWindowDelegate - (void)windowDidResize:(NSNotification *)notification {