Skip to content

Commit

Permalink
Make IP's configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo committed Feb 27, 2019
1 parent 4a54820 commit 0d1d55d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion SourceX/DiabloUI/selgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "selgame.h"

char selgame_Lable[32];
char selgame_Ip[129] = "127.0.0.1"; // CONFIG
char selgame_Ip[129] = "";
char selgame_Password[16] = "";
char selgame_Description[256];
bool selgame_enteringGame;
Expand Down Expand Up @@ -82,6 +82,7 @@ void selgame_GameSelection_Init()
return;
}

SRegLoadString("Phone Book", "Entry1", 0, selgame_Ip, 128);
UiInitList(0, 1, selgame_GameSelection_Focus, selgame_GameSelection_Select, selgame_GameSelection_Esc, SELUDPGAME_DIALOG, size(SELUDPGAME_DIALOG));
}

Expand Down Expand Up @@ -181,6 +182,7 @@ void selgame_Password_Select(int value)
selgame_endMenu = true;

if (selgame_selectedGame) {
SRegSaveString("Phone Book", "Entry1", 0, selgame_Ip);
if (!SNetJoinGame(selgame_selectedGame, selgame_Ip, selgame_Password, NULL, NULL, gdwPlayerId)) {
DrawDlg("Unable to establish a connection. A game of Devilution 0.1.0 was not detected at the specified IP address.");
selgame_Password_Init(selgame_selectedGame);
Expand Down
5 changes: 4 additions & 1 deletion SourceX/storm_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ BOOL STORMAPI SNetCreateGame(const char *pszGameName, const char *pszGamePasswor
ABORT();
dvlnet::buffer_t game_init_info(GameTemplateData, GameTemplateData + GameTemplateSize);
dvlnet_inst->setup_gameinfo(std::move(game_init_info));
*playerID = dvlnet_inst->create("0.0.0.0", pszGamePassword);

char addrstr[129] = "0.0.0.0";
SRegLoadString("dvlnet", "bindaddr", 0, addrstr, 128);
*playerID = dvlnet_inst->create(addrstr, pszGamePassword);
return *playerID != -1;
}

Expand Down

0 comments on commit 0d1d55d

Please sign in to comment.