Index: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	(revision 12136)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	(revision 12150)
@@ -16,6 +16,8 @@
     this->gameStage = NOT_READY;
     this->active_player = 1;
-
-    int n = 8;
+    this->initial_reinforcements_left = 5;
+    this->empty_provinces_left = 0;
+
+    int n = 3;
     for(int i = 0;i < n;i++){
         WagnisPlayer* p = new WagnisPlayer(context);
@@ -41,6 +43,8 @@
 
     this->gameStage = CHOOSE_PROVINCE_STAGE;
+    this->empty_provinces_left = this->provinceCount();
     this->players.at(0)->gameStage = this->gameStage;
-    this->players.at(0)->is_active = true;
+    this->players.at(0)->setActive(true);
+    this->players.at(0)->reinforcements = 0;
     orxout()<<"Player "<<1<<"\'s turn. Please choose province."<<endl;
 }
@@ -66,17 +70,30 @@
     switch(this->gameStage){
         case CHOOSE_PROVINCE_STAGE:{
-            player->is_active = false;
-            if(this->active_player < this->players.size()){
-                this->active_player++;
+            player->setActive(false);
+            this->empty_provinces_left -= 1;
+            if(this->empty_provinces_left > 0){
+                //Still empty provinces left
+                orxout()<<"DEBUG: Empty provs: "<<this->empty_provinces_left<<endl;
+
+                if(this->active_player < this->players.size()){
+                    this->active_player++;
+                }else{
+                    this->active_player = 1;
+                }
+
                 WagnisPlayer* next = this->players[this->active_player - 1];
                 next->gameStage = CHOOSE_PROVINCE_STAGE;
-                next->is_active = true;
+                next->setActive(true);
+                next->reinforcements = 0;
                 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;
                 this->gameStage = REINFORCEMENT_STAGE;
-                next->is_active = true;
+                next->setActive(true);
+                next->reinforcements = 1;
                 orxout()<<"Player "<<next->Player_ID<<"\'s turn. Reinforcement."<<endl;
             }
@@ -84,4 +101,33 @@
         }
         case REINFORCEMENT_STAGE:{
+            
+            if(this->initial_reinforcements_left > 0){
+                player->setActive(false);
+                if(this->active_player == this->players.size()){
+                    //Last player finished this round of initial troops.
+                    this->initial_reinforcements_left -= 1;
+                    WagnisPlayer* next = this->players.at(0);
+                    this->active_player = 1;
+                    next->setActive(true);
+                    next->gameStage = REINFORCEMENT_STAGE;
+                    if(this->initial_reinforcements_left > 0){
+                        //Still more troops left to place and player 1 is next.
+                        next->reinforcements = 1;
+                    }else{
+                        //No more troops left to place and player 1 is next.
+                        next->reinforcements = provincesOfPlayerCounter(1);
+                    }
+                }else{
+                    //Player who finished was not the last player
+                    WagnisPlayer* next = this->players.at(this->active_player);
+                    this->active_player += 1;
+                    next->setActive(true);
+                    next->gameStage = REINFORCEMENT_STAGE;
+                    next->reinforcements = 1;
+                }
+                break;
+            }
+            //Standard Reinforcement
+
             player->gameStage = ATTACK_STAGE;
             this->gameStage = ATTACK_STAGE;
@@ -96,5 +142,5 @@
         }
         case MOVE_STAGE:{
-            player->is_active = false;
+            player->setActive(false);
             if(this->active_player < this->players.size()){
                 this->active_player++;
@@ -106,5 +152,5 @@
             next->gameStage = REINFORCEMENT_STAGE;
             this->gameStage = REINFORCEMENT_STAGE;
-            next->is_active = true;
+            next->setActive(true);
             break;
         }
@@ -143,4 +189,33 @@
 }
 
+//Counts legit provinces(not including buttons)
+int Wagnis::provinceCount(){
+    int n = 0;
+    for(WagnisProvince* p: this->gameBoard->provs){
+        if(p != nullptr){
+            if(p->ID < 1000){
+                n++;
+            }
+        }else{
+            orxout()<<"Nullpointer found in provines!!!"<<endl;
+        }
+    }
+    return n;
+}
+
+int Wagnis::provincesOfPlayerCounter(int player){
+    int n = 0;
+    for(WagnisProvince* p:this->gameBoard->provs){
+        if(p != nullptr){
+            if(p->getOwner_ID() == player){
+                n++;
+            }
+        }else{
+            orxout()<<"Nullpointer found in provines!!!"<<endl;
+        }
+    }
+    return n;
+}
+
 
 
