* Handle key shortcuts. * @param action Pointer to an action. */
| 453 | * @param action Pointer to an action. |
| 454 | */ |
| 455 | void GeoscapeState::handle(Action *action) |
| 456 | { |
| 457 | if (_dogfights.size() == _minimizedDogfights) |
| 458 | { |
| 459 | State::handle(action); |
| 460 | } |
| 461 | |
| 462 | if (action->getDetails()->type == SDL_KEYDOWN) |
| 463 | { |
| 464 | // "ctrl-d" - enable debug mode |
| 465 | if (Options::debug && action->getDetails()->key.keysym.sym == SDLK_d && (SDL_GetModState() & KMOD_CTRL) != 0) |
| 466 | { |
| 467 | _game->getSavedGame()->setDebugMode(); |
| 468 | if (_game->getSavedGame()->getDebugMode()) |
| 469 | { |
| 470 | _txtDebug->setText(L"DEBUG MODE"); |
| 471 | } |
| 472 | else |
| 473 | { |
| 474 | _txtDebug->setText(L""); |
| 475 | } |
| 476 | } |
| 477 | // quick save and quick load |
| 478 | else if (!_game->getSavedGame()->isIronman()) |
| 479 | { |
| 480 | if (action->getDetails()->key.keysym.sym == Options::keyQuickSave) |
| 481 | { |
| 482 | popup(new SaveGameState(_game, OPT_GEOSCAPE, SAVE_QUICK)); |
| 483 | } |
| 484 | else if (action->getDetails()->key.keysym.sym == Options::keyQuickLoad) |
| 485 | { |
| 486 | popup(new LoadGameState(_game, OPT_GEOSCAPE, SAVE_QUICK)); |
| 487 | } |
| 488 | } |
| 489 | } |
| 490 | if (!_dogfights.empty()) |
| 491 | { |
| 492 | for(std::list<DogfightState*>::iterator it = _dogfights.begin(); it != _dogfights.end(); ++it) |
| 493 | { |
| 494 | (*it)->handle(action); |
| 495 | } |
| 496 | _minimizedDogfights = minimizedDogfightsCount(); |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | /** |
| 501 | * Updates the timer display and resets the palette |
no test coverage detected