/[projectaxis]/projectaxis/projectAxis/src/map/blotchmaker.cpp
ViewVC logotype

Diff of /projectaxis/projectAxis/src/map/blotchmaker.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by leiavoia, Sat Aug 23 17:32:52 2003 UTC revision 1.6 by leiavoia, Sun Sep 14 01:00:50 2003 UTC
# Line 205  if (verbose) {cout << "Selected: " <<  b Line 205  if (verbose) {cout << "Selected: " <<  b
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    
# Line 221  bool Blotchmaker::DoNextTile () { Line 224  bool Blotchmaker::DoNextTile () {
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) {
# Line 250  if (tile_count == 1) { Line 275  if (tile_count == 1) {
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
# Line 924  int Blotchmaker::GetMaxBlotches() { retu Line 950  int Blotchmaker::GetMaxBlotches() { retu
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;
# Line 960  bool Blotchmaker::SaveConfigs() { Line 986  bool Blotchmaker::SaveConfigs() {
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

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26