MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / handleKeyDown

Method handleKeyDown

game/ui/tileview/cityview.cpp:3081–3290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3079}
3080
3081bool 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 {

Callers

nothing calls this directly

Calls 15

pickRandomFunction · 0.85
typeMethod · 0.80
insertMethod · 0.80
repairMethod · 0.80
crashMethod · 0.80
placeVehicleMethod · 0.80
getAliensMethod · 0.80
stageQueueCommandMethod · 0.80
isCheckedMethod · 0.80
findControlMethod · 0.80
isAliveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected