/** * Increases the "units to produce", in the case of a right-click, to infinite, and 1 on left-click. * @param action A pointer to an Action. */ void ManufactureInfoState::moreUnitClick(Action *action) { if (_production->getInfiniteAmount()) return; // We can't increase over infinite :) if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) { if (_production->getRules()->getCategory() == "STR_CRAFT") { moreUnit(std::numeric_limits<int>::max()); } else { _production->setInfiniteAmount(true); setAssignedEngineer(); } } else if (action->getDetails()->button.button == SDL_BUTTON_LEFT) { moreUnit(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 more unit. */ void ManufactureInfoState::onMoreUnit() { _timerMoreUnit->setInterval(50); moreUnit(1); }
/** * Increases the units to produce to 999 or to $$$ when allowAutoSellProduction is true. * @param action A pointer to an Action. */ void ManufactureInfoState::moreUnitClick(Action * action) { if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) moreUnit(Options::getBool("allowAutoSellProduction") ? std::numeric_limits<int>::max() : (999 - _production->getAmountTotal())); if (action->getDetails()->button.button == SDL_BUTTON_LEFT) moreUnit(1); }