Mercurial > hg > batmud > maputils
changeset 1851:19ce47b9a297
Move mapStrChr() to libmaputils as muStrChr().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 01 Nov 2017 12:49:02 +0200 |
parents | 8e0979837090 |
children | 83474d274310 |
files | libmaputils.c libmaputils.h mapsearch.c |
diffstat | 3 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libmaputils.c Wed Nov 01 11:54:08 2017 +0200 +++ b/libmaputils.c Wed Nov 01 12:49:02 2017 +0200 @@ -463,6 +463,16 @@ } +BOOL muStrChr(const unsigned char *symbols, const size_t nsymbols, const unsigned char ch) +{ + for (size_t n = 0; n < nsymbols; n++) + if (symbols[n] == ch) + return TRUE; + + return FALSE; +} + + /* Map block handling */ MapBlock * mapBlockAlloc(const int width, const int height)
--- a/libmaputils.h Wed Nov 01 11:54:08 2017 +0200 +++ b/libmaputils.h Wed Nov 01 12:49:02 2017 +0200 @@ -111,6 +111,7 @@ void muPrintHTMLcolors(FILE *outFile, const char *tagName, const char *propName, const char *extra); char * muColorToCSSColor(char *buf, const size_t len, const int c); int muCopyFileToStream(FILE *outFile, const char *filename); +BOOL muStrChr(const unsigned char *symbols, const size_t nsymbols, const unsigned char ch); /* Mapblock handling
--- a/mapsearch.c Wed Nov 01 11:54:08 2017 +0200 +++ b/mapsearch.c Wed Nov 01 12:49:02 2017 +0200 @@ -528,16 +528,6 @@ } -BOOL mapStrChr(const unsigned char *symbols, const size_t nsymbols, const unsigned char ch) -{ - for (size_t n = 0; n < nsymbols; n++) - if (symbols[n] == ch) - return TRUE; - - return FALSE; -} - - BOOL mapBlockFindCenter(const MapBlock *block, const unsigned char *symbols, const size_t nsymbols, int *cx, int *cy, const int tolerance) { const int @@ -554,7 +544,7 @@ { if (xc >= x0 && xc <= x1 && yc >= y0 && yc <= y1 && - mapStrChr(symbols, nsymbols, dp[xc])) + muStrChr(symbols, nsymbols, dp[xc])) { *cx = xc; *cy = yc;