| 706 | //========================================================================== |
| 707 | |
| 708 | static TArray<GrpEntry> SetupGame() |
| 709 | { |
| 710 | // Startup dialog must be presented here so that everything can be set up before reading the keybinds. |
| 711 | |
| 712 | auto groups = GrpScan(); |
| 713 | if (groups.Size() == 0) |
| 714 | { |
| 715 | // Abort if no game data found. |
| 716 | G_SaveConfig(); |
| 717 | I_Error("Unable to find any game data. Please verify your settings." |
| 718 | #ifdef WIN32 |
| 719 | ); |
| 720 | #else |
| 721 | "\nInstall game data files in subfolders of '%s'\n\n", M_GetAppDataPath(false).GetChars()); |
| 722 | #endif |
| 723 | } |
| 724 | |
| 725 | decltype(groups) usedgroups; |
| 726 | |
| 727 | int groupno = -1; |
| 728 | |
| 729 | auto game = GetGameFronUserFiles(); |
| 730 | if (userConfig.gamegrp.IsEmpty()) |
| 731 | { |
| 732 | for (auto& str : game) |
| 733 | { |
| 734 | int g = 0; |
| 735 | for (auto& grp : groups) |
| 736 | { |
| 737 | if (grp.FileInfo.gameid.CompareNoCase(str.c_str()) == 0) |
| 738 | { |
| 739 | userConfig.gamegrp = grp.FileName; |
| 740 | groupno = g; |
| 741 | goto foundit; |
| 742 | } |
| 743 | g++; |
| 744 | } |
| 745 | } |
| 746 | } |
| 747 | foundit: |
| 748 | |
| 749 | // If the user has specified a script, let's see if we know it. |
| 750 | // |
| 751 | if (groupno == -1 && userConfig.DefaultCon.Len()) |
| 752 | { |
| 753 | FString DefaultConlower = userConfig.DefaultCon.MakeLower(); |
| 754 | |
| 755 | int g = 0; |
| 756 | for (auto& grp : groups) |
| 757 | { |
| 758 | if (grp.FileInfo.scriptname.MakeLower() == DefaultConlower) |
| 759 | { |
| 760 | groupno = g; |
| 761 | break; |
| 762 | } |
| 763 | g++; |
| 764 | } |
| 765 | } |
no test coverage detected