0

c_overviewer is now auto-initialized, and some other minor fixes

This commit is contained in:
Aaron Griffith
2012-01-02 00:40:56 -05:00
parent fbb5230849
commit a1dc392526
5 changed files with 11 additions and 6 deletions

View File

@@ -70,7 +70,7 @@ def validateBGColor(color):
r = int(color[1:3], 16) r = int(color[1:3], 16)
g = int(color[3:5], 16) g = int(color[3:5], 16)
b = int(color[5:7], 16) b = int(color[5:7], 16)
return (r,g,b) return (r,g,b,0)
def validateOptImg(opt): def validateOptImg(opt):

View File

@@ -29,7 +29,7 @@ static PyObject *solid_blocks = NULL;
static PyObject *fluid_blocks = NULL; static PyObject *fluid_blocks = NULL;
static PyObject *nospawn_blocks = NULL; static PyObject *nospawn_blocks = NULL;
PyObject *init_chunk_render(PyObject *self, PyObject *args) { PyObject *init_chunk_render(void) {
PyObject *tmp = NULL; PyObject *tmp = NULL;
unsigned int i; unsigned int i;

View File

@@ -30,8 +30,6 @@ static PyMethodDef COverviewerMethods[] = {
{"alpha_over", alpha_over_wrap, METH_VARARGS, {"alpha_over", alpha_over_wrap, METH_VARARGS,
"alpha over composite function"}, "alpha over composite function"},
{"init_chunk_render", init_chunk_render, METH_VARARGS,
"Initializes the stuffs renderer."},
{"render_loop", chunk_render, METH_VARARGS, {"render_loop", chunk_render, METH_VARARGS,
"Renders stuffs"}, "Renders stuffs"},
@@ -63,6 +61,13 @@ initc_overviewer(void)
/* for numpy */ /* for numpy */
import_array(); import_array();
/* initialize, and return if error is set */
if (!init_chunk_render()) {
PyErr_Print();
exit(1);
return;
}
/* create the render mode data structures, and attatch them to the module /* create the render mode data structures, and attatch them to the module
* so that the Python garbage collector doesn't freak out * so that the Python garbage collector doesn't freak out

View File

@@ -93,7 +93,7 @@ typedef struct {
PyObject *left_blocks; PyObject *left_blocks;
PyObject *right_blocks; PyObject *right_blocks;
} RenderState; } RenderState;
PyObject *init_chunk_render(PyObject *self, PyObject *args); PyObject *init_chunk_render(void);
PyObject *chunk_render(PyObject *self, PyObject *args); PyObject *chunk_render(PyObject *self, PyObject *args);
typedef enum typedef enum
{ {

View File

@@ -14,7 +14,7 @@ class SettingsTest(unittest.TestCase):
s.validate() s.validate()
things = s.get_render_things() things = s.get_render_things()
# no exceptions so far. that's good # no exceptions so far. that's good
self.assertEquals(things['world']['bgcolor'], (26,26,26)) self.assertEquals(things['world']['bgcolor'], (26,26,26,0))
def test_rendermode_validation(self): def test_rendermode_validation(self):
s = configParser.MultiWorldParser("test/data/settings/settings_test_rendermode.py") s = configParser.MultiWorldParser("test/data/settings/settings_test_rendermode.py")