diff options
| author | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 15:16:54 +0000 |
|---|---|---|
| committer | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 15:16:54 +0000 |
| commit | 5e674225ec1d8ff0563030a27fb69f8e89d3ebf3 (patch) | |
| tree | 4eb2713d497f0132bba4fe163fcead4c1098b009 /src/Panorama.cxx | |
| parent | 2ff3057cf1de8695f2fc6cf5c17a3d074e983017 (diff) | |
move file loading to Hills.cxx
move file loading to Hills.cxx
Diffstat (limited to 'src/Panorama.cxx')
| -rw-r--r-- | src/Panorama.cxx | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 38f2037..a9ab97b 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -1,5 +1,5 @@ // -// "$Id: Panorama.cxx,v 1.37 2005/05/10 17:06:50 hofmann Exp $" +// "$Id: Panorama.cxx,v 1.38 2005/05/10 17:16:54 hofmann Exp $" // // Panorama routines. // @@ -69,43 +69,16 @@ Panorama::~Panorama() { delete(mountains); } + int Panorama::load_file(const char *name) { - FILE *fp; - char buf[4000]; - char *vals[10]; - char **ap, *bp; - double phi, lam, height; - Hill *m; - visible_mountains->clear(); mountains->clobber(); - - - fp = fopen(name, "r"); - if (!fp) { - perror("fopen"); - return 1; - } - while (fgets(buf, sizeof(buf), fp)) { - bp = buf; - 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]); - - m = new Hill(vals[1], phi, lam, height); - - mountains->add(m); + if (mountains->load(name) != 0) { + return 1; } - fclose(fp); - update_angles(); return 0; |
