MCPcopy Create free account
hub / github.com/ZDoom/Raze / SetupGame

Function SetupGame

source/core/gamecontrol.cpp:708–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

706//==========================================================================
707
708static 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 }

Callers 1

RunGameFunction · 0.85

Calls 15

GrpScanFunction · 0.85
G_SaveConfigFunction · 0.85
I_ErrorFunction · 0.85
GetGameFronUserFilesFunction · 0.85
stricmpFunction · 0.85
ExtractFileBaseFunction · 0.85
RTS_InitFunction · 0.85
CheckFrontendFunction · 0.85
CompareNoCaseMethod · 0.80
c_strMethod · 0.80
LenMethod · 0.80
MakeLowerMethod · 0.80

Tested by

no test coverage detected