Removing a magic number and collapsing two identical variables that hard-code the number of hands.

This commit is contained in:
Andrew Meadows 2014-01-21 10:11:20 -08:00
parent 141c20f4ef
commit e02c7bed18
3 changed files with 5 additions and 6 deletions

View file

@ -311,7 +311,7 @@ bool Avatar::findSphereCollision(const glm::vec3& sphereCenter, float sphereRadi
const HandData* handData = getHandData(); const HandData* handData = getHandData();
if (handData) { if (handData) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < NUM_HANDS; i++) {
const PalmData* palm = handData->getPalm(i); const PalmData* palm = handData->getPalm(i);
if (palm && palm->hasPaddle()) { if (palm && palm->hasPaddle()) {
// create a disk collision proxy where the hand is // create a disk collision proxy where the hand is

View file

@ -59,7 +59,7 @@ Hand::Hand(Avatar* owningAvatar) :
_throwSound(QUrl("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/throw.raw")), _throwSound(QUrl("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/throw.raw")),
_catchSound(QUrl("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/catch.raw")) _catchSound(QUrl("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/catch.raw"))
{ {
for (int i = 0; i < MAX_HANDS; i++) { for (int i = 0; i < NUM_HANDS; i++) {
_toyBallInHand[i] = false; _toyBallInHand[i] = false;
_ballParticleEditHandles[i] = NULL; _ballParticleEditHandles[i] = NULL;
_whichBallColor[i] = 0; _whichBallColor[i] = 0;

View file

@ -104,10 +104,9 @@ private:
void simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, float deltaTime); void simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, float deltaTime);
#define MAX_HANDS 2 bool _toyBallInHand[NUM_HANDS];
bool _toyBallInHand[MAX_HANDS]; int _whichBallColor[NUM_HANDS];
int _whichBallColor[MAX_HANDS]; ParticleEditHandle* _ballParticleEditHandles[NUM_HANDS];
ParticleEditHandle* _ballParticleEditHandles[MAX_HANDS];
int _lastControllerButtons; int _lastControllerButtons;
float _pitchUpdate; float _pitchUpdate;