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

Method OnMessage

engine/Poseidon/Network/NetworkClientOnMessage.cpp:251–2183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249static bool AssertAIValid()
250{
251 for (int side = 0; side < TSideUnknown; side++)
252 {
253 AICenter* center = GWorld->GetCenter((TargetSide)side);
254 if (!center)
255 {
256 continue;
257 }
258 if (!center->AssertValid())
259 {
260 return false;
261 }
262 }
263 return true;
264}
265
266bool CheckMissionFile(RString fileName, MissionHeader& header)
267{
268 RString fileNameExt = fileName + RString(".pbo");
269
270 std::error_code ec;
271 auto fileSize = std::filesystem::file_size(std::string(fileNameExt), ec);
272 if (ec)
273 return false;
274
275 if (header.fileSizeL != static_cast<DWORD>(fileSize & 0xffffffff) ||
276 header.fileSizeH != static_cast<DWORD>(fileSize >> 32))
277 {
278 return false;
279 }
280
281 QIFStream f;
282 f.open(fileNameExt);
283 Poseidon::Foundation::CRCCalculator crc;
284 if (crc.CRC(f.act(), f.rest()) != header.fileCRC)
285 {
286 return false;
287 }
288
289 CreateMPMissionBank(fileName, header.island);
290 return true;
291}
292
293// client-side settings:
294// custom face file bigger than given limit is ignored
295int MaxCustomFaceSize = 100 * 1024;
296// custom sound file bigger than given limit is ignored
297int MaxCustomSoundSize = 50 * 1024;
298// server-side setting:
299// client attemping to transfer more than given limit will be kicked
300
301int MaxCustomFileSize = 128 * 1024;
302
303static int FileSize(const char* name)
304{
305 HANDLE file = OpenFileForRead(name);
306 if (file == INVALID_HANDLE_VALUE)
307 return INT_MAX;
308

Callers

nothing calls this directly

Calls 15

GetDiagLevelFunction · 0.85
DiagLogFFunction · 0.85
AssertAIValidFunction · 0.85
IndicesMsgFormatGetIndexFunction · 0.85
IntegrityCheckAnswerFunction · 0.85
LocalizeStringFunction · 0.85
GlobalTickCountFunction · 0.85
GetPublicKeyFunction · 0.85
GetUserParamsFunction · 0.85
GetUserDirectoryFunction · 0.85
CreatePathFunction · 0.85
GetServerTmpDirFunction · 0.85

Tested by

no test coverage detected