/** * Decreases the units to produce. * @param action A pointer to an Action. */ void ManufactureInfoState::lessUnitClick(Action *action) { if (action->getDetails()->button.button == SDL_BUTTON_RIGHT || action->getDetails()->button.button == SDL_BUTTON_LEFT) { _production->setInfiniteAmount(false); if (action->getDetails()->button.button == SDL_BUTTON_RIGHT || _production->getAmountTotal() <= _production->getAmountProduced()) { // So the produced item number is increased over the planned, OR it was simply a right-click _production->setAmountTotal(_production->getAmountProduced()+1); setAssignedEngineer(); } if (action->getDetails()->button.button == SDL_BUTTON_LEFT) lessUnit(1); } }
/** * Increases or decreases the Units to produce according the mouse-wheel used. * @param action A pointer to an Action. */ void ManufactureInfoState::handleWheelUnit(Action *action) { if (action->getDetails()->button.button == SDL_BUTTON_WHEELUP) moreUnit(Options::changeValueByMouseWheel); else if (action->getDetails()->button.button == SDL_BUTTON_WHEELDOWN) lessUnit(Options::changeValueByMouseWheel); }
/** * Builds one less unit( if possible). */ void ManufactureInfoState::onLessUnit() { _timerLessUnit->setInterval(50); lessUnit(1); }
/** * Decreases the units to produce. * @param action A pointer to an Action. */ void ManufactureInfoState::lessUnitClick(Action * action) { if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) lessUnit(std::numeric_limits<int>::max()); if (action->getDetails()->button.button == SDL_BUTTON_LEFT) lessUnit(1); }