Index: code/branches/wagnis_HS18/data/levels/Wagnis.oxw
===================================================================
--- code/branches/wagnis_HS18/data/levels/Wagnis.oxw	(revision 12069)
+++ code/branches/wagnis_HS18/data/levels/Wagnis.oxw	(revision 12072)
@@ -48,6 +48,8 @@
     <SpawnPoint position="100, 45, 75" lookat="0, 45, 75" />
 
-<WagnisGameboard position="0,0,0">
- <Provinces>
+<WagnisGameboard position="0,0,0" connections_string="1=2,2=1-1000,1000=2  ">
+
+  <Provinces>
+
     <WagnisProvince ID="1" continent="1" position="0,30,30" 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>
@@ -62,7 +64,9 @@
     </WagnisProvince>
 
-
-
-
+    <WagnisProvince ID="1000" continent="1" position="0,40,40" 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="2,2,2" />
+      </attached>
+    </WagnisProvince>
 
   </Provinces>
Index: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h	(revision 12069)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h	(revision 12072)
@@ -2,5 +2,19 @@
 #include "WagnisProvince.h"
 
-// todo: klassen zusammenfassen
+/** Die Wagnis Klasse hat die folgenden Aufgaben:
+ *  1. Das Spiel erstellen.
+ *  - Gameboard initialisieren
+ *  - Provinzen initialisieren
+ *  - Provinzen verbinden (Nachbarschaften eintragen)
+ *  - Spieler initialisieren
+ *  -
+ * 
+ *  2. Den Spielablauf steuern
+ *  - Für einen Spieler berechnen wie viele Truppen er setzen darf.
+ *  - Den Funktion "setTroops(int troops)" beim Spieler aufrufen.
+ *  - Die Funktion "playerTurn()" bei jedem Spieler aufrufen.
+ *  - 
+ * 
+ **/
 
 namespace orxonox
@@ -11,31 +25,16 @@
 
         // to start the game
-        void createGame;        // creates and links provinces
+        void createGame();        // creates and links provinces
+
         
-            void setPlayers;        // initialises players
-            void chooseProvinces    // players can choose their provinces 
-        
-
-        void playerTurn         // each players turn
-           
-            void setTroops;         // get and set your reinforcements
-            void attack;            // attack neighbouring provinces
-            void moveTroops;        // move troops from one province to another
-        
-            // additional checking funtions
-            int  troopCounter;       // counts how many reinforcements player gets
-            bool attackChecker;     // checks whether an attack move is valid
+        // additional checking funtions
+        int troopCounter(int);       // counts how many reinforcements player gets
+        bool attackChecker;     // checks whether an attack move is valid
                                     // (provinces linked, enough troops, no own province) 
-            bool moveChecker;       // checks whether a troop movement is valid
+        bool moveChecker;       // checks whether a troop movement is valid
                                     // (start and target belong to player, link existing)
-            void attackSimulator;   // calculates outcome of battle 
+        void attackSimulator;   // calculates outcome of battle 
         
     
-        private:
-            
-            int owner_ID;
-            int troops;
-            int ID;
-            int continent;
     }
 
Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc	(revision 12069)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc	(revision 12072)
@@ -3,4 +3,5 @@
 #include "BulletDynamics/Dynamics/btRigidBody.h"
 #include <vector>
+#include <string>
 
 
@@ -15,17 +16,21 @@
     WagnisGameboard::~WagnisGameboard(){
         for(WagnisProvince* prov:this->provs){
-            prov->destroy(); //destroys all Provinces
+            prov->destroy();
         }
+    }
+    void WagnisGameboard::XMLPort(Element& xmlelement,XMLPort::Mode mode){
+        SUPER(WagnisGameboard, XMLPort, xmlelement, mode);
+
+        XMLPortObject(WagnisGameboard, WagnisProvince, "Provinces", addProvince, getProvince, xmlelement, mode);
+        XMLPortParam(WagnisGameboard, "connections_string", setConnections_string, getConnections_string, xmlelement, mode);
     }
 
 
 
-    //XML Port
-    void WagnisGameboard::XMLPort(Element& xmlelement,XMLPort::Mode mode){
-        SUPER(WagnisGameboard, XMLPort, xmlelement, mode);
 
-        XMLPortObject(WagnisGameboard, WagnisProvince, "Provinces", addProvince, getProvince, xmlelement, mode);
-    }
-    //XML add province
+
+
+
+    //XML FUNCTIONS
     //Adds a Province to the Gameboard
     void WagnisGameboard::addProvince(WagnisProvince* province){
@@ -33,4 +38,10 @@
         orxout() << province->getID() << endl;
         this->provs.push_back(province);
+        
+        if(province->getID() == 1000){
+            orxout() << "You added a province with ID 1000.\nThis is the magic debug number.\nThe function to initialize the neighbors of all provinces will be called:" << endl;
+            orxout() << "-----neighbors-----" << endl << endl;
+            initializeNeighbors(this->connections_string);
+        }
     }
     //XML get province
@@ -39,3 +50,88 @@
         return this->provs.at(index);
     }
+    //XML set connections_string
+    void WagnisGameboard::setConnections_string(const std::string& str){
+        this->connections_string = str;
+    }
+    //XML get connections_string
+    std::string WagnisGameboard::getConnections_string() const{
+        return this -> connections_string;
+    }
+
+
+
+
+
+
+
+    //Parses the string and initializes the neigbors vector of all provinces according
+    //Syntax: 32=7-8-4  , 2=33-5-7-1-4
+    void WagnisGameboard::initializeNeighbors(std::string str){
+        orxout() << "inizializing started" << endl;
+        orxout() << "String size:" << endl;
+        orxout() << str.size() << endl;
+        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);
+            if(n == str.size() || str[n] != '='){
+                orxout() << "Error while parsing neighbors-string: '=' expected at position: "<< n << endl;
+                orxout() << "Correct syntax: 32=4-2-5-67, 54=8-1-12" << endl;
+            }
+            int other_ID;
+            do{
+                n++;
+                tmp = parse_int(str,n);
+                n = tmp | 0x0000FFFF;
+                other_ID = tmp / (2<<16);
+
+                for(WagnisProvince* orig:this->provs){
+                    if(orig->getID() == origin_ID){
+                        for(WagnisProvince* other:this->provs){
+                            if(other->getID() == other_ID){
+                                orig->addNeighbor(other);
+                                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;
+            if(str[n] != ','){
+                orxout() << "Error while parsing neighbors-string: ',' expected at position: "<< n << endl;
+                orxout() << "Correct syntax: 32=4-2-5-67, 54=8-1-12" << endl;
+            }
+            n++;
+            while(n < str.size() && str[n] == ' ') n++;
+        }
+    }
+
+    //Returns the parsed int and the offset encoded in an int. the upper 16bit(incl MSB) is the number
+    //and the lower 16 bits is the new n(after the last digit)
+    int WagnisGameboard::parse_int(std::string str,unsigned int n){
+        if(n >= str.size()){
+            orxout() << "Error while parsing neighbors-string: Internal error at WagnisGameboard::parse_int() "<< endl;
+        }
+        int digit = str[n] - '0';
+        int number = digit;
+        if(digit < 0 || digit > 9){
+            orxout() << "Error while parsing neighbors-string: Digit expected at position: "<< n << endl;
+            orxout() << "Correct syntax: 32=4-2-5-67, 54=8-1-12" << endl;
+        }
+
+        n++;
+        while(n < str.size() && str[n] - '0' >= 0 && str[n] - '0' < 10){
+            digit = str[n] - '0';
+            number = 10 * number;
+            number += digit;
+            n++;
+        }
+        return (number << 16)+n;
+    }
 }
Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h	(revision 12069)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h	(revision 12072)
@@ -15,4 +15,5 @@
 #include "core/XMLPort.h"
 #include "worldentities/StaticEntity.h"
+#include <string>
 #include <vector>
 
@@ -30,9 +31,15 @@
         void addProvince(WagnisProvince*);
         WagnisProvince* getProvince(unsigned int) const;
+        void setConnections_string(const std::string&);
+        std::string getConnections_string() const;
         //
+
+        void initializeNeighbors(std::string);
 
     
     private:
         std::vector<WagnisProvince*> provs;
+        std::string connections_string;
+        int parse_int(std::string,unsigned int);
     };
 }
Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	(revision 12069)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	(revision 12072)
@@ -72,8 +72,7 @@
     }
 
-    //Creates a connection between two provinces.
+    //Adds a connection to neighbors.
     void WagnisProvince::addNeighbor(WagnisProvince* prov){
         neighbors.push_back(prov);
-        prov->neighbors.push_back(this);
     }
 }
