Skip to content

Commit

Permalink
Added struct2str
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubitect committed Jun 25, 2023
1 parent f2c9630 commit f81c2e4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 $^

Expand Down
30 changes: 30 additions & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit f81c2e4

Please sign in to comment.