[Orxonox-commit 7733] r12326 - code/branches/3DPacman_FS19/src/modules/pacman

peterf at orxonox.net peterf at orxonox.net
Thu May 2 13:00:11 CEST 2019


Author: peterf
Date: 2019-05-02 13:00:11 +0200 (Thu, 02 May 2019)
New Revision: 12326

Modified:
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
Log:
bug fix

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-04-27 23:07:32 UTC (rev 12325)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-05-02 11:00:11 UTC (rev 12326)
@@ -259,8 +259,8 @@
         //and finally return the best neighboor of the actual position of the pacman
         
     //(optional parameter) pointToAvoidP1 is a point that cannot be considered
+        
 
-
     graphVertex listOfVerticesM[67]; //our list of all possible graphs
     graphVertex* actualVertex; //we will walk through the array with a pointer
     
@@ -618,6 +618,7 @@
             else if(findpos(actuelposition,possibleposition[41])){
                 adjacentVertices[0]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);
                 adjacentVertices[1]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);
+                adjacentVertices[2]=&listOfVerticesP2[40]; //error meuh
                        }
             else if(findpos(actuelposition,possibleposition[42])){
                 adjacentVertices[0]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
@@ -627,6 +628,7 @@
             else if(findpos(actuelposition,possibleposition[43])){
                 adjacentVertices[0]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);
                 adjacentVertices[1]=&listOfVerticesP2[46]; //graphVertex(possibleposition[46]);
+                adjacentVertices[2]=&listOfVerticesP2[42]; //error meuh
                        }
             else if(findpos(actuelposition,possibleposition[44])){
                 adjacentVertices[0]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]);
@@ -1218,7 +1220,6 @@
                         }
 
                     }
-        std::cout<<"bra"<<frontPoint<<endl;
                 }
 
     if(frontPoint==Vector3(0,-1,0)){
@@ -1226,7 +1227,7 @@
         return this->lastPlayerPassedPoint;
             }
     else{
-        std::cout<<frontPoint<<endl;
+        //std::cout<<frontPoint<<endl;
         return frontPoint;
             }
     }
@@ -1432,6 +1433,7 @@
             else if(findpos(actuelposition,possibleposition[41])){
                 adjacentPositions[0]=positionArray[35]; //graphVertex(possibleposition[35]);
                 adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
+                adjacentPositions[2]=positionArray[40];  //error 
                        }
             else if(findpos(actuelposition,possibleposition[42])){
                 adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
@@ -1441,6 +1443,7 @@
             else if(findpos(actuelposition,possibleposition[43])){
                 adjacentPositions[0]=positionArray[41]; //graphVertex(possibleposition[41]);
                 adjacentPositions[1]=positionArray[46]; //graphVertex(possibleposition[46]);
+                adjacentPositions[2]=positionArray[42]; //error
                        }
             else if(findpos(actuelposition,possibleposition[44])){
                 adjacentPositions[0]=positionArray[40]; //graphVertex(possibleposition[40]);
@@ -1513,7 +1516,7 @@
                           }
             else if(findpos(actuelposition,possibleposition[59])){
                 adjacentPositions[0]=positionArray[58]; //graphVertex(possibleposition[58]);
-                adjacentPositions[1]=positionArray[59]; //graphVertex(possibleposition[59]);
+                adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]); //error 59
                 adjacentPositions[2]=positionArray[63]; //graphVertex(possibleposition[63]);
                           }
             else if(findpos(actuelposition,possibleposition[60])){

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	2019-04-27 23:07:32 UTC (rev 12325)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	2019-05-02 11:00:11 UTC (rev 12326)
@@ -35,6 +35,7 @@
         SUPER(PacmanGhost, tick, dt);
 
         this->actuelposition = this->getPosition();
+        //std::cout<<this->actuelposition<<endl;
 
 
         for(int u=0; u < 67; u++){//always check if player passed a point
@@ -45,8 +46,11 @@
 
         int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
         this->pointInFrontOfPlayer=frontPosition(); //getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
-        std::cout<<this->pointInFrontOfPlayer<<endl;
-        std::cout<<this->lastPlayerPassedPoint<<endl;
+        //std::cout<<this->pointInFrontOfPlayer<<endl;
+        //std::cout<<this->lastPlayerPassedPoint<<endl;
+
+        Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
+        //std::cout<<pinkPos<<endl;
         
         //Stop, if target arrived
         if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
@@ -86,7 +90,8 @@
             while(lockmove){};
             lockmove = true;
 
-            Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
+            //Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
+            //std::cout<<pinkPos<<endl;
 
             //int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
             //this->pointInFrontOfPlayer=getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
@@ -113,10 +118,21 @@
     
         Vector3 nextTarget;
 
+        std::cout<<this->actuelposition<<endl;
+        std::cout<<pinkPosP<<endl;
+        std::cout<<playerPos<<endl;
+        std::cout<<pointToAvoidP11<<endl;
+        std::cout<<this->getPlayerPos()<<endl;
+
         if(playerPos==pointToAvoidP11){ //SIGSEV if playerPos==pointToAvoidP11 otherwise
             nextTarget = getShortestPath(pinkPosP, playerPos);
         }
+        /*else if(pinkPosP==pointToAvoidP11){
+            nextTarget=getShortestPath(pinkPosP, playerPos);
+        }*/
         else{
+            //bugs here
+            std::cout<<"msjiowjqiq"<<endl;
         nextTarget = getShortestPath(pinkPosP, playerPos, pointToAvoidP11);
         }
     



More information about the Orxonox-commit mailing list