diff --git a/overviewer_core/src/block_class.c b/overviewer_core/src/block_class.c index 7e68d4f..9141966 100644 --- a/overviewer_core/src/block_class.c +++ b/overviewer_core/src/block_class.c @@ -22,7 +22,7 @@ #include #endif -bool block_class_is_subset( +extern inline bool block_class_is_subset( mc_block_t block, const mc_block_t block_class[], size_t block_class_len diff --git a/overviewer_core/src/block_class.h b/overviewer_core/src/block_class.h index 9fa5e98..6af1bcc 100644 --- a/overviewer_core/src/block_class.h +++ b/overviewer_core/src/block_class.h @@ -1,50 +1,50 @@ -/* - * This file is part of the Minecraft Overviewer. - * - * Minecraft Overviewer is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as published - * by the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Minecraft Overviewer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with the Overviewer. If not, see . - */ - -#ifndef __BLOCK_CLASS_H_INCLUDED__ -#define __BLOCK_CLASS_H_INCLUDED__ - -#include -#include - -#include "mc_id.h" - -bool block_class_is_subset( - mc_block_t block, - const mc_block_t block_class[], - size_t block_class_len -); - -extern const mc_block_t block_class_stair[]; -extern const size_t block_class_stair_len; - -extern const mc_block_t block_class_door[]; -extern const size_t block_class_door_len; - -extern const mc_block_t block_class_fence[]; -extern const size_t block_class_fence_len; - -extern const mc_block_t block_class_fence_gate[]; -extern const size_t block_class_fence_gate_len; - -extern const mc_block_t block_class_ancil[]; -extern const size_t block_class_ancil_len; - -extern const mc_block_t block_class_alt_height[]; -extern const size_t block_class_alt_height_len; - +/* + * This file is part of the Minecraft Overviewer. + * + * Minecraft Overviewer is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Minecraft Overviewer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the Overviewer. If not, see . + */ + +#ifndef __BLOCK_CLASS_H_INCLUDED__ +#define __BLOCK_CLASS_H_INCLUDED__ + +#include +#include + +#include "mc_id.h" + +bool block_class_is_subset( + mc_block_t block, + const mc_block_t block_class[], + size_t block_class_len +); + +extern const mc_block_t block_class_stair[]; +extern const size_t block_class_stair_len; + +extern const mc_block_t block_class_door[]; +extern const size_t block_class_door_len; + +extern const mc_block_t block_class_fence[]; +extern const size_t block_class_fence_len; + +extern const mc_block_t block_class_fence_gate[]; +extern const size_t block_class_fence_gate_len; + +extern const mc_block_t block_class_ancil[]; +extern const size_t block_class_ancil_len; + +extern const mc_block_t block_class_alt_height[]; +extern const size_t block_class_alt_height_len; + #endif \ No newline at end of file diff --git a/overviewer_core/src/primitives/base.c b/overviewer_core/src/primitives/base.c index cf10e9d..0cc4915 100644 --- a/overviewer_core/src/primitives/base.c +++ b/overviewer_core/src/primitives/base.c @@ -125,23 +125,25 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec /* grass needs a special facemask */ facemask = self->grass_texture; } - - switch (state->block) { - case block_grass: - case block_tallgrass: - case block_pumpkin_stem: - case block_melon_stem: - case block_vine: - case block_waterlily: - case block_double_plant: + if(block_class_is_subset(state->block,(mc_block_t[]){ + block_grass, + block_tallgrass, + block_pumpkin_stem, + block_melon_stem, + block_vine, + block_waterlily, + block_double_plant + },7)) { color_table = self->grasscolor; - break; - case block_flowing_water: - case block_water: + } + else if(block_class_is_subset(state->block,(mc_block_t[]){ + block_flowing_water,block_water + },2)) { color_table = self->watercolor; - break; - case block_leaves: - case block_leaves2: + } + else if(block_class_is_subset(state->block,(mc_block_t[]){ + block_leaves,block_leaves2 + },2)) { color_table = self->foliagecolor; if (state->block_data == 2) { @@ -149,10 +151,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec birch foliage color is flipped XY-ways */ flip_xy = 1; } - break; - default: - break; - }; + } if (color_table) { unsigned char biome;