diff --git a/makefile b/makefile index c8fd39d..356b7ca 100644 --- a/makefile +++ b/makefile @@ -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 $^ diff --git a/util.c b/util.c index f21d645..d9ed651 100644 --- a/util.c +++ b/util.c @@ -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) { diff --git a/util.h b/util.h index 366b43c..566d9ab 100644 --- a/util.h +++ b/util.h @@ -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]);