/** * Processes right clicking on facilities. * @param action Pointer to an action. */ void BasescapeState::viewRightClick(Action *) { BaseFacility *f = _view->getSelectedFacility(); if (f == 0) { _game->pushState(new BaseInfoState(_game, _base, this)); } else if (f->getRules()->getCrafts() > 0) { if (f->getCraft() == 0) { _game->pushState(new CraftsState(_game, _base)); } else for (size_t craft = 0; craft < _base->getCrafts()->size(); ++craft) { if (f->getCraft() == _base->getCrafts()->at(craft)) { _game->pushState(new CraftInfoState(_game, _base, craft)); break; } } } else if (f->getRules()->getStorage() > 0) { _game->pushState(new SellState(_game, _base)); } else if (f->getRules()->getPersonnel() > 0) { _game->pushState(new SoldiersState(_game, _base)); } else if (f->getRules()->getPsiLaboratories() > 0 && Options::anytimePsiTraining && _base->getAvailablePsiLabs() > 0) { _game->pushState(new AllocatePsiTrainingState(_game, _base)); } else if (f->getRules()->getLaboratories() > 0) { _game->pushState(new ResearchState(_game, _base)); } else if (f->getRules()->getWorkshops() > 0) { _game->pushState(new ManufactureState(_game, _base)); } else if (f->getRules()->getAliens() > 0) { _game->pushState(new ManageAlienContainmentState(_game, _base, OPT_GEOSCAPE)); } else if (f->getRules()->isLift() || f->getRules()->getRadarRange() > 0) { _game->popState(); } }
/** * Displays the name of the facility the mouse is over. * @param action Pointer to an action. */ void BasescapeState::viewMouseOver(Action *) { BaseFacility *f = _view->getSelectedFacility(); std::wostringstream ss; if (f != 0) { if (f->getRules()->getCrafts() == 0 || f->getBuildTime() > 0) { ss << tr(f->getRules()->getType()); } else { ss << tr(f->getRules()->getType()); if (f->getCraft() != 0) { ss << L" " << tr("STR_CRAFT_").arg(f->getCraft()->getName(_game->getLanguage())); } } } _txtFacility->setText(ss.str()); }