MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CreateSingleMissionBank

Function CreateSingleMissionBank

engine/Poseidon/UI/OptionsUI.cpp:893–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

891 snprintf(path, sizeof(path), "%s\\%s", (const char*)dir, c->relPath);
892 c->result = path;
893 return true;
894 }
895 return false;
896}
897
898RString CreateSingleMissionBank(RString filename)
899{
900 // suppose filename is without extension (.pbo)
901
902 // Remove the previously created __cur_sp bank(s). Match with CmpStartStr —
903 // the same separator- and case-insensitive prefix test AutoBank uses to
904 // resolve reads. A plain strnicmp here is separator-sensitive, and
905 // SetPrefix() stores the prefix with platform-native separators
906 // (backslash -> slash on POSIX): on Linux the literal backslash prefix never
907 // matched, so old banks leaked and every template resolved to the first
908 // stale __cur_sp bank.
909 const char* prefix = "missions\\__cur_sp.";
910 for (int i = 0; i < GFileBanks.Size();)
911 {
912 QFBank& bank = GFileBanks[i];
913 if (CmpStartStr(bank.GetPrefix(), prefix) == 0)
914 {
915 if (GFileServer)
916 {
917 GFileServer->FlushBank(&bank);
918 }
919 if (GEngine && GEngine->TextBank())
920 {
921 GEngine->TextBank()->FlushBank(&bank);
922 }
923 if (GSoundsys)
924 {
925 GSoundsys->FlushBank(&bank);
926 }
927 GFileBanks.Delete(i);
928 }
929 else
930 {
931 i++;
932 }
933 }
934
935 // extract island name
936 const char* ext = strrchr(filename, '.');
937 if (!ext)
938 {
939 return "";
940 }
941 RString island = ext + 1;

Callers 4

OnTemplateChangedMethod · 0.85
DisplayWizardMapMethod · 0.85
OnChangeMissionMethod · 0.85
OnChildDestroyedMethod · 0.85

Calls 10

EnumModDirectoriesFunction · 0.85
LowerMethod · 0.80
SetPrefixMethod · 0.80
strnicmpFunction · 0.50
RStringClass · 0.50
SizeMethod · 0.45
GetPrefixMethod · 0.45
DeleteMethod · 0.45
AddMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected