/** * Updates the depth slider accordingly when terrain selection changes. * @param action Pointer to an action. */ void NewBattleState::cbxTerrainChange(Action *) { AlienDeployment *ruleDeploy = _game->getMod()->getDeployment(_missionTypes[_cbxMission->getSelected()]); int minDepth = 0; int maxDepth = 0; if (ruleDeploy->getMaxDepth() > 0 || _game->getMod()->getTerrain(_terrainTypes.at(_cbxTerrain->getSelected()))->getMaxDepth() > 0 || (!ruleDeploy->getTerrains().empty() && _game->getMod()->getTerrain(ruleDeploy->getTerrains().front())->getMaxDepth() > 0)) { minDepth = 1; maxDepth = 3; } _txtDepth->setVisible(minDepth != maxDepth); _slrDepth->setVisible(minDepth != maxDepth); _slrDepth->setRange(minDepth, maxDepth); _slrDepth->setValue(minDepth); }