[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bzflag-commits
Subject:    SF.net SVN: bzflag:[22195] trunk/bzflag/src/bzflag
From:       atupone () users ! sourceforge ! net
Date:       2011-10-28 18:48:10
Message-ID: E1RJrTO-0000b0-LN () sfp-svn-4 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 22195
          http://bzflag.svn.sourceforge.net/bzflag/?rev=22195&view=rev
Author:   atupone
Date:     2011-10-28 18:48:10 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
(performance) Prefer prefix ++/-- operators for non-primitive types.
(style) Technically the member function 'BzfRegion::test' can be const.
(warning) Member variable 'BzfRegion::distance' is not initialized in the \
constructor.

Modified Paths:
--------------
    trunk/bzflag/src/bzflag/Region.cxx
    trunk/bzflag/src/bzflag/Region.h

Modified: trunk/bzflag/src/bzflag/Region.cxx
===================================================================
--- trunk/bzflag/src/bzflag/Region.cxx	2011-10-28 18:35:48 UTC (rev 22194)
+++ trunk/bzflag/src/bzflag/Region.cxx	2011-10-28 18:48:10 UTC (rev 22195)
@@ -53,7 +53,7 @@
 }
 
 BzfRegion::BzfRegion(int sides, const float p[][2]) :
-  mailbox(0), target(0), A(0.0, 0.0)
+  mailbox(0), target(0), distance(), A(0.0, 0.0)
 {
   for (int i = 0; i < sides; i++) {
     corners.push_back(RegionPoint(p[i]));
@@ -311,16 +311,16 @@
   for (int i = 0; i < count; i++)
     if (neighbors[i] == oldNeighbor) {
       std::vector<RegionPoint>::iterator it1 = corners.begin();
-      for(int j = 0; j < i + 1; j++) it1++;
+      for(int j = 0; j < i + 1; j++) ++it1;
       corners.insert(it1, p);
       if (onRight) {
 	std::vector<BzfRegion*>::iterator it2 = neighbors.begin();
-	for(int j = 0; j < i; j++) it2++;
+	for(int j = 0; j < i; j++) ++it2;
 	neighbors.insert(it2, newNeighbor);
       }
       else {
 	std::vector<BzfRegion*>::iterator it2 = neighbors.begin();
-	for(int j = 0; j < i + 1; j++) it2++;
+	for(int j = 0; j < i + 1; j++) ++it2;
 	neighbors.insert(it2, newNeighbor);
       }
       tidy();
@@ -354,10 +354,10 @@
     const float* p2 = corners[(i+1)%count].get();
     if (fabs(p1[0] - p2[0]) < ZERO_TOLERANCE && fabs(p1[1] - p2[1]) < \
ZERO_TOLERANCE) {  std::vector<RegionPoint>::iterator it1 = corners.begin();
-      for(int j = 0; j < i; j++) it1++;
+      for(int j = 0; j < i; j++) ++it1;
       corners.erase(it1);
       std::vector<BzfRegion*>::iterator it2 = neighbors.begin();
-      for(int k = 0; k < i; k++) it2++;
+      for(int k = 0; k < i; k++) ++it2;
       neighbors.erase(it2);
       i--;
       count--;
@@ -365,7 +365,7 @@
   }
 }
 
-bool BzfRegion::test(int mailboxIndex)
+bool BzfRegion::test(int mailboxIndex) const
 {
   return (mailbox != mailboxIndex);
 }

Modified: trunk/bzflag/src/bzflag/Region.h
===================================================================
--- trunk/bzflag/src/bzflag/Region.h	2011-10-28 18:35:48 UTC (rev 22194)
+++ trunk/bzflag/src/bzflag/Region.h	2011-10-28 18:48:10 UTC (rev 22195)
@@ -49,7 +49,7 @@
     const RegionPoint&	getCorner(int index) const;
     BzfRegion*		getNeighbor(int index) const;
 
-    bool		test(int mailboxIndex);
+    bool		test(int mailboxIndex) const;
     void		setPathStuff(float distance, BzfRegion* target,
 					const float p[2], int mailboxIndex);
     float		getDistance() const;

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
BZFlag-commits mailing list
BZFlag-commits@lists.SourceForge.net
https://lists.SourceForge.net/lists/listinfo/bzflag-commits
irc: #BZFlag @ irc.freenode.net


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic