Changeset 12077 for code/branches
- Timestamp:
- Nov 7, 2018, 10:23:46 AM (6 years ago)
- Location:
- code/branches/wagnis_HS18
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/data/levels/Wagnis.oxw
r12072 r12077 48 48 <SpawnPoint position="100, 45, 75" lookat="0, 45, 75" /> 49 49 50 <WagnisGameboard position="0,0,0" connections_string="1=2 ,2=1-1000,1000=2">50 <WagnisGameboard position="0,0,0" connections_string="1=2+1000, 2=1, 1000=1"> 51 51 52 52 <Provinces> … … 69 69 </attached> 70 70 </WagnisProvince> 71 71 72 72 73 </Provinces> -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
r12072 r12077 38 38 orxout() << province->getID() << endl; 39 39 this->provs.push_back(province); 40 41 if(province->getID() == 1000){42 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;43 orxout() << "-----neighbors-----" << endl << endl;44 initializeNeighbors(this->connections_string);45 }46 40 } 47 41 //XML get province … … 66 60 67 61 //Parses the string and initializes the neigbors vector of all provinces according 68 //Syntax: 32=7-8-4 , 2=33 -5-7-1-462 //Syntax: 32=7-8-4 , 2=33+5+7+1+4 69 63 void WagnisGameboard::initializeNeighbors(std::string str){ 70 64 orxout() << "inizializing started" << endl; … … 79 73 if(n == str.size() || str[n] != '='){ 80 74 orxout() << "Error while parsing neighbors-string: '=' expected at position: "<< n << endl; 81 orxout() << "Correct syntax: 32=4 -2-5-67, 54=8-1-12" << endl;75 orxout() << "Correct syntax: 32=4+2+5+67, 54=8+1+12" << endl; 82 76 } 83 77 int other_ID; … … 100 94 break; 101 95 } 102 }while(n < str.size() && str[n] == ' -');96 }while(n < str.size() && str[n] == '+'); 103 97 if(n == str.size()) return; 104 98 while(n < str.size() && str[n] == ' ') n++; … … 106 100 if(str[n] != ','){ 107 101 orxout() << "Error while parsing neighbors-string: ',' expected at position: "<< n << endl; 108 orxout() << "Correct syntax: 32=4 -2-5-67, 54=8-1-12" << endl;102 orxout() << "Correct syntax: 32=4+2+5+67, 54=8+1+12" << endl; 109 103 } 110 104 n++; … … 123 117 if(digit < 0 || digit > 9){ 124 118 orxout() << "Error while parsing neighbors-string: Digit expected at position: "<< n << endl; 125 orxout() << "Correct syntax: 32=4 -2-5-67, 54=8-1-12" << endl;119 orxout() << "Correct syntax: 32=4+2+5+67, 54=8+1+12" << endl; 126 120 } 127 121 -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h
r12072 r12077 34 34 std::string getConnections_string() const; 35 35 // 36 36 std::string connections_string; 37 37 void initializeNeighbors(std::string); 38 38 … … 40 40 private: 41 41 std::vector<WagnisProvince*> provs; 42 std::string connections_string;42 43 43 int parse_int(std::string,unsigned int); 44 44 };
Note: See TracChangeset
for help on using the changeset viewer.