1
0
Fork 0
forked from fte/fteqw

Don't put large structures on the stack.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2813 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Mark Olsen 2007-12-13 06:30:39 +00:00
parent 6006580d8a
commit 203ed87b73

View file

@ -473,7 +473,7 @@ void DoCommandLine(cluster_t *cluster, int argc, char **argv)
int main(int argc, char **argv)
{
cluster_t cluster;
cluster_t *cluster;
// soundtest();
@ -488,57 +488,63 @@ int main(int argc, char **argv)
}
#endif
memset(&cluster, 0, sizeof(cluster));
cluster.qwdsocket = INVALID_SOCKET;
cluster.tcpsocket = INVALID_SOCKET;
cluster.qwlistenportnum = 0;
cluster.allownqclients = true;
strcpy(cluster.hostname, DEFAULT_HOSTNAME);
cluster.buildnumber = build_number();
cluster.maxproxies = -1;
strcpy(cluster.demodir, "qw/demos/");
Sys_Printf(&cluster, "QTV Build %i.\n", cluster.buildnumber);
DoCommandLine(&cluster, argc, argv);
if (!cluster.numservers)
{ //probably running on a home user's computer
if (cluster.qwdsocket == INVALID_SOCKET && !cluster.qwlistenportnum)
{
cluster.qwdsocket = QW_InitUDPSocket(cluster.qwlistenportnum = 27599);
if (cluster.qwdsocket != INVALID_SOCKET)
Sys_Printf(&cluster, "opened udp port %i\n", cluster.qwlistenportnum);
}
if (cluster.tcpsocket == INVALID_SOCKET && !cluster.tcplistenportnum)
{
cluster.tcpsocket = Net_MVDListen(cluster.tcplistenportnum = 27599);
if (cluster.tcpsocket != INVALID_SOCKET)
Sys_Printf(&cluster, "opened tcp port %i\n", cluster.tcplistenportnum);
}
Sys_Printf(&cluster, "\n"
"Welcome to FTEQTV\n"
"Please type\n"
"qtv server:port\n"
" to connect to a tcp server.\n"
"qw server:port\n"
" to connect to a regular qw server.\n"
"demo qw/example.mvd\n"
" to play a demo from an mvd.\n"
"\n");
}
// Cluster_BuildAvailableDemoList(&cluster);
while (!cluster.wanttoexit)
cluster = malloc(sizeof(*cluster));
if (cluster)
{
Cluster_Run(&cluster, true);
memset(cluster, 0, sizeof(*cluster));
cluster->qwdsocket = INVALID_SOCKET;
cluster->tcpsocket = INVALID_SOCKET;
cluster->qwlistenportnum = 0;
cluster->allownqclients = true;
strcpy(cluster->hostname, DEFAULT_HOSTNAME);
cluster->buildnumber = build_number();
cluster->maxproxies = -1;
strcpy(cluster->demodir, "qw/demos/");
Sys_Printf(cluster, "QTV Build %i.\n", cluster->buildnumber);
DoCommandLine(cluster, argc, argv);
if (!cluster->numservers)
{ //probably running on a home user's computer
if (cluster->qwdsocket == INVALID_SOCKET && !cluster->qwlistenportnum)
{
cluster->qwdsocket = QW_InitUDPSocket(cluster->qwlistenportnum = 27599);
if (cluster->qwdsocket != INVALID_SOCKET)
Sys_Printf(cluster, "opened udp port %i\n", cluster->qwlistenportnum);
}
if (cluster->tcpsocket == INVALID_SOCKET && !cluster->tcplistenportnum)
{
cluster->tcpsocket = Net_MVDListen(cluster->tcplistenportnum = 27599);
if (cluster->tcpsocket != INVALID_SOCKET)
Sys_Printf(cluster, "opened tcp port %i\n", cluster->tcplistenportnum);
}
Sys_Printf(cluster, "\n"
"Welcome to FTEQTV\n"
"Please type\n"
"qtv server:port\n"
" to connect to a tcp server.\n"
"qw server:port\n"
" to connect to a regular qw server.\n"
"demo qw/example.mvd\n"
" to play a demo from an mvd.\n"
"\n");
}
// Cluster_BuildAvailableDemoList(cluster);
while (!cluster->wanttoexit)
{
Cluster_Run(cluster, true);
#ifdef VIEWER
DemoViewer_Update(cluster.viewserver);
DemoViewer_Update(cluster->viewserver);
#endif
}
free(cluster);
}
return 0;