]> git.mxchange.org Git - flightgear.git/commitdiff
Initialization fixes.
authordavid <david>
Sat, 29 Dec 2001 13:19:09 +0000 (13:19 +0000)
committerdavid <david>
Sat, 29 Dec 2001 13:19:09 +0000 (13:19 +0000)
src/Objects/newmat.cxx
src/Objects/newmat.hxx

index 39da01c3964692fc079ced059fb41edec8c491cf..d2b1674e4090094dcb5b39f488d692fbd757eae8 100644 (file)
@@ -52,42 +52,41 @@ local_file_exists( const string& path ) {
 }
 
 
-// Constructor
-
-FGNewMat::FGNewMat ()
-  : texture_path(""),
-    state(0),
-    textured(0),
-    nontextured(0),
-    alpha(false),
-    xsize(0),
-    ysize(0),
-    wrapu(true),
-    wrapv(true),
-    mipmap(true),
-    texture_loaded(false),
-    refcount(0)
+void 
+FGNewMat::init ()
 {
-    for (int i = 0; i < 4; i++)
-      ambient[i] = diffuse[i] = specular[i] = emission[i] = 0.0;
+  texture_path = "";
+  state = 0;
+  textured = 0;
+  nontextured = 0;
+  alpha = false;
+  xsize = 0;
+  ysize = 0;
+  wrapu = true;
+  wrapv = true;
+  mipmap = true;
+  texture_loaded = false;
+  refcount = 0;
+  for (int i = 0; i < 4; i++)
+    ambient[i] = diffuse[i] = specular[i] = emission[i] = 0.0;
 }
 
 FGNewMat::FGNewMat (const SGPropertyNode * props)
 {
-    FGNewMat();
+    init();
     read_properties(props);
     build_ssg_state(false);
 }
 
 FGNewMat::FGNewMat (const string &texture_path)
 {
-    FGNewMat();
+    init();
     build_ssg_state(true);
 }
 
 FGNewMat::FGNewMat (ssgSimpleState * s)
 {
-    FGNewMat();
+    init();
     set_ssg_state(s);
 }
 
index 28199619e07d73661def82eba81bf5cafd552b8f..0aaee654f6e7feec0cc284a821524a78a2712570 100644 (file)
@@ -170,6 +170,18 @@ public:
    */
   virtual inline int getRef() const { return refcount; }
 
+protected:
+
+\f
+  ////////////////////////////////////////////////////////////////////
+  // Protected methods.
+  ////////////////////////////////////////////////////////////////////
+
+  /**
+   * Initialization method, invoked by all public constructors.
+   */
+  virtual void init();
+
 
 private:
 
@@ -217,7 +229,6 @@ private:
   // Internal constructors and methods.
   ////////////////////////////////////////////////////////////////////
 
-  FGNewMat ();
   FGNewMat (const FGNewMat &mat); // unimplemented
 
   void read_properties (const SGPropertyNode * props);