[Orxonox-commit 7557] r12160 - in code/branches/wagnis_HS18: data/levels src/modules/wagnis

stadlero at orxonox.net stadlero at orxonox.net
Wed Dec 5 19:51:12 CET 2018


Author: stadlero
Date: 2018-12-05 19:51:11 +0100 (Wed, 05 Dec 2018)
New Revision: 12160

Modified:
   code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw
   code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
Log:
some bugfixes

Modified: code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw
===================================================================
--- code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw	2018-12-05 12:24:26 UTC (rev 12159)
+++ code/branches/wagnis_HS18/data/levels/Wagnis_testlevel.oxw	2018-12-05 18:51:11 UTC (rev 12160)
@@ -31,7 +31,7 @@
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
     <SpawnPoint position="-100, 45, 75" lookat="0,45,75" spawnclass=SpaceShip pawndesign=wagnisCursor />
 
-<WagnisGameboard position="20,20,20" connections_string="1=2+4+5, 2=1+3, 3=2+4, 4=3+1, 5=1+6, 6=7+5, 7=6+8, 8=7">
+<WagnisGameboard position="20,20,20" connections_string="2=1+3,1=2+4+5,3=2+4,4=3+1,5=1+6,6=7+5,7=6+8,8=7">
 
 
   <Provinces>
@@ -99,7 +99,7 @@
       </collisionShapes>
     </WagnisProvince>
 
-    <WagnisProvince ID="8" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=kinematic mass=100 continent="1" position="0,<?lua print((40))?>,<?lua print((130))?>" rotationrate="<?lua print(math.random() * 50) ?>" rotationaxis="<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>">
+    <WagnisProvince ID="8" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=kinematic mass=100 continent="1" position="0,<?lua print((40))?>,<?lua print((120))?>" rotationrate="<?lua print(math.random() * 50) ?>" rotationaxis="<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>,<?lua print((math.random()-1)*5)?>">
       <attached>
         <Model position="0,0,0" mesh="ast1.mesh" scale3D="1.4,1.4,1.4" />
       </attached>
@@ -108,7 +108,7 @@
       </collisionShapes>
     </WagnisProvince>
 
-    <WagnisProvince ID="1000" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=kinematic mass=100 continent="1" position="0,<?lua print((50+7))?>,<?lua print((135-6))?>" pitch=90 rotationrate="0" rotationaxis="0,0,0">
+    <WagnisProvince ID="1000" radarname="continue" health = 10000000 maxhealth = 10000000 initialhealth = 10000000 collisionType=kinematic mass=100 continent="1" position="0,<?lua print((45))?>,<?lua print((135))?>" pitch=90 rotationrate="0" rotationaxis="0,0,0">
       <attached>
         <Model position="0,0,0" mesh="broke-satellite.mesh" scale3D="3,3,3" />
       </attached>
@@ -121,15 +121,6 @@
   </Provinces>
 </WagnisGameboard>
 
-<Model position="0,0,0" mesh="Coordinates.mesh" scale="20"/>
-<MovableEntity position="0,0,0">
-    <attached>
-        <Billboard position="100,0,0" material="Examples/Flare" colour="0, 0, 1" scale=1/>
-    </attached>
-</MovableEntity>
-
-
-
     
   </Scene>
 </Level>

Modified: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	2018-12-05 12:24:26 UTC (rev 12159)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	2018-12-05 18:51:11 UTC (rev 12160)
@@ -64,6 +64,8 @@
  **/
 void Wagnis::playerFinishedStageCallback(WagnisPlayer* player){
 
+    player->resetProvinceSelection();
+
     if(this->active_player != player->Player_ID){
         orxout()<<"shit happend. This player should not be activ. Wagnis::playerFinishedStage was called from wrong player"<<endl;
     }
@@ -131,6 +133,7 @@
 
             player->gameStage = ATTACK_STAGE;
             this->gameStage = ATTACK_STAGE;
+            player->reinforcements = provincesOfPlayerCounter(player->Player_ID);
             orxout()<<"Player "<<player->Player_ID<<"\'s turn. Attack."<<endl;
             break;
         }
@@ -169,11 +172,7 @@
         orxout() << "Error: GameBoard not found" << endl;
     }
 
-    //this->gameBoard->initializeNeighbors();
-
-    //for(WagnisPlayer* p: this->players){
-        //this->playerEntered(p);
-    //}
+    this->gameBoard->initializeNeighbors();
     
     orxout() << "Game creation finished" << endl;
 }
@@ -197,7 +196,7 @@
                 n++;
             }
         }else{
-            orxout()<<"Nullpointer found in provines!!!"<<endl;
+            orxout()<<"Nullpointer found in provinces!!!"<<endl;
         }
     }
     return n;
@@ -211,7 +210,7 @@
                 n++;
             }
         }else{
-            orxout()<<"Nullpointer found in provines!!!"<<endl;
+            orxout()<<"Nullpointer found in provinces!!!"<<endl;
         }
     }
     return n;

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc	2018-12-05 12:24:26 UTC (rev 12159)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc	2018-12-05 18:51:11 UTC (rev 12160)
@@ -63,6 +63,7 @@
         orxout() << "inizializing started" << endl;
         orxout() << "String size:" << endl;
         orxout() << str.size() << endl;
+        orxout() << str<<endl;
         unsigned int n = 0;
         while(n < str.size()){
             int tmp = parse_int(str,n);
@@ -84,14 +85,14 @@
                         for(WagnisProvince* other:this->provs){
                             if(other->getID() == other_ID){
                                 orig->addNeighbor(other);
-                                orxout() << "Added neighbor province "<< other_ID << " to province " << origin_ID << endl;
+                                //orxout() << "Added neighbor province "<< other_ID << " to province " << origin_ID << endl;
                                 break;
                             }
                         }
                     }
-                    break;
                 }
             }while((n < str.size()) && (str[n] == '+'));
+
             if(n == str.size()) return;
             while((n < str.size()) && (str[n] == ' ')) n++;
             if(n == str.size()) return;
@@ -101,6 +102,7 @@
             }
             n++;
             while(n < str.size() && str[n] == ' ') n++;
+            orxout()<<"One province finished"<<endl;
         }
     }
 

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc	2018-12-05 12:24:26 UTC (rev 12159)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc	2018-12-05 18:51:11 UTC (rev 12160)
@@ -78,7 +78,7 @@
                 break;
             }
             case REINFORCEMENT_STAGE: {
-                ss<<"Player "<<wagnisgame->active_player<<" place your reinforcements";
+                ss<<"Player "<<wagnisgame->active_player<<" place your reinforcements: "<<wagnisgame->players.at(wagnisgame->active_player-1)->reinforcements;
                 setCaption( ss.str() );
                 break;
             }

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	2018-12-05 12:24:26 UTC (rev 12159)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	2018-12-05 18:51:11 UTC (rev 12160)
@@ -46,7 +46,9 @@
                         this->target_province = prov;
                         this->province_selection_changed = true;
                     }else{
+                        if(this->origin_province != nullptr) this->origin_province->dehighlight();
                         this->origin_province = prov;
+                        this->origin_province->highlight();
                         this->province_selection_changed = true;
                     }
                     prov->setHealth(prov->getMaxHealth());
@@ -81,6 +83,7 @@
                                 this->target_province->setTroops(this->target_province->getTroops()+1);
                                 this->reinforcements -= 1;
                                 orxout()<<"Province "<<this->target_province->getID()<<" owned by Player "<<this->target_province->getOwner_ID()<<" troops: "<<this->target_province->getTroops()<<endl;
+                                if(reinforcements == 0) master->playerFinishedStageCallback(this);
                             }
                         }   
                         
@@ -350,4 +353,13 @@
     bool WagnisPlayer::isActive() const {
         return this->is_active;
     }
+
+    //Resets the two province pointers and dehighlights them.
+    void WagnisPlayer::resetProvinceSelection(){
+
+        if(this->origin_province != nullptr)this->origin_province->dehighlight();
+        if(this->target_province != nullptr)this->target_province->dehighlight();
+        this->origin_province = nullptr;
+        this->target_province = nullptr;
+    }
 }

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	2018-12-05 12:24:26 UTC (rev 12159)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	2018-12-05 18:51:11 UTC (rev 12160)
@@ -37,6 +37,7 @@
         std::string toString();
         void setActive(bool);
         bool isActive() const;
+        void resetProvinceSelection();
 
 
 

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	2018-12-05 12:24:26 UTC (rev 12159)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	2018-12-05 18:51:11 UTC (rev 12160)
@@ -19,7 +19,7 @@
         RegisterObject(WagnisProvince);
         this->owner_ID = -1;
         this->troops = 0;
-        this->setRadarName(std::to_string(0));
+        this->setRadarName("");
         this->setRadarObjectColour(colour({128,128,128}, 100.0f));
         this->ID = -1;
         this->continent = -1;
@@ -80,6 +80,10 @@
     void WagnisProvince::dehighlight(){
         this->setOwner_ID( this->getOwner_ID() );
     }
+
+
+
+    
     //set troops
     void WagnisProvince::setTroops(int troops){
         this->troops = troops;



More information about the Orxonox-commit mailing list