[Orxonox-commit 7471] r12077 - in code/branches/wagnis_HS18: data/levels src/modules/wagnis
kunzro at orxonox.net
kunzro at orxonox.net
Wed Nov 7 10:23:46 CET 2018
Author: kunzro
Date: 2018-11-07 10:23:46 +0100 (Wed, 07 Nov 2018)
New Revision: 12077
Modified:
code/branches/wagnis_HS18/data/levels/Wagnis.oxw
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h
Log:
gameboard string fixed
Modified: code/branches/wagnis_HS18/data/levels/Wagnis.oxw
===================================================================
--- code/branches/wagnis_HS18/data/levels/Wagnis.oxw 2018-11-07 09:21:44 UTC (rev 12076)
+++ code/branches/wagnis_HS18/data/levels/Wagnis.oxw 2018-11-07 09:23:46 UTC (rev 12077)
@@ -47,7 +47,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" />
-<WagnisGameboard position="0,0,0" connections_string="1=2,2=1-1000,1000=2 ">
+<WagnisGameboard position="0,0,0" connections_string="1=2+1000, 2=1, 1000=1">
<Provinces>
@@ -69,6 +69,7 @@
</attached>
</WagnisProvince>
+
</Provinces>
</WagnisGameboard>
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc 2018-11-07 09:21:44 UTC (rev 12076)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc 2018-11-07 09:23:46 UTC (rev 12077)
@@ -37,12 +37,6 @@
orxout() << "added" << endl;
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
WagnisProvince* WagnisGameboard::getProvince(unsigned int index) const{
@@ -65,7 +59,7 @@
//Parses the string and initializes the neigbors vector of all provinces according
- //Syntax: 32=7-8-4 , 2=33-5-7-1-4
+ //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;
@@ -78,7 +72,7 @@
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;
+ orxout() << "Correct syntax: 32=4+2+5+67, 54=8+1+12" << endl;
}
int other_ID;
do{
@@ -99,13 +93,13 @@
}
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++;
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;
+ orxout() << "Correct syntax: 32=4+2+5+67, 54=8+1+12" << endl;
}
n++;
while(n < str.size() && str[n] == ' ') n++;
@@ -122,7 +116,7 @@
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;
+ orxout() << "Correct syntax: 32=4+2+5+67, 54=8+1+12" << endl;
}
n++;
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h 2018-11-07 09:21:44 UTC (rev 12076)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h 2018-11-07 09:23:46 UTC (rev 12077)
@@ -33,13 +33,13 @@
void setConnections_string(const std::string&);
std::string getConnections_string() const;
//
-
+ std::string connections_string;
void initializeNeighbors(std::string);
private:
std::vector<WagnisProvince*> provs;
- std::string connections_string;
+
int parse_int(std::string,unsigned int);
};
}
More information about the Orxonox-commit
mailing list