All pastes #9126 Raw Edit

Mine!

public text v1 · immutable
#9126 ·published 2005-04-08 20:07 UTC
rendered paste body
diff -u src/bzflag/Player.h.orig src/bzflag/Player.h
--- src/bzflag/Player.h.orig    2005-04-08 12:05:45.000000000 -0400
+++ src/bzflag/Player.h 2005-04-08 16:06:55.000000000 -0400
@@ -84,6 +84,7 @@
   short                getWins() const;
   short                getLosses() const;
   short                getTeamKills() const;
+  float                getTKRatio() const;
   short                getScore() const;
   const float* getDimensions() const;
   short                getRabbitScore() const;
diff -u src/bzflag/Player.cxx.orig src/bzflag/Player.cxx
--- src/bzflag/Player.cxx.orig  2005-04-08 12:08:28.000000000 -0400
+++ src/bzflag/Player.cxx       2005-04-08 12:12:55.000000000 -0400
@@ -166,6 +166,17 @@
 }
 
 
+float Player::getTKRatio() const
+{
+  if ( wins == 0 ) {
+    // well, we have to return *something* if they have no wins
+    return (float)tks/1.0f;
+  } else {
+    return (float)tks/(float)wins;
+  }
+}
+
+
 void Player::getMuzzle(float* m) const
 {
   // NOTE: like getRadius(), we only use dimensionsScale[0].