Automatically adjust min/max encounter levels

This commit is contained in:
GriffinR
2023-07-31 14:55:53 -04:00
parent 0b293d2af0
commit 1ecb2cc369
3 changed files with 14 additions and 9 deletions

View File

@@ -155,13 +155,21 @@ bool EncounterTableModel::setData(const QModelIndex &index, const QVariant &valu
this->monInfo.wildPokemon[row].species = value.toString();
break;
case ColumnType::MinLevel:
this->monInfo.wildPokemon[row].minLevel = value.toInt();
case ColumnType::MinLevel: {
int minLevel = value.toInt();
this->monInfo.wildPokemon[row].minLevel = minLevel;
if (minLevel > this->monInfo.wildPokemon[row].maxLevel)
this->monInfo.wildPokemon[row].maxLevel = minLevel;
break;
}
case ColumnType::MaxLevel:
this->monInfo.wildPokemon[row].maxLevel = value.toInt();
case ColumnType::MaxLevel: {
int maxLevel = value.toInt();
this->monInfo.wildPokemon[row].maxLevel = maxLevel;
if (maxLevel < this->monInfo.wildPokemon[row].minLevel)
this->monInfo.wildPokemon[row].minLevel = maxLevel;
break;
}
case ColumnType::EncounterRate:
this->monInfo.encounterRate = value.toInt();