[prev in list] [next in list] [prev in thread] [next in thread]
List: bzflag-commits
Subject: SF.net SVN: bzflag: [16439] trunk/bzflag/src/bzrobots
From: brlcad () users ! sourceforge ! net
Date: 2008-01-06 19:57:45
Message-ID: E1JBbcv-0005Ki-94 () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]
Revision: 16439
http://bzflag.svn.sourceforge.net/bzflag/?rev=16439&view=rev
Author: brlcad
Date: 2008-01-06 11:57:43 -0800 (Sun, 06 Jan 2008)
Log Message:
-----------
ws and style cleanup, doxygenify, consistency
Modified Paths:
--------------
trunk/bzflag/src/bzrobots/RCRobotPlayer.cxx
trunk/bzflag/src/bzrobots/RCRobotPlayer.h
Modified: trunk/bzflag/src/bzrobots/RCRobotPlayer.cxx
===================================================================
--- trunk/bzflag/src/bzrobots/RCRobotPlayer.cxx 2008-01-06 19:57:17 UTC (rev 16438)
+++ trunk/bzflag/src/bzrobots/RCRobotPlayer.cxx 2008-01-06 19:57:43 UTC (rev 16439)
@@ -10,10 +10,6 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/*
- * Remote Control Robot Player
- */
-
// interface header
#include "RCRobotPlayer.h"
@@ -25,51 +21,53 @@
#include "Intersect.h"
#include "TargetingUtils.h"
-RCRobotPlayer::RCRobotPlayer(const PlayerId& _id, const char* _name,
- ServerLink* _server,
- const char* _email = "anonymous") :
- RobotPlayer(_id, _name, _server, _email),
- lastTickAt(0.0), tickDuration(2.0),
- speed(1.0), nextSpeed(1.0),
- turnRate(1.0), nextTurnRate(1.0),
- shoot(false),
- distanceRemaining(0.0), nextDistance(0.0),
- turnRemaining(0.0), nextTurn(0.0),
- hasStopped(false)
+
+RCRobotPlayer::RCRobotPlayer(const PlayerId& _id,
+ const char* _name,
+ ServerLink* _server,
+ const char* _email) :
+ RobotPlayer(_id, _name, _server, _email),
+ lastTickAt(0.0),
+ tickDuration(2.0),
+ speed(1.0),
+ nextSpeed(1.0),
+ turnRate(1.0),
+ nextTurnRate(1.0),
+ shoot(false),
+ distanceRemaining(0.0),
+ nextDistance(0.0),
+ turnRemaining(0.0),
+ nextTurn(0.0),
+ hasStopped(false)
{
}
-void RCRobotPlayer::doUpdate(double dt)
+void RCRobotPlayer::doUpdate(double dt)
{
LocalPlayer::doUpdate(dt);
}
-void RCRobotPlayer::doUpdateMotion(double dt)
+
+void RCRobotPlayer::doUpdateMotion(double dt)
{
if (isAlive()) {
double timeNow = TimeKeeper::getCurrent().getSeconds();
/* Is the tick still running? */
- if (lastTickAt + tickDuration >= timeNow)
- {
+ if (lastTickAt + tickDuration >= timeNow) {
const float *vel = getVelocity();
distanceRemaining -= sqrt(vel[0]*vel[0] + vel[1]*vel[1] + vel[2]*vel[2]) * dt;
- if (distanceRemaining > 0.0)
- {
+ if (distanceRemaining > 0.0) {
if (distanceForward)
setDesiredSpeed(speed);
else
setDesiredSpeed(-speed);
- }
- else
- {
+ } else {
setDesiredSpeed(0);
}
- if (turnRemaining > 0.0)
- {
- if (turnLeft)
- {
+ if (turnRemaining > 0.0) {
+ if (turnLeft) {
turnRemaining -= getAngularVelocity() * dt;
if (turnRemaining <= 0.0)
@@ -78,9 +76,7 @@
setDesiredAngVel(turnRemaining/dt);
else
setDesiredAngVel(turnRate);
- }
- else
- {
+ } else {
turnRemaining += getAngularVelocity() * dt;
if (turnRemaining <= 0.0)
setDesiredAngVel(0);
@@ -89,14 +85,10 @@
else
setDesiredAngVel(-turnRate);
}
- }
- else
- {
+ } else {
setDesiredAngVel(0);
}
- }
- else
- {
+ } else {
setDesiredAngVel(0);
setDesiredSpeed(0);
}
@@ -105,12 +97,14 @@
LocalPlayer::doUpdateMotion(dt);
}
-void RCRobotPlayer::explodeTank()
+
+void RCRobotPlayer::explodeTank()
{
LocalPlayer::explodeTank();
}
-void RCRobotPlayer::restart(const double* _pos, double _azimuth)
+
+void RCRobotPlayer::restart(const double* _pos, double _azimuth)
{
float pos[3];
pos[0] = _pos[0];
@@ -119,7 +113,8 @@
LocalPlayer::restart(pos, (float)_azimuth);
}
-bool RCRobotPlayer::isSteadyState()
+
+bool RCRobotPlayer::isSteadyState()
{
double timeNow = TimeKeeper::getCurrent().getSeconds();
/* last tick done? */
Modified: trunk/bzflag/src/bzrobots/RCRobotPlayer.h
===================================================================
--- trunk/bzflag/src/bzrobots/RCRobotPlayer.h 2008-01-06 19:57:17 UTC (rev 16438)
+++ trunk/bzflag/src/bzrobots/RCRobotPlayer.h 2008-01-06 19:57:43 UTC (rev 16439)
@@ -10,13 +10,9 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/*
- * Remote Control Robot Player
- */
+#ifndef __RCROBOTPLAYER_H__
+#define __RCROBOTPLAYER_H__
-#ifndef BZF_TCP_RC_ROBOT_PLAYER_H
-#define BZF_TCP_RC_ROBOT_PLAYER_H
-
#include "common.h"
/* system interface headers */
@@ -25,18 +21,25 @@
/* interface header */
#include "RobotPlayer.h"
+/* common interface headers */
+#include "ServerLink.h"
+
/* local interface headers */
#include "Region.h"
#include "RegionPriorityQueue.h"
-#include "ServerLink.h"
#include "RCLinkBackend.h"
-class RCRobotPlayer : public RobotPlayer {
+/**
+ * Remote Control Robot Player
+ */
+class RCRobotPlayer : public RobotPlayer
+{
public:
RCRobotPlayer(const PlayerId&,
const char* name, ServerLink*,
- const char* _email);
+ const char* _email = "anonymous");
+
typedef enum {
speedUpdate,
turnRateUpdate,
@@ -71,7 +74,9 @@
void doUpdateMotion(double dt);
};
-#endif // BZF_TCP_RC_ROBOT_PLAYER_H
+#else
+class RCRobotPlayer;
+#endif // __RCROBOTPLAYER_H__
// Local Variables: ***
// mode: C++ ***
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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