Menu: Allow setting of the default chatroom to join.

This commit is contained in:
Marco Cawthorne 2020-08-06 23:26:51 +02:00
parent 96a873c0da
commit 17f3333bd3
3 changed files with 18 additions and 5 deletions

View file

@ -60,7 +60,7 @@ typedef struct
int cldll;
string type;
string hlversion;
string pkg_repo;
string pkgname;
int nomodels;
int installed;
string mpentity;
@ -68,6 +68,7 @@ typedef struct
string startmap;
string trainingmap;
string fallback_dir;
string chatroom;
} gameinfo_t;
var int gameinfo_current = -1;

View file

@ -231,9 +231,17 @@ void
cr_makeconnection(void)
{
int i;
string channel;
i = TCP_Connect(&tcp_irc, "tcp://irc.frag-net.com:6667");
g_ircroom.m_strChannel = sprintf("#%s", cvar_string("game"));
channel = games[gameinfo_current].chatroom;
/* we're already setting a default channel, but a mod might set it
set it to something empty to mess with us */
if (!channel)
channel = cvar_string("game");
g_ircroom.m_strChannel = sprintf("#%s", channel);
irc_send("USER guest fn irc.won.net :Player\n");
/* attempt to force our nickname to be the same as in-game.

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
@ -79,6 +79,7 @@ games_init(void)
games[id].hlversion = "1000";
games[id].svonly = 0;
games[id].installed = 1;
games[id].chatroom = gamedirname;
for (int i = 0; i < county; i++) {
switch(argv(i)) {
@ -148,8 +149,11 @@ games_init(void)
case "gameinfo_menutrack":
cvar_set("gameinfo_menutrack", argv(i+1));
break;
case "gameinfo_pkgrepo":
games[id].pkg_repo = argv(i+1);
case "gameinfo_pkgname":
games[id].pkgname = argv(i+1);
break;
case "gameinfo_chatroom":
games[id].chatroom = argv(i+1);
break;
default:
break;