| 3079 | } |
| 3080 | |
| 3081 | bool CityView::handleKeyDown(Event *e) |
| 3082 | { |
| 3083 | // Common keys active in both debug and normal mode |
| 3084 | switch (e->keyboard().KeyCode) |
| 3085 | { |
| 3086 | case SDLK_RSHIFT: |
| 3087 | modifierRShift = true; |
| 3088 | return true; |
| 3089 | case SDLK_LSHIFT: |
| 3090 | modifierLShift = true; |
| 3091 | return true; |
| 3092 | case SDLK_RALT: |
| 3093 | modifierRAlt = true; |
| 3094 | return true; |
| 3095 | case SDLK_LALT: |
| 3096 | modifierLAlt = true; |
| 3097 | return true; |
| 3098 | case SDLK_RCTRL: |
| 3099 | modifierRCtrl = true; |
| 3100 | return true; |
| 3101 | case SDLK_LCTRL: |
| 3102 | modifierLCtrl = true; |
| 3103 | return true; |
| 3104 | } |
| 3105 | |
| 3106 | if (e->type() == EVENT_KEY_DOWN) |
| 3107 | { |
| 3108 | // Cheat codes |
| 3109 | if (debugHotkeyMode) |
| 3110 | { |
| 3111 | switch (e->keyboard().KeyCode) |
| 3112 | { |
| 3113 | case SDLK_r: |
| 3114 | { |
| 3115 | LogInfo("Repairing..."); |
| 3116 | std::set<sp<Scenery>> stuffToRepair; |
| 3117 | for (auto &s : state->current_city->scenery) |
| 3118 | { |
| 3119 | if (s->damaged || !s->isAlive()) |
| 3120 | { |
| 3121 | stuffToRepair.insert(s); |
| 3122 | } |
| 3123 | } |
| 3124 | LogInfo("Repairing %u tiles out of %u", |
| 3125 | static_cast<unsigned>(stuffToRepair.size()), |
| 3126 | static_cast<unsigned>(state->current_city->scenery.size())); |
| 3127 | |
| 3128 | for (auto &s : stuffToRepair) |
| 3129 | { |
| 3130 | s->repair(*state); |
| 3131 | } |
| 3132 | return true; |
| 3133 | } |
| 3134 | case SDLK_x: |
| 3135 | { |
| 3136 | LogWarning("Crashing!"); |
| 3137 | for (auto &v : state->vehicles) |
| 3138 | { |
nothing calls this directly
no test coverage detected