[Orxonox-commit 4853] r9522 - code/branches/Racingbot/src/modules/gametypes
jo at orxonox.net
jo at orxonox.net
Sun Dec 16 16:02:35 CET 2012
Author: jo
Date: 2012-12-16 16:02:34 +0100 (Sun, 16 Dec 2012)
New Revision: 9522
Modified:
code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc
Log:
Repairing the Compiler Errors.
Modified: code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc 2012-12-16 00:21:43 UTC (rev 9521)
+++ code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc 2012-12-16 15:02:34 UTC (rev 9522)
@@ -357,7 +357,10 @@
void SpaceRaceController::tick(float dt)
{
if (this->getControllableEntity() == NULL || this->getControllableEntity()->getPlayer() == NULL )
- { orxout()<<this->getControllableEntity()<< " in tick"<<endl; return;}
+ {
+ //orxout()<< this->getControllableEntity() << " in tick"<<endl;
+ return;
+ }
//FOR virtual Checkpoints
if(nextRaceCheckpoint_->getCheckpointIndex() < 0)
{
@@ -408,6 +411,7 @@
return true;
if(abs(pointToPoint.z) < groesse.z)
return true;
+ return false;
}
@@ -459,7 +463,7 @@
Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
Vector3 norm_r_CP = cP1ToCP2.crossProduct(centerCP1-positionObjectNonBT);
- if(norm_r_CP.length == 0){
+ if(norm_r_CP.length() == 0){
Vector3 zufall;
do{
zufall=Vector3(rnd(),rnd(),rnd());//random
@@ -469,13 +473,16 @@
Vector3 VecToVCP = norm_r_CP.crossProduct(cP1ToCP2);
float distanzToCP1 = sqrt(powf(radiusObject,4)/(powf((centerCP1-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
float distanzToCP2 = sqrt(powf(radiusObject,4)/(powf((racepoint2->getPosition()-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
- //TODO float distanz=max(distanzToCP1,distanzToCP2);
- float distanz = 0.0f; //TEMPORARY
+ float distanz = std::max(distanzToCP1,distanzToCP2);
+ //float distanz = 0.0f; //TEMPORARY
Vector3 newCheckpointPositionPos = positionObjectNonBT+(distanz*VecToVCP)/VecToVCP.length();
Vector3 newCheckpointPositionNeg = positionObjectNonBT-(distanz*VecToVCP)/VecToVCP.length();
- if((newCheckpointPositionPos-centerCP1).length+(newCheckpointPositionPos-(centerCP1+cP1ToCP2)).length < (newCheckpointPositionNeg-centerCP1).length+(newCheckpointPositionNeg-(centerCP1+cP1ToCP2)).length){
+ if((newCheckpointPositionPos - centerCP1).length() + (newCheckpointPositionPos - (centerCP1+cP1ToCP2)).length() < (newCheckpointPositionNeg - centerCP1).length() + (newCheckpointPositionNeg - (centerCP1+cP1ToCP2)).length() )
+ {
RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionPos);
- }else{
+ }
+ else
+ {
RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionNeg);
}
return;
More information about the Orxonox-commit
mailing list