~ubuntu-branches/ubuntu/intrepid/glbsp/intrepid

« back to all changes in this revision

Viewing changes to nodeview/path.cc

  • Committer: Bazaar Package Importer
  • Author(s): Darren Salt
  • Date: 2008-01-30 13:33:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080130133349-kgojg33vyiu8xbvp
Tags: 2.24-1
* New upstream release.
* Bumped the lib soname and the library package name due to one silly
  little binary incompatibility caused by changes in an exported struct.
  (Safe; nothing else currently in the archive has ever used libglbsp2.)
* Removed my patches since they're all applied upstream.
* Updated the list of documentation files.
* Build-time changes:
  - Switched from dh_movefiles to dh_install.
  - Updated my makefile to cope with upstream changes.
  - Corrected for debian-rules-ignores-make-clean-error.
  - Corrected for substvar-source-version-is-deprecated.
  - Link libglbsp, rather than glbsp, with libm and libz.
* Fixed shlibdeps. (Closes: #460387)
* Bumped standards version to 3.7.3 (no other changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------
 
2
//  PATH : storage for path points
 
3
//------------------------------------------------------------------------
 
4
//
 
5
//  GL-Node Viewer (C) 2004-2007 Andrew Apted
 
6
//
 
7
//  This program is free software; you can redistribute it and/or
 
8
//  modify it under the terms of the GNU General Public License
 
9
//  as published by the Free Software Foundation; either version 2
 
10
//  of the License, or (at your option) any later version.
 
11
//
 
12
//  This program is distributed in the hope that it will be useful,
 
13
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
//  GNU General Public License for more details.
 
16
//
 
17
//------------------------------------------------------------------------
 
18
 
 
19
// this includes everything we need
 
20
#include "defs.h"
 
21
 
 
22
//
 
23
// Path Constructor
 
24
//
 
25
path_c::path_c() : point_num(0), points(NULL)
 
26
{
 
27
}
 
28
 
 
29
//
 
30
// Path Destructor
 
31
//
 
32
path_c::~path_c()
 
33
{
 
34
  if (points)
 
35
    delete[] points;
 
36
}
 
37
 
 
38
//
 
39
// Path Reading
 
40
//
 
41
path_c * path_c::ReadFile(const char *filename)
 
42
{
 
43
  FILE *fp = fopen(filename, "r");
 
44
 
 
45
  if (! fp)
 
46
  {
 
47
    PrintWarn("Unable to open path file: %s\n", strerror(errno));
 
48
    return false;
 
49
  }
 
50
 
 
51
  path_c *P = new path_c();
 
52
 
 
53
  P->points = new int[MAX_PTS * 2];
 
54
 
 
55
  for (P->point_num = 0; P->point_num < MAX_PTS; P->point_num++)
 
56
  {
 
57
    int *cur_pt = P->points + (P->point_num * 2);
 
58
 
 
59
    if (fscanf(fp, " %d %d ", cur_pt, cur_pt+1) != 2)
 
60
      break;
 
61
  }
 
62
 
 
63
  fclose(fp);
 
64
 
 
65
  return P;
 
66
}
 
67