//--------------------------------------------------------------------------- #pragma hdrstop #include "Toadscape.h" Toadscape::Toadscape() : Landscape() { Squares.reserve(1000000); } //------------------------------------------------------------------------------ //FUNCTION: Toadscape::ReadLandscape //ARGUMENTS: None //RETURNS: Maximum cost value (integer) //NOTES: Reads landscape data from text files //------------------------------------------------------------------------------ // Differs from Landscape version in handling variable input file names #if VCL int Toadscape::ReadLandscape() { #if BATCH cout<<"Reading landscape attributes (costs, source, target)"<>txt>>cost; intarget>>txt>>target; #if READSOURCE insource>>txt>>source; #endif if (i == 0) xmax = cost; if (i == 1) ymax = cost; #if BATCH cout< -1; y--) { for (x = 0; x < xmax; x++) { incost>>cost; intarget>>target; #if READSOURCE insource>>source; #else source = 0; #endif if (cost < 0) { // NODATA square - record a zero pointer Squares.push_back(0); } else { // square with data - set up square in heap memory and store costs Squares.push_back(new Square(x,y)); Squares.back()->set_attributes(cost,source,target); } if (cost>max) max = cost; } } #if BATCH cout<<"Finished reading landscape attributes, xmax = "<