diff options
author | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 16:12:47 +0000 |
---|---|---|
committer | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 16:12:47 +0000 |
commit | 701445766d42a37febf833b95714511be2da4793 (patch) | |
tree | a3c3827071101c2a4481a4df23350bf03bd646a7 /src | |
parent | c8c0d0ac861802f29de2d294c2b33f7b70fd7746 (diff) |
make parser more robust
make parser more robust
Diffstat (limited to 'src')
-rw-r--r-- | src/Hill.cxx | 17 | ||||
-rw-r--r-- | src/Panorama.cxx | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/Hill.cxx b/src/Hill.cxx index 6df8d34..5dbe226 100644 --- a/src/Hill.cxx +++ b/src/Hill.cxx @@ -1,5 +1,5 @@ // -// "$Id: Hill.cxx,v 1.13 2005/05/10 17:16:54 hofmann Exp $" +// "$Id: Hill.cxx,v 1.14 2005/05/10 18:12:47 hofmann Exp $" // // Hill routines. // @@ -83,18 +83,21 @@ Hills::load(const char *file) { while (fgets(buf, sizeof(buf), fp)) { bp = buf; + memset(vals, 0, sizeof(vals)); for (ap = vals; (*ap = strsep(&bp, ",")) != NULL;) if (++ap >= &vals[10]) break; - phi = atof(vals[3]) * deg2rad; - lam = atof(vals[4]) * deg2rad; - - height = atof(vals[5]); + if (vals[1] && vals[3] && vals[4] && vals[5]) { + phi = atof(vals[3]) * deg2rad; + lam = atof(vals[4]) * deg2rad; + + height = atof(vals[5]); - m = new Hill(vals[1], phi, lam, height); + m = new Hill(vals[1], phi, lam, height); - add(m); + add(m); + } } fclose(fp); diff --git a/src/Panorama.cxx b/src/Panorama.cxx index f100a95..fcc8836 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -1,5 +1,5 @@ // -// "$Id: Panorama.cxx,v 1.39 2005/05/10 17:57:11 hofmann Exp $" +// "$Id: Panorama.cxx,v 1.40 2005/05/10 18:12:47 hofmann Exp $" // // Panorama routines. // @@ -187,7 +187,6 @@ Panorama::guess(Hills *p, Hill *m1) { a_nick = a_nick_best; a_tilt = a_tilt_best; scale = scale_best; - fprintf(stderr, "best %f\n", best); } else { fprintf(stderr, "No solution found.\n"); } |