Changeset 47c811cc09 in tspsg for src/tspmodel.cpp


Ignore:
Timestamp:
Oct 13, 2012, 9:02:50 PM (12 years ago)
Author:
Oleksii Serdiuk
Branches:
appveyor, imgbot, master, readme
Children:
b96b44b6b7
Parents:
07e43cf61a
Message:

Added a way to change maximum number of cities without recompiling.

Added Tweaks/MaxNumCitites? setting to tspsg.ini. The maximum number of
cities limit can be controlled by setting it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tspmodel.cpp

    r07e43cf61a r47c811cc09  
    432432        return false;
    433433    }
    434     if (size > MAX_NUM_CITIES) {
    435         QApplication::restoreOverrideCursor();
    436         QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
    437         QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n"
    438             + tr("The task contains more cities (%1) than this version of %3 supports (%2).\n"
    439                  "You might be using an old version of the application or the file could be corrupted.")
    440                  .arg(size).arg(MAX_NUM_CITIES).arg(QApplication::applicationName()));
     434    if (size > settings->value("Tweaks/MaxNumCities", MAX_NUM_CITIES).toInt()) {
     435        QApplication::restoreOverrideCursor();
     436        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
     437        if (settings->contains("Tweaks/MaxNumCities")) {
     438            QMessageBox::critical(
     439                        QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n"
     440                        + tr("Your Tweaks/MaxNumCities setting in tspsg.ini is currently set to %1"
     441                             " but the task you're trying to load contains %2 cities.\n"
     442                             "Please, set Tweaks/MaxNumCities setting to at least %2"
     443                             " to be able to load this task.")
     444                        .arg(settings->value("Tweaks/MaxNumCities").toInt()).arg(size));
     445        } else {
     446            QMessageBox::critical(
     447                        QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n"
     448                        + tr("The maximum number of cities this version of %1 supports is %2"
     449                             " but the task you're trying to load contains %3.\n"
     450                             "You might be using an old version of the application or the file"
     451                             " could be corrupted.")
     452                        .arg(QApplication::applicationName()).arg(MAX_NUM_CITIES).arg(size));
     453        }
    441454        QApplication::restoreOverrideCursor();
    442455        return false;
Note: See TracChangeset for help on using the changeset viewer.