205 |
|
|
206 |
// start placing tiles |
// start placing tiles |
207 |
|
|
208 |
while(tile_count < blotch_type->tiles_per_blotch) { DoNextTile(); } |
while(tile_count < blotch_type->tiles_per_blotch) { |
209 |
|
bool failed = DoNextTile(); |
210 |
|
if (failed == 1) {break;} |
211 |
|
} |
212 |
|
|
213 |
tile_count = 0; |
tile_count = 0; |
214 |
|
|
224 |
// Returns: 0 if good, 1 if terminated. |
// Returns: 0 if good, 1 if terminated. |
225 |
|
|
226 |
// do a random second tile, if needed, to establish a vector |
// do a random second tile, if needed, to establish a vector |
227 |
|
/*if (tile_count == 1) { |
228 |
|
switch ( int(rand()%4) ) { |
229 |
|
case 0: |
230 |
|
this_tile.x = prev_tile.x + blotch_type->step; |
231 |
|
this_tile.y = prev_tile.y; |
232 |
|
break; |
233 |
|
case 1: |
234 |
|
this_tile.x = prev_tile.x - blotch_type->step; |
235 |
|
this_tile.y = prev_tile.y; |
236 |
|
break; |
237 |
|
case 2: |
238 |
|
this_tile.x = prev_tile.x; |
239 |
|
this_tile.y = prev_tile.y + blotch_type->step; |
240 |
|
break; |
241 |
|
case 3: |
242 |
|
this_tile.x = prev_tile.x; |
243 |
|
this_tile.y = prev_tile.y - blotch_type->step; |
244 |
|
break; |
245 |
|
} |
246 |
|
} |
247 |
|
*/ |
248 |
|
|
249 |
if (tile_count == 1) { |
if (tile_count == 1) { |
250 |
bool gotcha = 0; |
bool gotcha = 0; |
251 |
while (gotcha == 0) { |
while (gotcha == 0) { |
275 |
tile_count++; |
tile_count++; |
276 |
gotcha = 1; |
gotcha = 1; |
277 |
} |
} |
278 |
|
else { return 1; } // terminate - sometimes brush step is out of bounds in all directions |
279 |
} |
} |
280 |
return 0; |
return 0; |
281 |
} // end random second tile |
} // end random second tile |
950 |
|
|
951 |
|
|
952 |
|
|
953 |
bool Blotchmaker::SaveConfigs() { |
bool Blotchmaker::SaveConfigs(const char* filename) { |
954 |
std::ofstream file("userdata/last.bmc"); |
std::ofstream file(filename); |
955 |
|
|
956 |
// global configs |
// global configs |
957 |
file << "// BLOTCHMAKER CONFIGURATION FILE - format v0.1" << endl; |
file << "// BLOTCHMAKER CONFIGURATION FILE - format v0.1" << endl; |
986 |
} |
} |
987 |
|
|
988 |
|
|
989 |
bool Blotchmaker::LoadConfigs() { |
bool Blotchmaker::LoadConfigs(const char* filename) { |
990 |
std::ifstream file("userdata/last.bmc", ios::in); |
std::ifstream file(filename, ios::in); |
991 |
|
|
992 |
if (file.bad()) { cout << "file opening problem" << endl << flush; return 0;} |
if (file.bad()) { cout << "file opening problem" << endl << flush; return 0;} |
993 |
char b[100]; // buffer |
char b[100]; // buffer |