Mercurial > hg > batmud > maputils
changeset 1865:e84f37f49c03
Move mapBlockPrint() closer to mapBlockPrintRaw(), etc.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 03 Nov 2017 23:48:53 +0200 |
parents | e5b1e2e75fdc |
children | d575c74e049b |
files | libmaputils.c |
diffstat | 1 files changed, 21 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/libmaputils.c Thu Nov 02 19:54:23 2017 +0200 +++ b/libmaputils.c Fri Nov 03 23:48:53 2017 +0200 @@ -687,30 +687,6 @@ } -/* Print block to given output stream - */ -void mapBlockPrint(FILE *fh, const MapBlock *map) -{ - assert(fh != NULL); - assert(map != NULL); - - for (int y = 0; y < map->height; y++) - { - unsigned char *c = map->data + (y * map->scansize); - for (int x = 0; x < map->width; x++) - { - if (*c > 0) - fputc(*c, fh); - else - fputc(' ', fh); - - c++; - } - fprintf(fh, "\n"); - } -} - - /* Blit a block into another, assume that memory has been allocated * in sufficient way and other preparations are done. */ @@ -811,6 +787,26 @@ } +/* Print block to given output stream + */ +void mapBlockPrint(FILE *fh, const MapBlock *map) +{ + assert(fh != NULL); + assert(map != NULL); + + for (int y = 0; y < map->height; y++) + { + unsigned char *c = map->data + (y * map->scansize); + for (int x = 0; x < map->width; x++) + { + fputc(*c > 0 ? *c : ' ', fh); + c++; + } + fprintf(fh, "\n"); + } +} + + void mapBlockPrintRaw(FILE *fh, const MapBlock *map) { assert(fh != NULL); @@ -820,10 +816,7 @@ { unsigned char *dp = map->data + (y * map->scansize); for (int x = 0; x < map->width; x++) - { - fputc(*dp, fh); - dp++; - } + fputc(*dp++, fh); fputc(0xff, fh); }