* Processes right clicking on facilities. * @param action Pointer to an action. */
| 392 | * @param action Pointer to an action. |
| 393 | */ |
| 394 | void BasescapeState::viewRightClick(Action *) |
| 395 | { |
| 396 | BaseFacility *f = _view->getSelectedFacility(); |
| 397 | if (f == 0) |
| 398 | { |
| 399 | _game->pushState(new BaseInfoState(_game, _base, this)); |
| 400 | } |
| 401 | else if (f->getRules()->getCrafts() > 0) |
| 402 | { |
| 403 | if (f->getCraft() == 0) |
| 404 | { |
| 405 | _game->pushState(new CraftsState(_game, _base)); |
| 406 | } |
| 407 | else |
| 408 | for (size_t craft = 0; craft < _base->getCrafts()->size(); ++craft) |
| 409 | { |
| 410 | if (f->getCraft() == _base->getCrafts()->at(craft)) |
| 411 | { |
| 412 | _game->pushState(new CraftInfoState(_game, _base, craft)); |
| 413 | break; |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | else if (f->getRules()->getStorage() > 0) |
| 418 | { |
| 419 | _game->pushState(new SellState(_game, _base)); |
| 420 | } |
| 421 | else if (f->getRules()->getPersonnel() > 0) |
| 422 | { |
| 423 | _game->pushState(new SoldiersState(_game, _base)); |
| 424 | } |
| 425 | else if (f->getRules()->getPsiLaboratories() > 0 && Options::anytimePsiTraining && _base->getAvailablePsiLabs() > 0) |
| 426 | { |
| 427 | _game->pushState(new AllocatePsiTrainingState(_game, _base)); |
| 428 | } |
| 429 | else if (f->getRules()->getLaboratories() > 0) |
| 430 | { |
| 431 | _game->pushState(new ResearchState(_game, _base)); |
| 432 | } |
| 433 | else if (f->getRules()->getWorkshops() > 0) |
| 434 | { |
| 435 | _game->pushState(new ManufactureState(_game, _base)); |
| 436 | } |
| 437 | else if (f->getRules()->getAliens() > 0) |
| 438 | { |
| 439 | _game->pushState(new ManageAlienContainmentState(_game, _base, OPT_GEOSCAPE)); |
| 440 | } |
| 441 | else if (f->getRules()->isLift() || f->getRules()->getRadarRange() > 0) |
| 442 | { |
| 443 | _game->popState(); |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * Displays the name of the facility the mouse is over. |
nothing calls this directly
no test coverage detected