From d0eaf08517dc728d9ebce3b8cce88da168db0b64 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 9 Mar 2020 23:48:47 +1100 Subject: [PATCH] Make modern_tiles in Resources.c const --- src/Makefile | 2 +- src/Resources.c | 8 ++++---- src/Server.c | 2 +- src/Utils.h | 3 --- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Makefile b/src/Makefile index 4e1987e98..18565fbe5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,7 +44,7 @@ endif ifeq ($(PLAT),freebsd) CC=clang -CFLAGS=-g -pipe -rdynamic -I /usr/local/include +CFLAGS=-g -pipe -rdynamic -I /usr/local/include -fno-math-errno LDFLAGS=-L /usr/local/lib LIBS=-lcurl -lexecinfo -lopenal -lGL -lX11 -lm -lpthread endif diff --git a/src/Resources.c b/src/Resources.c index 0b22b7b41..b34b8a7c3 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -410,7 +410,7 @@ static cc_result ClassicPatcher_ExtractFiles(struct Stream* s) { } /* the x,y of tiles in terrain.png which get patched */ -static struct TilePatch { const char* name; cc_uint8 x1,y1, x2,y2; } modern_tiles[12] = { +static const struct TilePatch { const char* name; cc_uint8 x1,y1, x2,y2; } modern_tiles[12] = { { "assets/minecraft/textures/blocks/sandstone_bottom.png", 9,3 }, { "assets/minecraft/textures/blocks/sandstone_normal.png", 9,2 }, { "assets/minecraft/textures/blocks/sandstone_top.png", 9,1, }, @@ -425,7 +425,7 @@ static struct TilePatch { const char* name; cc_uint8 x1,y1, x2,y2; } modern_tile { "assets/minecraft/textures/blocks/wool_colored_pink.png", 0,5 } }; -CC_NOINLINE static struct TilePatch* ModernPatcher_GetTile(const String* path) { +CC_NOINLINE static const struct TilePatch* ModernPatcher_GetTile(const String* path) { int i; for (i = 0; i < Array_Elems(modern_tiles); i++) { if (String_CaselessEqualsConst(path, modern_tiles[i].name)) return &modern_tiles[i]; @@ -433,7 +433,7 @@ CC_NOINLINE static struct TilePatch* ModernPatcher_GetTile(const String* path) { return NULL; } -static cc_result ModernPatcher_PatchTile(struct Stream* data, struct TilePatch* tile) { +static cc_result ModernPatcher_PatchTile(struct Stream* data, const struct TilePatch* tile) { Bitmap bmp; cc_result res; @@ -480,7 +480,7 @@ static cc_result ModernPatcher_MakeAnimations(struct Stream* s, struct Stream* d static cc_result ModernPatcher_ProcessEntry(const String* path, struct Stream* data, struct ZipState* state) { struct ResourceTexture* entry; - struct TilePatch* tile; + const struct TilePatch* tile; String name; if (String_CaselessEqualsConst(path, "assets/minecraft/textures/environment/snow.png") diff --git a/src/Server.c b/src/Server.c index 45dcb4017..79a0a6b1c 100644 --- a/src/Server.c +++ b/src/Server.c @@ -306,7 +306,7 @@ static void MPConnection_BeginConnect(void) { Server.Disconnected = false; Socket_SetBlocking(net_socket, false); - net_connecting = true; + net_connecting = true; net_connectTimeout = DateTime_CurrentUTC_MS() + NET_TIMEOUT_MS; res = Socket_Connect(net_socket, &Server.IP, Server.Port); diff --git a/src/Utils.h b/src/Utils.h index 5077dbf31..aec3c77a6 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -23,9 +23,6 @@ struct DateTime { #define SECS_PER_MIN 60 #define SECS_PER_HOUR (60 * 60) #define SECS_PER_DAY (60 * 60 * 24) -#define MINS_PER_HOUR 60 -#define HOURS_PER_DAY 24 -#define MILLIS_PER_DAY (1000 * 60 * 60 * 24) CC_NOINLINE int Utils_ParseEnum(const String* text, int defValue, const char* const* names, int namesCount); /* Returns whether value starts with http:// or https:// */