0

Merge remote-tracking branch 'origin/master' into brownan-chunkscan

Conflicts:
	overviewer.py
This commit is contained in:
Andrew Brown
2011-11-26 16:58:27 -05:00
6 changed files with 117 additions and 51 deletions

View File

@@ -214,7 +214,7 @@ class QuadtreeGen(object):
curdepth = self._get_cur_depth()
if curdepth != -1:
if self.p > curdepth:
logging.warning("Your map seemes to have expanded beyond its previous bounds.")
logging.warning("Your map seems to have expanded beyond its previous bounds.")
logging.warning( "Doing some tile re-arrangements... just a sec...")
for _ in xrange(self.p-curdepth):
self._increase_depth()

View File

@@ -47,7 +47,7 @@ PyObject *init_chunk_render(PyObject *self, PyObject *args) {
if ((!textures)) {
return NULL;
}
chunk_mod = PyImport_ImportModule("overviewer_core.chunk");
/* ensure none of these pointers are NULL */
if ((!chunk_mod)) {
@@ -62,10 +62,13 @@ PyObject *init_chunk_render(PyObject *self, PyObject *args) {
if (!tmp)
return NULL;
max_blockid = PyInt_AsLong(tmp);
Py_DECREF(tmp);
tmp = PyObject_GetAttrString(textures, "max_data");
if (!tmp)
return NULL;
max_data = PyInt_AsLong(tmp);
Py_DECREF(tmp);
/* assemble the property table */
known_blocks = PyObject_GetAttrString(textures, "known_blocks");
@@ -101,7 +104,7 @@ PyObject *init_chunk_render(PyObject *self, PyObject *args) {
Py_DECREF(block);
}
Py_RETURN_NONE;
}
@@ -370,7 +373,8 @@ chunk_render(PyObject *self, PyObject *args) {
state.rendermode = rendermode = render_mode_create(PyString_AsString(rendermode_py), &state);
Py_DECREF(rendermode_py);
if (rendermode == NULL) {
return NULL;
return NULL; // note that render_mode_create will
// set PyErr. No need to set it here
}
/* get the image size */

View File

@@ -106,13 +106,13 @@ render_mode_find_interface(const char *mode) {
/* check for custom modes */
custom = PyDict_GetItemString(custom_render_modes, mode);
if (custom == NULL)
return NULL;
return PyErr_Format(PyExc_RuntimeError, "Failed to find rendermode interface (custom not found)");
custom = PyDict_GetItemString(custom, "parent");
if (custom == NULL)
return NULL;
return PyErr_Format(PyExc_RuntimeError, "Failed to find rendermode interface (parent not found)");
custom_parent = PyString_AsString(custom);
if (custom_parent == NULL)
return NULL;
return NULL; // PyString_AsString sets an exception
return render_mode_find_interface(custom_parent);
}
@@ -133,14 +133,14 @@ RenderMode *render_mode_create(const char *mode, RenderState *state) {
ret = calloc(1, sizeof(RenderMode));
if (ret == NULL) {
Py_DECREF(options);
return NULL;
return PyErr_Format(PyExc_RuntimeError, "Failed to alloc a rendermode");
}
ret->mode = calloc(1, iface->data_size);
if (ret->mode == NULL) {
Py_DECREF(options);
free(ret);
return NULL;
return PyErr_Format(PyExc_RuntimeError, "Failed to alloc rendermode data");
}
ret->iface = iface;
@@ -156,7 +156,7 @@ RenderMode *render_mode_create(const char *mode, RenderState *state) {
Py_DECREF(options);
return ret;
}
void render_mode_destroy(RenderMode *self) {
self->iface->finish(self->mode, self->state);
free(self->mode);