Mercurial > hg > batmud > maputils
changeset 1736:7a2d618f77d2
Various minor code cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 18 Oct 2017 13:25:48 +0300 |
parents | 07b751b6c036 |
children | 2b8841f9dbfd |
files | colormap.c mkloc.c |
diffstat | 2 files changed, 9 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/colormap.c Wed Oct 18 11:17:53 2017 +0300 +++ b/colormap.c Wed Oct 18 13:25:48 2017 +0300 @@ -341,7 +341,7 @@ /* Process a normal format input */ -BOOL processNormal(FILE *inFile, FILE *outFile, CMapOutFormat *fmt) +BOOL processData(FILE *inFile, FILE *outFile, CMapOutFormat *fmt) { int k, c, p; @@ -494,15 +494,13 @@ void argShowHelp(void) { - int i; - th_print_banner(stdout, th_prog_name, "[options] <input mapfile>"); th_args_help(stdout, optList, optListN, 0); fprintf(stdout, "\nAvailable OUTPUT formats:\n"); - for (i = 0; i < noutputFormats; i++) + for (int i = 0; i < noutputFormats; i++) { fprintf(stdout, " %-8s - %s %s\n", outputFormats[i].fmtName, @@ -746,7 +744,7 @@ if (!optNoHeaders && fmt->putFileStart) fmt->putFileStart(outFile); - processNormal(inFile, outFile, fmt); + processData(inFile, outFile, fmt); if (!optNoHeaders && fmt->putFileEnd) fmt->putFileEnd(outFile);
--- a/mkloc.c Wed Oct 18 11:17:53 2017 +0300 +++ b/mkloc.c Wed Oct 18 13:25:48 2017 +0300 @@ -502,30 +502,18 @@ if ((n = locFindByCoords(l, x, y, TRUE)) >= 0) { LocMarker *tmp = l->locations[n]; + char chm = dp[x]; switch (tmp->flags & LOCF_M_MASK) { - case LOCF_M_SCENIC1: - fputc('?', outFile); - break; - - case LOCF_M_SCENIC2: - fputc('%', outFile); - break; - - case LOCF_M_PCITY: - fputc('C', outFile); - break; - - case LOCF_M_CITY: - fputc('c', outFile); - break; + case LOCF_M_SCENIC1: chm = '?'; break; + case LOCF_M_SCENIC2: chm = '%'; break; + case LOCF_M_PCITY: chm = 'C'; break; + case LOCF_M_CITY: chm = 'c'; break; default: if (tmp->flags & LOCF_INVALID) - fputc('$', outFile); - else - fputc(dp[x], outFile); + chm = '$'; break; }