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

Function spiStartAdvertisingLadderGame

bwapi/SNP_DirectIP/SNP/SNPModule.cpp:301–360  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

299 }
300 //------------------------------------------------------------------------------------------------------------------------------------
301 BOOL __stdcall spiStartAdvertisingLadderGame(char *pszGameName, char *pszGamePassword, char *pszGameStatString, DWORD dwGameState, DWORD dwElapsedTime, DWORD dwGameType, int a7, int a8, void *pExtraBytes, DWORD dwExtraBytesCount)
302 {
303 INTERLOCKED;
304// DropMessage(0, "spiStartAdvertisingLadderGame");
305 // Begin game advertisement
306 // Called when you create a game
307
308 memset(&hostedGame, 0, sizeof(hostedGame));
309 strcpy_s(hostedGame.gameInfo.szGameName, sizeof(hostedGame.gameInfo.szGameName), pszGameName);
310 strcpy_s(hostedGame.gameInfo.szGameStatString, sizeof(hostedGame.gameInfo.szGameStatString), pszGameStatString);
311 hostedGame.gameInfo.dwGameState = dwGameState;
312 hostedGame.gameInfo.dwProduct = gameAppInfo.dwProduct;
313 hostedGame.gameInfo.dwVersion = gameAppInfo.dwVerbyte;
314 hostedGame.gameInfo.dwUnk_1C = 0x0050;
315 hostedGame.gameInfo.dwUnk_24 = 0x00a7;
316// hostedGame.dwGameType = dwGameType;
317// hostedGame.dwPlayerCount = dwPlayerCount;
318
319 memcpy(hostedGame.extraBytes, pExtraBytes, dwExtraBytesCount);
320 hostedGame.gameInfo.dwExtraBytes = dwExtraBytesCount;
321 hostedGame.gameInfo.pExtra = hostedGame.extraBytes;
322
323 pluggedNetwork->startAdvertising(Util::MemoryFrame::from(hostedGame));
324
325 /*
326 if ( !pszGameName || !pszGameStatString )
327 {
328 SetLastError(ERROR_INVALID_PARAMETER);
329 return false;
330 }
331
332 EnterCriticalSection(&gCrit);
333 if ( !gpGameAdvert )
334 {
335 gpGameAdvert = SMAlloc(PKT_SIZE + sizeof(packet));
336 if ( !gpGameAdvert )
337 {
338 LeaveCriticalSection(&gCrit);
339 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
340 Error(ERROR_NOT_ENOUGH_MEMORY, "Could not allocate game advertisement packet");
341 return false;
342 }
343 }
344 memset((void*)gpGameAdvert, 0, PKT_SIZE + sizeof(packet));
345 packet *pktHd = (packet*) gpGameAdvert;
346 gameInfo *pktData = (gameInfo*)((DWORD)gpGameAdvert + sizeof(packet));
347
348 // +2 is for the two null terminators
349 pktHd->wSize = (WORD)(strlen(pszGameName) + strlen(pszGameStatString) + dwPlayerCount + sizeof(packet) + 2);
350 pktHd->wType = CMD_ADDGAME;
351
352 pktData->dwGameState = dwGameState;
353 SStrCopy(pktData->info, pszGameName, 128);
354 SStrCopy(&pktData->info[strlen(pktData->info)+1], pszGameStatString, 128);
355
356 LeaveCriticalSection(&gCrit);
357 BroadcastAdvertisement();
358 */

Callers

nothing calls this directly

Calls 1

startAdvertisingMethod · 0.45

Tested by

no test coverage detected