Moved from DoGameSetup so that it can happen after wads are loaded
| 393 | |
| 394 | // Moved from DoGameSetup so that it can happen after wads are loaded |
| 395 | void FGameConfigFile::DoKeySetup(const char *gamename) |
| 396 | { |
| 397 | static const struct { const char *label; FKeyBindings *bindings; } binders[] = |
| 398 | { |
| 399 | { "Bindings", &Bindings }, |
| 400 | { "DoubleBindings", &DoubleBindings }, |
| 401 | { "AutomapBindings", &AutomapBindings }, |
| 402 | { NULL, NULL } |
| 403 | }; |
| 404 | const char *key, *value; |
| 405 | |
| 406 | sublen = countof(section) - 1 - mysnprintf(section, countof(section), "%s.", gamename); |
| 407 | subsection = section + countof(section) - sublen - 1; |
| 408 | section[countof(section) - 1] = '\0'; |
| 409 | |
| 410 | C_SetDefaultBindings (); |
| 411 | |
| 412 | for (int i = 0; binders[i].label != NULL; ++i) |
| 413 | { |
| 414 | strncpy(subsection, binders[i].label, sublen); |
| 415 | if (SetSection(section)) |
| 416 | { |
| 417 | FKeyBindings *bindings = binders[i].bindings; |
| 418 | bindings->UnbindAll(); |
| 419 | while (NextInSection(key, value)) |
| 420 | { |
| 421 | bindings->DoBind(key, value); |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | OkayToWrite = true; |
| 426 | } |
| 427 | |
| 428 | void FGameConfigFile::ReadNetVars () |
| 429 | { |
no test coverage detected