Changeset aaf2113307 in tspsg for src/tspmodel.cpp


Ignore:
Timestamp:
Aug 3, 2009, 5:15:46 PM (15 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
f44855d99e
Parents:
e96fad3079
Message:

+ Implemented File/Save? action.
+ Added "Save Solution" and "Back to Task" buttons to Solution tab for better usability.

  • Increased maximum number of cities to 20. Solving for 18-20 cities is already takes much time, so I thought it doesn't make sense to increase more.
  • Columns and rows are now resized to contents on all platforms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tspmodel.cpp

    re96fad3079 raaf2113307  
    206206        if (loadError(ds->status()))
    207207                return false;
    208         // Cities number
     208        // Number of cities
    209209quint16 size;
    210210        *ds >> size;
    211211        if (loadError(ds->status()))
    212212                return false;
    213         if (size < 3) {
     213        if ((size < 3) || (size > MAX_NUM_CITIES)) {
    214214                QMessageBox(QMessageBox::Critical,trUtf8("Task Load"),trUtf8("Unable to load task:") + "\n" + trUtf8("Unexpected data read.\nFile is possibly corrupted."),QMessageBox::Ok).exec();
    215215                return false;
    216216        }
    217         if (nCities != size)
     217        if (nCities != size) {
     218                setNumCities(size);
    218219                emit numCitiesChanged(size);
    219         // Costs
     220        }
     221        // Travel costs
    220222        for (int r = 0; r < size; r++)
    221223                for (int c = 0; c < size; c++)
     
    246248                return false;
    247249        }
    248         // Cities number
     250        // Number of cities
    249251quint8 size;
    250252        ds->readRawData(reinterpret_cast<char *>(&size),1);
     
    255257                return false;
    256258        }
    257         if (nCities != size)
     259        if (nCities != size) {
     260                setNumCities(size);
    258261                emit numCitiesChanged(size);
    259         // Costs
     262        }
     263        // Travel costs
    260264double val;
    261265        for (int r = 0; r < 5; r++)
Note: See TracChangeset for help on using the changeset viewer.