Make modern_tiles in Resources.c const

This commit is contained in:
UnknownShadow200 2020-03-09 23:48:47 +11:00
parent 6aa2dceb22
commit d0eaf08517
4 changed files with 6 additions and 9 deletions

View File

@ -44,7 +44,7 @@ endif
ifeq ($(PLAT),freebsd) ifeq ($(PLAT),freebsd)
CC=clang 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 LDFLAGS=-L /usr/local/lib
LIBS=-lcurl -lexecinfo -lopenal -lGL -lX11 -lm -lpthread LIBS=-lcurl -lexecinfo -lopenal -lGL -lX11 -lm -lpthread
endif endif

View File

@ -410,7 +410,7 @@ static cc_result ClassicPatcher_ExtractFiles(struct Stream* s) {
} }
/* the x,y of tiles in terrain.png which get patched */ /* 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_bottom.png", 9,3 },
{ "assets/minecraft/textures/blocks/sandstone_normal.png", 9,2 }, { "assets/minecraft/textures/blocks/sandstone_normal.png", 9,2 },
{ "assets/minecraft/textures/blocks/sandstone_top.png", 9,1, }, { "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 } { "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; int i;
for (i = 0; i < Array_Elems(modern_tiles); i++) { for (i = 0; i < Array_Elems(modern_tiles); i++) {
if (String_CaselessEqualsConst(path, modern_tiles[i].name)) return &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; 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; Bitmap bmp;
cc_result res; 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) { static cc_result ModernPatcher_ProcessEntry(const String* path, struct Stream* data, struct ZipState* state) {
struct ResourceTexture* entry; struct ResourceTexture* entry;
struct TilePatch* tile; const struct TilePatch* tile;
String name; String name;
if (String_CaselessEqualsConst(path, "assets/minecraft/textures/environment/snow.png") if (String_CaselessEqualsConst(path, "assets/minecraft/textures/environment/snow.png")

View File

@ -23,9 +23,6 @@ struct DateTime {
#define SECS_PER_MIN 60 #define SECS_PER_MIN 60
#define SECS_PER_HOUR (60 * 60) #define SECS_PER_HOUR (60 * 60)
#define SECS_PER_DAY (60 * 60 * 24) #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); CC_NOINLINE int Utils_ParseEnum(const String* text, int defValue, const char* const* names, int namesCount);
/* Returns whether value starts with http:// or https:// */ /* Returns whether value starts with http:// or https:// */