From a1dc392526bd30d4a5710972d4dd9cd92c3d6de6 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Mon, 2 Jan 2012 00:40:56 -0500 Subject: [PATCH] c_overviewer is now auto-initialized, and some other minor fixes --- overviewer_core/settingsValidators.py | 2 +- overviewer_core/src/iterate.c | 2 +- overviewer_core/src/main.c | 9 +++++++-- overviewer_core/src/overviewer.h | 2 +- test/test_settings.py | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/overviewer_core/settingsValidators.py b/overviewer_core/settingsValidators.py index 918e7c4..3398e31 100644 --- a/overviewer_core/settingsValidators.py +++ b/overviewer_core/settingsValidators.py @@ -70,7 +70,7 @@ def validateBGColor(color): r = int(color[1:3], 16) g = int(color[3:5], 16) b = int(color[5:7], 16) - return (r,g,b) + return (r,g,b,0) def validateOptImg(opt): diff --git a/overviewer_core/src/iterate.c b/overviewer_core/src/iterate.c index 1a73115..da30595 100644 --- a/overviewer_core/src/iterate.c +++ b/overviewer_core/src/iterate.c @@ -29,7 +29,7 @@ static PyObject *solid_blocks = NULL; static PyObject *fluid_blocks = NULL; static PyObject *nospawn_blocks = NULL; -PyObject *init_chunk_render(PyObject *self, PyObject *args) { +PyObject *init_chunk_render(void) { PyObject *tmp = NULL; unsigned int i; diff --git a/overviewer_core/src/main.c b/overviewer_core/src/main.c index b2578e8..ca14065 100644 --- a/overviewer_core/src/main.c +++ b/overviewer_core/src/main.c @@ -30,8 +30,6 @@ static PyMethodDef COverviewerMethods[] = { {"alpha_over", alpha_over_wrap, METH_VARARGS, "alpha over composite function"}, - {"init_chunk_render", init_chunk_render, METH_VARARGS, - "Initializes the stuffs renderer."}, {"render_loop", chunk_render, METH_VARARGS, "Renders stuffs"}, @@ -63,6 +61,13 @@ initc_overviewer(void) /* for numpy */ 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 * so that the Python garbage collector doesn't freak out diff --git a/overviewer_core/src/overviewer.h b/overviewer_core/src/overviewer.h index b3006b4..f6025f6 100644 --- a/overviewer_core/src/overviewer.h +++ b/overviewer_core/src/overviewer.h @@ -93,7 +93,7 @@ typedef struct { PyObject *left_blocks; PyObject *right_blocks; } RenderState; -PyObject *init_chunk_render(PyObject *self, PyObject *args); +PyObject *init_chunk_render(void); PyObject *chunk_render(PyObject *self, PyObject *args); typedef enum { diff --git a/test/test_settings.py b/test/test_settings.py index 2582922..c4010cf 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -14,7 +14,7 @@ class SettingsTest(unittest.TestCase): s.validate() things = s.get_render_things() # 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): s = configParser.MultiWorldParser("test/data/settings/settings_test_rendermode.py")