Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 20, 2009, 9:20:47 AM (15 years ago)
Author:
rgrieder
Message:

Merged pch branch back to trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/worldentities/PongBall.cc

    r3110 r3196  
    3232#include "core/GameMode.h"
    3333#include "objects/gametypes/Gametype.h"
     34#include "objects/worldentities/PongBat.h"
    3435#include "sound/SoundBase.h"
    3536
     
    4950        this->batID_[0] = OBJECTID_UNKNOWN;
    5051        this->batID_[1] = OBJECTID_UNKNOWN;
    51         this->relMercyOffset_ = 0.05;
     52        this->relMercyOffset_ = 0.05f;
    5253
    5354        this->registerVariables();
     
    102103                    if (position.x > this->fieldWidth_ / 2 && this->bat_[1])
    103104                    {
    104                         distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10) / 2);
     105                        distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
    105106                        if (fabs(distance) <= 1)
    106107                        {
     
    122123                    if (position.x < -this->fieldWidth_ / 2 && this->bat_[0])
    123124                    {
    124                         distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10) / 2);
     125                        distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
    125126                        if (fabs(distance) <= 1)
    126127                        {
     
    172173              if (position.x > this->fieldWidth_ / 2 && this->bat_[1])
    173174              {
    174                 distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10) / 2);
     175                distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
    175176                if (fabs(distance) <= 1)
    176177                {
     
    183184              if (position.x < -this->fieldWidth_ / 2 && this->bat_[0])
    184185              {
    185                 distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10) / 2);
     186                distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
    186187                if (fabs(distance) <= 1)
    187188                {
     
    217218        }
    218219    }
     220
     221    void PongBall::setBats(PongBat** bats)
     222    {
     223        this->bat_ = bats;
     224        this->batID_[0] = this->bat_[0]->getObjectID();
     225        this->batID_[1] = this->bat_[1]->getObjectID();
     226    }
     227
     228    void PongBall::applyBats()
     229    {
     230        if (!this->bat_)
     231            this->bat_ = new PongBat*[2];
     232        if (this->batID_[0] != OBJECTID_UNKNOWN)
     233            this->bat_[0] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0]));
     234        if (this->batID_[1] != OBJECTID_UNKNOWN)
     235            this->bat_[1] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1]));
     236    }
    219237}
Note: See TracChangeset for help on using the changeset viewer.