Added struct2str

This commit is contained in:
Cubitect 2023-06-25 21:33:52 +02:00
parent f2c96306c7
commit f81c2e4fde
3 changed files with 36 additions and 1 deletions

View File

@ -17,7 +17,7 @@ endif
all: release
debug: CFLAGS += -DDEBUG -O0 -ggdb3 -fsanitize=undefined
debug: CFLAGS += -DDEBUG -O0 -ggdb3
debug: libcubiomes
release: CFLAGS += -O3 -g3
release: libcubiomes
@ -26,8 +26,10 @@ native: libcubiomes
ifeq ($(OS),Windows_NT)
else
debug: CFLAGS += -fsanitize=undefined
libcubiomes: CFLAGS += -fPIC
endif
libcubiomes: noise.o biome_tree.o layers.o generator.o finders.o util.o quadbase.o
$(AR) $(ARFLAGS) libcubiomes.a $^

30
util.c
View File

@ -244,6 +244,36 @@ const char *biome2str(int mc, int id)
return NULL;
}
const char* struct2str(int stype)
{
switch (stype)
{
case Desert_Pyramid: return "desert_pyramid";
case Jungle_Temple: return "jungle_pyramid";
case Swamp_Hut: return "swamp_hut";
case Igloo: return "igloo";
case Village: return "village";
case Ocean_Ruin: return "ocean_ruin";
case Shipwreck: return "shipwreck";
case Monument: return "monument";
case Mansion: return "mansion";
case Outpost: return "pillager_outpost";
case Treasure: return "buried_treasure";
case Mineshaft: return "mineshaft";
case Desert_Well: return "desert_well";
case Ruined_Portal: return "ruined_portal";
case Ruined_Portal_N: return "ruined_portal_nether";
case Geode: return "amethyst_geode";
case Ancient_City: return "ancient_city";
case Trail_Ruin: return "trail_ruins";
case Fortress: return "fortress";
case Bastion: return "bastion_remnant";
case End_City: return "end_city";
case End_Gateway: return "end_gateway";
}
return NULL;
}
void setBiomeColor(unsigned char biomeColor[256][3], int id,
unsigned char r, unsigned char g, unsigned char b)
{

3
util.h
View File

@ -27,6 +27,9 @@ int str2mc(const char *s);
/// get the resource id name for a biome (for versions 1.13+)
const char *biome2str(int mc, int id);
/// get the resource id name for a structure
const char *struct2str(int stype);
/// initialize a biome colormap with some defaults
void initBiomeColors(unsigned char biomeColors[256][3]);
void initBiomeTypeColors(unsigned char biomeColors[256][3]);