]> git.jsancho.org Git - lugaru.git/commitdiff
Fixed compiler warnings about taking the address of a temporary.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 15 May 2010 06:50:03 +0000 (02:50 -0400)
committerRyan C. Gordon <icculus@icculus.org>
Sat, 15 May 2010 06:50:03 +0000 (02:50 -0400)
Source/Person.cpp
Source/Quaternions.h

index 388f787891bdefac4cf35e26175a7380f6eef0da..6a1def9bf91bff686c2d975bb43dd22f7e63a386 100644 (file)
@@ -6449,7 +6449,7 @@ void      Person::DoStuff(){
 
                                        flatfacing=DoRotation(flatfacing,0,rotation,0);
                                        facing=flatfacing;
-                                       ReflectVector(&facing,&terrainnormal);
+                                       ReflectVector(&facing,terrainnormal);
                                        Normalise(&facing);
 
                                        if(isRun()||targetanimation==sneakanim||targetanimation==rollanim||targetanimation==walkanim){
@@ -6502,7 +6502,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed;
                                        }
@@ -6516,7 +6516,7 @@ void      Person::DoStuff(){
                                                                velocity*=velspeed;
                                                        }
                                                        velocity.y+=gravity*multiplier*20;
-                                                       ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                                       ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                        velspeed=findLength(&velocity);
                                                        if(velspeed<speed*30*scale)velspeed=speed*30*scale;
                                                        velocity=flatfacing*velspeed;
@@ -6540,7 +6540,7 @@ void      Person::DoStuff(){
                                                        }
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed;
                                        }
@@ -6555,7 +6555,7 @@ void      Person::DoStuff(){
                                        velocity*=velspeed;
                                        }
                                        velocity.y+=gravity*multiplier*20;
-                                       ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                       ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                        velspeed=findLength(&velocity);
                                        velocity=flatfacing*velspeed;
                                        }*/
@@ -6569,7 +6569,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed;
                                        }
@@ -6584,7 +6584,7 @@ void      Person::DoStuff(){
                                        velocity*=velspeed;
                                        }
                                        velocity.y+=gravity*multiplier*20;
-                                       ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                       ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                        velspeed=findLength(&velocity);
                                        velocity=flatfacing*velspeed;
                                        }*/
@@ -6598,7 +6598,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed;
                                        }
@@ -6612,7 +6612,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed;
                                        }
@@ -6627,7 +6627,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed*-1;
                                        }
@@ -6641,7 +6641,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=DoRotation(flatfacing*velspeed,0,-90,0);
                                        }
@@ -6665,7 +6665,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed*-1;
                                        }
@@ -6679,7 +6679,7 @@ void      Person::DoStuff(){
                                                        velocity*=velspeed;
                                                }
                                                velocity.y+=gravity*multiplier*20;
-                                               ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z));
+                                               ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z));
                                                velspeed=findLength(&velocity);
                                                velocity=flatfacing*velspeed*-1;
                                        }
index 00a374a733bf48788f2a4c96c8c1557406d847f5..6104044aada9b8a6e412fe10b68913f274b14f8b 100644 (file)
@@ -98,7 +98,8 @@ float LineFacetd(XYZ *p1,XYZ *p2,XYZ *pa,XYZ *pb,XYZ *pc,XYZ *n, XYZ *p);
 float LineFacetd(XYZ *p1,XYZ *p2,XYZ *pa,XYZ *pb,XYZ *pc, XYZ *p);
 bool PointInTriangle(Vector *p, Vector normal, float p11, float p12, float p13, float p21, float p22, float p23, float p31, float p32, float p33);
 bool LineFacet(Vector p1,Vector p2,Vector pa,Vector pb,Vector pc,Vector *p);
-inline void ReflectVector(XYZ *vel, XYZ *n);
+inline void ReflectVector(XYZ *vel, const XYZ *n);
+inline void ReflectVector(XYZ *vel, const XYZ &n);
 inline XYZ DoRotation(XYZ thePoint, float xang, float yang, float zang);
 inline XYZ DoRotationRadian(XYZ thePoint, float xang, float yang, float zang);
 inline float findDistance(XYZ *point1, XYZ *point2);
@@ -107,7 +108,7 @@ inline float findLengthfast(XYZ *point1);
 inline float findDistancefast(XYZ *point1, XYZ *point2);
 inline float findDistancefast(XYZ point1, XYZ point2);
 inline float findDistancefastflat(XYZ *point1, XYZ *point2);
-inline float dotproduct(XYZ *point1, XYZ *point2);
+inline float dotproduct(const XYZ *point1, const XYZ *point2);
 bool sphere_line_intersection (
                                                           float x1, float y1 , float z1,
                                                           float x2, float y2 , float z2,
@@ -257,16 +258,21 @@ inline float normaldotproduct(XYZ point1, XYZ point2){
        return returnvalue;
 }
 
-inline void ReflectVector(XYZ *vel, XYZ *n)
+inline void ReflectVector(XYZ *vel, const XYZ *n)
+{
+    ReflectVector(vel, *n);
+}
+
+inline void ReflectVector(XYZ *vel, const XYZ &n)
 {
        static XYZ vn;
        static XYZ vt;
        static float dotprod;
 
-       dotprod=dotproduct(n,vel);
-       vn.x=n->x*dotprod;
-       vn.y=n->y*dotprod;
-       vn.z=n->z*dotprod;
+       dotprod=dotproduct(&n,vel);
+       vn.x=n.x*dotprod;
+       vn.y=n.y*dotprod;
+       vn.z=n.z*dotprod;
 
        vt.x=vel->x-vn.x;
        vt.y=vel->y-vn.y;
@@ -277,7 +283,7 @@ inline void ReflectVector(XYZ *vel, XYZ *n)
        vel->z = vt.z - vn.z;
 }
 
-inline float dotproduct(XYZ *point1, XYZ *point2){
+inline float dotproduct(const XYZ *point1, const XYZ *point2){
        static GLfloat returnvalue;
        returnvalue=(point1->x*point2->x+point1->y*point2->y+point1->z*point2->z);
        return returnvalue;