MCPcopy Create free account
hub / github.com/bwapi/bwapi / getFileType

Function getFileType

bwapi/BWAPI/Source/DLLMain.cpp:71–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 // assume no error, would be fatal in Starcraft anyway
70}
71int getFileType(const std::string &sFileName)
72{
73 int rVal = 0;
74 Storm::CFile file;
75
76 if ( !sFileName.empty() )
77 {
78 // Open archive for map checking
79 Storm::CArchive archive(sFileName);
80 if ( archive )
81 {
82 // Open scenario.chk file
83 if ( archive.openFile("staredit\\scenario.chk") )
84 rVal = 1;
85 }
86 else if ( file.open(sFileName, SFILE_FROM_ABSOLUTE) )
87 {
88 // Read file data to check if it's a replay
89 char tbuff[16];
90 if ( file.read(tbuff, sizeof(tbuff)) && *(DWORD*)&tbuff[12] == 'SRer' )
91 rVal = 2;
92 }
93 }
94 return rVal;
95}
96
97//------------------------------------------------ BWAPI ERROR -----------------------------------------------
98void vBWAPIError(const char *format, va_list arg)

Callers 2

reloadConfigMethod · 0.85
onMenuFrameMethod · 0.85

Calls 3

openFileMethod · 0.80
openMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected