0

Implement standard C boolean type

This commit is contained in:
Wunkolo
2019-06-25 14:19:12 -07:00
parent d738c21852
commit 5b212dc585
26 changed files with 216 additions and 225 deletions

View File

@@ -121,14 +121,14 @@ static inline void load_chunk_section(ChunkData* dest, int32_t i, PyObject* sect
* if required is true, failure to load the chunk will raise a python
* exception and return true.
*/
int32_t load_chunk(RenderState* state, int32_t x, int32_t z, uint8_t required) {
bool load_chunk(RenderState* state, int32_t x, int32_t z, uint8_t required) {
ChunkData* dest = &(state->chunks[1 + x][1 + z]);
int32_t i;
PyObject* chunk = NULL;
PyObject* sections = NULL;
if (dest->loaded)
return 0;
return false;
/* set up reasonable defaults */
dest->biomes = NULL;
@@ -150,7 +150,7 @@ int32_t load_chunk(RenderState* state, int32_t x, int32_t z, uint8_t required) {
if (!required) {
PyErr_Clear();
}
return 1;
return true;
}
sections = PyDict_GetItemString(chunk, "Sections");
@@ -163,7 +163,7 @@ int32_t load_chunk(RenderState* state, int32_t x, int32_t z, uint8_t required) {
if (!required) {
PyErr_Clear();
}
return 1;
return true;
}
dest->biomes = (PyArrayObject*)PyDict_GetItemString(chunk, "Biomes");
@@ -184,7 +184,7 @@ int32_t load_chunk(RenderState* state, int32_t x, int32_t z, uint8_t required) {
Py_DECREF(sections);
Py_DECREF(chunk);
return 0;
return false;
}
/* helper to unload all loaded chunks */