Mercurial > hg > batmud > maputils
changeset 987:d72c12389f9a
Change origo in loc-file input and output to (1,1) from (0,0). GMaps etc. output remains (0,0) based now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 15 Jun 2010 22:30:29 +0000 |
parents | 22752c2e90ff |
children | ed68b2fa266d |
files | mkloc.c |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mkloc.c Tue Jun 15 04:22:21 2010 +0000 +++ b/mkloc.c Tue Jun 15 22:30:29 2010 +0000 @@ -935,10 +935,17 @@ case 8: /* Freeform */ tmpStr = parseFieldString(f, "\r\n"); + + /* Check coordinates */ + if (tmpX < 1 || tmpY < 1) { + THERR("Invalid X or Y coordinate (%d, %d), for location '%s' on line #%d of '%s'. Must be > 0.\n", + tmpX, tmpY, tmpLocNames[0], f->lineNum, f->filename); + state = STATE_ERROR; + } /* Check if location already exists */ - tmpX += offX; - tmpY += offY; + tmpX = tmpX + offX - 1; + tmpY = tmpY + offY - 1; i = findLocationByCoords(l, tmpX, tmpY, TRUE); if (i >= 0) { @@ -1352,7 +1359,7 @@ } fprintf(outFile, "%d\t; %d\t; %d", - tmp->ox, tmp->oy, tmp->dir); + tmp->ox + 1, tmp->oy + 1, tmp->dir); switch (tmp->flags & LOCF_M_MASK) { case LOCF_M_SCENIC1: fputc('?', outFile); break; @@ -1694,7 +1701,7 @@ th_memset(&worldLoc, 0, sizeof(worldLoc)); /* Initialize */ - th_init("mkloc", "Manipulate and convert location files and ASCII map data", "1.4", NULL, NULL); + th_init("mkloc", "Manipulate and convert location files and ASCII map data", "1.5", NULL, NULL); th_verbosityLevel = 0; /* Parse arguments */