0

Fix deprecated NumPy API warnings

This commit is contained in:
Nicolas F
2017-03-09 17:28:18 +01:00
parent 2add96132c
commit d76a22e020
2 changed files with 18 additions and 16 deletions

View File

@@ -104,10 +104,10 @@ PyObject *init_chunk_render(void) {
/* helper for load_chunk, loads a section into a chunk */
static inline void load_chunk_section(ChunkData *dest, int i, PyObject *section) {
dest->sections[i].blocks = PyDict_GetItemString(section, "Blocks");
dest->sections[i].data = PyDict_GetItemString(section, "Data");
dest->sections[i].skylight = PyDict_GetItemString(section, "SkyLight");
dest->sections[i].blocklight = PyDict_GetItemString(section, "BlockLight");
dest->sections[i].blocks = (PyArrayObject*) PyDict_GetItemString(section, "Blocks");
dest->sections[i].data = (PyArrayObject*) PyDict_GetItemString(section, "Data");
dest->sections[i].skylight = (PyArrayObject*) PyDict_GetItemString(section, "SkyLight");
dest->sections[i].blocklight = (PyArrayObject*) PyDict_GetItemString(section, "BlockLight");
Py_INCREF(dest->sections[i].blocks);
Py_INCREF(dest->sections[i].data);
Py_INCREF(dest->sections[i].skylight);
@@ -166,7 +166,7 @@ int load_chunk(RenderState* state, int x, int z, unsigned char required) {
return 1;
}
dest->biomes = PyDict_GetItemString(chunk, "Biomes");
dest->biomes = (PyArrayObject*) PyDict_GetItemString(chunk, "Biomes");
Py_INCREF(dest->biomes);
for (i = 0; i < PySequence_Fast_GET_SIZE(sections); i++) {
@@ -586,11 +586,11 @@ chunk_render(PyObject *self, PyObject *args) {
PyObject *imgsize, *imgsize0_py, *imgsize1_py;
int imgsize0, imgsize1;
PyObject *blocks_py;
PyObject *left_blocks_py;
PyObject *right_blocks_py;
PyObject *up_left_blocks_py;
PyObject *up_right_blocks_py;
PyArrayObject *blocks_py;
PyArrayObject *left_blocks_py;
PyArrayObject *right_blocks_py;
PyArrayObject *up_left_blocks_py;
PyArrayObject *up_right_blocks_py;
RenderMode *rendermode;

View File

@@ -28,10 +28,12 @@
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
// increment this value if you've made a change to the c extesion
// and want to force users to rebuild
#define OVERVIEWER_EXTENSION_VERSION 51
#define OVERVIEWER_EXTENSION_VERSION 52
/* Python PIL, and numpy headers */
#include <Python.h>
@@ -88,11 +90,11 @@ typedef struct {
/* whether this chunk is loaded: use load_chunk to load */
int loaded;
/* chunk biome array */
PyObject *biomes;
PyArrayObject *biomes;
/* all the sections in a given chunk */
struct {
/* all there is to know about each section */
PyObject *blocks, *data, *skylight, *blocklight;
PyArrayObject *blocks, *data, *skylight, *blocklight;
} sections[SECTIONS_PER_CHUNK];
} ChunkData;
typedef struct {
@@ -118,8 +120,8 @@ typedef struct {
unsigned short block_pdata;
/* useful information about this, and neighboring, chunks */
PyObject *blockdatas;
PyObject *blocks;
PyArrayObject *blockdatas;
PyArrayObject *blocks;
/* 3x3 array of this and neighboring chunk columns */
ChunkData chunks[3][3];
@@ -168,7 +170,7 @@ typedef enum
static inline unsigned int get_data(RenderState *state, DataType type, int x, int y, int z)
{
int chunkx = 1, chunky = state->chunky, chunkz = 1;
PyObject *data_array = NULL;
PyArrayObject *data_array = NULL;
unsigned int def = 0;
if (type == SKYLIGHT)
def = 15;