Mercurial > molko
comparison librpg/rpg/map-file.c @ 227:befa2e855d3b
core: reinterface the alloc module
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 19 Nov 2020 10:48:46 +0100 |
parents | 64f24b482722 |
children | 76afe639fd72 |
comparison
equal
deleted
inserted
replaced
226:dd7c8d4321a3 | 227:befa2e855d3b |
---|---|
64 | 64 |
65 /* | 65 /* |
66 * The next line after a layer declaration is a list of plain integer | 66 * The next line after a layer declaration is a list of plain integer |
67 * that fill the layer tiles. | 67 * that fill the layer tiles. |
68 */ | 68 */ |
69 if (!(ctx->mf->layers[layer_type].tiles = alloc_zero(amount, sizeof (unsigned short)))) | 69 if (!(ctx->mf->layers[layer_type].tiles = alloc_array0(amount, sizeof (unsigned short)))) |
70 return false; | 70 return false; |
71 | 71 |
72 for (int tile; fscanf(ctx->fp, "%d\n", &tile) && current < amount; ++current) | 72 for (int tile; fscanf(ctx->fp, "%d\n", &tile) && current < amount; ++current) |
73 ctx->mf->layers[layer_type].tiles[current] = tile; | 73 ctx->mf->layers[layer_type].tiles[current] = tile; |
74 | 74 |