Index: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	(revision 12129)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc	(revision 12130)
@@ -15,9 +15,14 @@
     this->gameBoard = nullptr;
     this->gameStage = NOT_READY;
+    this->active_player = 1;
 
     int n = 3;
+    this->players.push_back(nullptr);
     for(int i = 1;i <= n;i++){
         WagnisPlayer* p = new WagnisPlayer(context);
         p->gameBoard = this->gameBoard;
+        p->Player_ID = i;
+        p->master = this;
+        //p->finishedStageCallback = &Wagnis::playerFinishedStage;
         this->players.push_back(p);
     }
@@ -29,6 +34,12 @@
 //Runs the game
 void Wagnis::start(){
-    //SUPER(Wagnis,start);
-    this->createGame();
+    Deathmatch::start();
+    if(this->gameStage == NOT_READY){
+        this->createGame();
+    }
+
+    //this->gameStage = CHOOSE_PROVINCE_STAGE;
+    //this->players[1]->gameStage = this->gameStage;
+    //this->players[1]->is_active = true;
 }
 
@@ -38,14 +49,65 @@
 }
 
+
+
+/**
+ * Callback function for Player classes. Needs to be called for the game to go on.
+ * arg: player: pointer to the player which finished his stage.
+ * (used to deactivate player after finishing)
+ * enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE };
+ **/
+void Wagnis::playerFinishedStage(WagnisPlayer* player){
+
+    /////////////////TEST////////////
+    orxout()<<"juhuuuuuuuuuuuuuuuuuuu"<<endl;
+    /////////////////TEST////////////
+
+    if(this->active_player != player->Player_ID){
+        orxout()<<"shit happend. This player should not be activ. Wagnis::playerFinishedStage was called from wrong player"<<endl;
+    }
+    switch(this->gameStage){
+        case CHOOSE_PROVINCE_STAGE:{
+            player->is_active = false;
+            if(this->active_player+1 < this->players.size()){
+                this->active_player++;
+                this->players[this->active_player]->gameStage = CHOOSE_PROVINCE_STAGE;
+                this->players[this->active_player]->is_active = true;
+            }else{
+                this->active_player = 1;
+                this->players[this->active_player]->gameStage = REINFORCEMENT_STAGE;
+                this->players[this->active_player]->is_active = true;
+            }
+            break;
+        }
+        case REINFORCEMENT_STAGE:{
+            
+        }
+        case ATTACK_STAGE:{
+            
+        }
+        case MOVE_STAGE:{
+            
+        }
+    }
+}
+
+
+
+
 //Creates and links all needed classes
-void Wagnis::createGame(){\
-    orxout() << "Game creation started";
+void Wagnis::createGame(){
+    orxout() << "Game creation started" << endl;
 
     if(!findGameBoard()){
-        orxout() << "Error: GameBoard not found";
+        orxout() << "Error: GameBoard not found" << endl;
     }
 
-    this->gameBoard->initializeNeighbors();
-    orxout() << "Game creation finished";
+    //this->gameBoard->initializeNeighbors();
+
+    //for(WagnisPlayer* p: this->players){
+        //this->playerEntered(p);
+    //}
+    
+    orxout() << "Game creation finished" << endl;
 }
 
@@ -54,5 +116,5 @@
     for (WagnisGameboard* gb : ObjectList<WagnisGameboard>()){
         this->gameBoard = gb;
-        orxout()<<"Gameboard pointer found and added";
+        orxout()<<"Gameboard pointer found and added"<<endl;
         return true;
     }
Index: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h	(revision 12129)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h	(revision 12130)
@@ -38,4 +38,5 @@
         void start();
         void tick(float);
+        void playerFinishedStage(WagnisPlayer*);
 
 
@@ -44,4 +45,5 @@
 
         private:
+        int active_player;
         GameStage gameStage;
         std::vector<WagnisPlayer*> players;
Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc	(revision 12129)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc	(revision 12130)
@@ -12,11 +12,8 @@
     WagnisGameboard::WagnisGameboard(Context* context) : StaticEntity(context){
         RegisterObject(WagnisGameboard);
+        this->connections_string = "";
     }
+    WagnisGameboard::~WagnisGameboard(){}
 
-    WagnisGameboard::~WagnisGameboard(){
-        for(WagnisProvince* prov:this->provs){
-            prov->destroy();
-        }
-    }
     void WagnisGameboard::XMLPort(Element& xmlelement,XMLPort::Mode mode){
         SUPER(WagnisGameboard, XMLPort, xmlelement, mode);
@@ -63,4 +60,5 @@
     //Syntax: 32=7-8-4  , 2=33+5+7+1+4
     void WagnisGameboard::initializeNeighbors(){
+        
         std::string str = this->connections_string;
         orxout() << "inizializing started" << endl;
@@ -69,8 +67,7 @@
         unsigned int n = 0;
         while(n < str.size()){
-            orxout() << "test1" << endl;
             int tmp = parse_int(str,n);
-            n = tmp | 0x0000FFFF;
-            int origin_ID = tmp / (2<<16);
+            n = tmp & 0x0000FFFF;
+            int origin_ID = tmp >> 16;
             if(n == str.size() || str[n] != '='){
                 orxout() << "Error while parsing neighbors-string: '=' expected at position: "<< n << endl;
@@ -81,6 +78,6 @@
                 n++;
                 tmp = parse_int(str,n);
-                n = tmp | 0x0000FFFF;
-                other_ID = tmp / (2<<16);
+                n = tmp & 0x0000FFFF;
+                other_ID = tmp >> 16;
 
                 for(WagnisProvince* orig:this->provs){
@@ -96,7 +93,7 @@
                     break;
                 }
-            }while(n < str.size() && str[n] == '+');
+            }while((n < str.size()) && (str[n] == '+'));
             if(n == str.size()) return;
-            while(n < str.size() && str[n] == ' ') n++;
+            while((n < str.size()) && (str[n] == ' ')) n++;
             if(n == str.size()) return;
             if(str[n] != ','){
Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	(revision 12129)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	(revision 12130)
@@ -30,4 +30,15 @@
         SUPER(WagnisPlayer, tick, dt);
 
+        ///////////TEST//////////////
+        /**
+        if(this->is_active){
+            (master ->* ((orxonox::WagnisPlayer*)this)->orxonox::WagnisPlayer::finishedStageCallback) (this);
+        }
+
+        **/
+        ///////////TEST//////////////
+
+
+
         if(this->is_active)
         {
@@ -45,8 +56,8 @@
 
             if((this->province_selection_changed && this->origin_province != nullptr && this->target_province != nullptr)
-            ||(this->province_selection_changed && this->target_province != nullptr && ((gamestage == CHOOSE_PROVINCE_STAGE)||(gamestage == REINFORCEMENT_STAGE)))){
+            ||(this->province_selection_changed && this->target_province != nullptr && ((gameStage == CHOOSE_PROVINCE_STAGE)||(gameStage == REINFORCEMENT_STAGE)))){
                 
                 this->province_selection_changed = false;
-                switch(gamestage){
+                switch(gameStage){
                     case CHOOSE_PROVINCE_STAGE: 
                     {   
@@ -107,4 +118,6 @@
                         break;
                     }
+
+                    default: break;
                 }
             }
Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	(revision 12129)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	(revision 12130)
@@ -39,5 +39,7 @@
 
 
-        GameStage gamestage;
+        //void (Wagnis::*finishedStageCallback) (WagnisPlayer*);
+        Wagnis* master;
+        GameStage gameStage;
         bool province_selection_changed;
         bool is_active;
