MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / SNetCreateGame

Function SNetCreateGame

Source/storm/storm_net.cpp:155–178  ·  view source on GitHub ↗

* @brief Called by engine for single, called by ui for multi */

Source from the content-addressed store, hash-verified

153 * @brief Called by engine for single, called by ui for multi
154 */
155bool SNetCreateGame(const char *pszGameName, const char *pszGamePassword, char *gameTemplateData, int gameTemplateSize, int *playerID)
156{
157#ifndef NONET
158 std::lock_guard<SdlMutex> lg(storm_net_mutex);
159#endif
160 if (gameTemplateSize != sizeof(GameData))
161 ABORT();
162 net::buffer_t gameInitInfo(gameTemplateData, gameTemplateData + gameTemplateSize);
163 dvlnet_inst->setup_gameinfo(std::move(gameInitInfo));
164
165 std::string defaultName;
166 if (pszGameName == nullptr) {
167 defaultName = dvlnet_inst->make_default_gamename();
168 pszGameName = defaultName.c_str();
169 }
170
171 GameName = pszGameName;
172 if (pszGamePassword != nullptr)
173 DvlNet_SetPassword(pszGamePassword);
174 else
175 DvlNet_ClearPassword();
176 *playerID = dvlnet_inst->create(pszGameName);
177 return *playerID != -1;
178}
179
180bool SNetJoinGame(char *pszGameName, char *pszGamePassword, int *playerID)
181{

Callers 2

InitSingleFunction · 0.85
selgame_Password_SelectFunction · 0.85

Calls 5

DvlNet_SetPasswordFunction · 0.85
DvlNet_ClearPasswordFunction · 0.85
setup_gameinfoMethod · 0.45
make_default_gamenameMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected