[Orxonox-commit 7569] r12172 - code/branches/wagnis_HS18/src/modules/wagnis

kunzro at orxonox.net kunzro at orxonox.net
Fri Dec 7 19:51:29 CET 2018


Author: kunzro
Date: 2018-12-07 19:51:28 +0100 (Fri, 07 Dec 2018)
New Revision: 12172

Modified:
   code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
   code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
Log:
Colour untill 6 adjusted and CHOOSE_PROVINCE_STAGE fixed, so it only ends, if all the provinces are occupied also if some players don' play

Modified: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	2018-12-07 18:32:57 UTC (rev 12171)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	2018-12-07 18:51:28 UTC (rev 12172)
@@ -16,9 +16,8 @@
     this->gameStage = NOT_READY;
     this->active_player = 1;
     this->initial_reinforcements_left = 2; //changed here
-    this->empty_provinces_left = 0;
 
-    int n = 3;
+    int n = 6;
     for(int i = 0;i < n;i++){
         WagnisPlayer* p = new WagnisPlayer(context);
         p->Player_ID = i+1;
@@ -42,7 +41,6 @@
     }
 
     this->gameStage = CHOOSE_PROVINCE_STAGE;
-    this->empty_provinces_left = this->provinceCount();
     this->players.at(0)->gameStage = this->gameStage;
     this->players.at(0)->setActive(true);
     this->players.at(0)->reinforcements = 0;
@@ -72,10 +70,8 @@
     switch(this->gameStage){
         case CHOOSE_PROVINCE_STAGE:{
             player->setActive(false);
-            this->empty_provinces_left -= 1;
-            if(this->empty_provinces_left > 0){
+            if(this->unoccupiedProvinces() > 0){
                 //Still empty provinces left
-                orxout()<<"DEBUG: Empty provs: "<<this->empty_provinces_left<<endl;
 
                 if(this->active_player < this->players.size()){
                     this->active_player++;
@@ -90,7 +86,6 @@
                 orxout()<<"Player "<<next->Player_ID<<"\'s turn. Please choose province."<<endl;
             }else{
                 //no empty provinces left
-                orxout()<<"DEBUG: Empty provs: "<<this->empty_provinces_left<<endl;
                 this->active_player = 1;
                 WagnisPlayer* next = this->players[this->active_player - 1];
                 next->gameStage = REINFORCEMENT_STAGE;
@@ -221,6 +216,18 @@
     return n;
 }
 
+int Wagnis::unoccupiedProvinces(){
+    int n = 0;
+    for(WagnisProvince* p: this->gameBoard->provs){
+        if(p != nullptr){
+            if(p->getOwner_ID() == -1 && p->ID < 1000){
+                n++;
+            }
+        }
+    }
+    return n;
+}
+
 int Wagnis::reinforcementsCounter(int player){
     int n = 0;
     for(WagnisProvince* p:this->gameBoard->provs){

Modified: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h	2018-12-07 18:32:57 UTC (rev 12171)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h	2018-12-07 18:51:28 UTC (rev 12172)
@@ -45,7 +45,6 @@
 
         int active_player;
         int initial_reinforcements_left;
-        int empty_provinces_left;
         GameStage gameStage;
         std::vector<WagnisPlayer*> players;
         void createGame();
@@ -53,6 +52,7 @@
         int provinceCount();
         int reinforcementsCounter(int);
         int getContinentValue(int);
+        int unoccupiedProvinces();
     };
 }
 #endif

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc	2018-12-07 18:32:57 UTC (rev 12171)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisHUDinfo.cc	2018-12-07 18:51:28 UTC (rev 12172)
@@ -60,9 +60,9 @@
                     break;
             case 5: setColour( colour({255,0,255}, 100.0f) );
                     break;
-            case 6: setColour( colour({128,128,0}, 40.0f) );
+            case 6: setColour( colour({0,255,255}, 40.0f) );
                     break;
-            case 7: setColour( colour({0,255,255}, 100.0f) );
+            case 7: setColour( colour({128,128,0}, 100.0f) );
                     break;
             case 8: setColour( colour({153,255,204}, 100.0f) );
                     break;

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	2018-12-07 18:32:57 UTC (rev 12171)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	2018-12-07 18:51:28 UTC (rev 12172)
@@ -61,9 +61,9 @@
                     break;
             case 5: this->setRadarObjectColour( colour({255,0,255}, 100.0f) );
                     break;
-            case 6: this->setRadarObjectColour( colour({128,128,0}, 40.0f) );
+            case 6: this->setRadarObjectColour( colour({0,255,255}, 100.0f) );
                     break;
-            case 7: this->setRadarObjectColour( colour({0,255,255}, 100.0f) );
+            case 7: this->setRadarObjectColour( colour({128,128,0}, 100.0f) );
                     break;
             case 8: this->setRadarObjectColour( colour({153,255,204}, 100.0f) );
                     break;



More information about the Orxonox-commit mailing list