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

Function LoadAIBinary

bwapi/BWScriptEmulator/ScriptThread.cpp:56–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56bool LoadAIBinary(const char *pszFileName)
57{
58 HANDLE hFile = CreateFileA(pszFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
59 if ( hFile == INVALID_HANDLE_VALUE )
60 return false;
61
62 DWORD dwFileSize = GetFileSize(hFile, NULL);
63 if ( dwFileSize <= 10 )
64 {
65 CloseHandle(hFile);
66 return false;
67 }
68 pbAIScriptBinary = (BYTE*)malloc(dwFileSize);
69 if ( !pbAIScriptBinary )
70 {
71 CloseHandle(hFile);
72 return false;
73 }
74 memset(pbAIScriptBinary, 0, dwFileSize);
75
76 DWORD dwBytesRead = 0;
77 ReadFile(hFile, pbAIScriptBinary, dwFileSize, &dwBytesRead, NULL);
78 CloseHandle(hFile);
79 return true;
80}
81
82void AICreateThread(WORD wStartBlock, Position location, void *pTown)
83{

Callers 1

onStartMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected