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:
parent
6006580d8a
commit
203ed87b73
1 changed files with 55 additions and 49 deletions
|
@ -473,7 +473,7 @@ void DoCommandLine(cluster_t *cluster, int argc, char **argv)
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
cluster_t cluster;
|
cluster_t *cluster;
|
||||||
|
|
||||||
// soundtest();
|
// soundtest();
|
||||||
|
|
||||||
|
@ -488,38 +488,41 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&cluster, 0, sizeof(cluster));
|
cluster = malloc(sizeof(*cluster));
|
||||||
|
if (cluster)
|
||||||
|
{
|
||||||
|
memset(cluster, 0, sizeof(*cluster));
|
||||||
|
|
||||||
cluster.qwdsocket = INVALID_SOCKET;
|
cluster->qwdsocket = INVALID_SOCKET;
|
||||||
cluster.tcpsocket = INVALID_SOCKET;
|
cluster->tcpsocket = INVALID_SOCKET;
|
||||||
cluster.qwlistenportnum = 0;
|
cluster->qwlistenportnum = 0;
|
||||||
cluster.allownqclients = true;
|
cluster->allownqclients = true;
|
||||||
strcpy(cluster.hostname, DEFAULT_HOSTNAME);
|
strcpy(cluster->hostname, DEFAULT_HOSTNAME);
|
||||||
cluster.buildnumber = build_number();
|
cluster->buildnumber = build_number();
|
||||||
cluster.maxproxies = -1;
|
cluster->maxproxies = -1;
|
||||||
|
|
||||||
strcpy(cluster.demodir, "qw/demos/");
|
strcpy(cluster->demodir, "qw/demos/");
|
||||||
|
|
||||||
Sys_Printf(&cluster, "QTV Build %i.\n", cluster.buildnumber);
|
Sys_Printf(cluster, "QTV Build %i.\n", cluster->buildnumber);
|
||||||
|
|
||||||
DoCommandLine(&cluster, argc, argv);
|
DoCommandLine(cluster, argc, argv);
|
||||||
|
|
||||||
if (!cluster.numservers)
|
if (!cluster->numservers)
|
||||||
{ //probably running on a home user's computer
|
{ //probably running on a home user's computer
|
||||||
if (cluster.qwdsocket == INVALID_SOCKET && !cluster.qwlistenportnum)
|
if (cluster->qwdsocket == INVALID_SOCKET && !cluster->qwlistenportnum)
|
||||||
{
|
{
|
||||||
cluster.qwdsocket = QW_InitUDPSocket(cluster.qwlistenportnum = 27599);
|
cluster->qwdsocket = QW_InitUDPSocket(cluster->qwlistenportnum = 27599);
|
||||||
if (cluster.qwdsocket != INVALID_SOCKET)
|
if (cluster->qwdsocket != INVALID_SOCKET)
|
||||||
Sys_Printf(&cluster, "opened udp port %i\n", cluster.qwlistenportnum);
|
Sys_Printf(cluster, "opened udp port %i\n", cluster->qwlistenportnum);
|
||||||
}
|
}
|
||||||
if (cluster.tcpsocket == INVALID_SOCKET && !cluster.tcplistenportnum)
|
if (cluster->tcpsocket == INVALID_SOCKET && !cluster->tcplistenportnum)
|
||||||
{
|
{
|
||||||
cluster.tcpsocket = Net_MVDListen(cluster.tcplistenportnum = 27599);
|
cluster->tcpsocket = Net_MVDListen(cluster->tcplistenportnum = 27599);
|
||||||
if (cluster.tcpsocket != INVALID_SOCKET)
|
if (cluster->tcpsocket != INVALID_SOCKET)
|
||||||
Sys_Printf(&cluster, "opened tcp port %i\n", cluster.tcplistenportnum);
|
Sys_Printf(cluster, "opened tcp port %i\n", cluster->tcplistenportnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sys_Printf(&cluster, "\n"
|
Sys_Printf(cluster, "\n"
|
||||||
"Welcome to FTEQTV\n"
|
"Welcome to FTEQTV\n"
|
||||||
"Please type\n"
|
"Please type\n"
|
||||||
"qtv server:port\n"
|
"qtv server:port\n"
|
||||||
|
@ -531,16 +534,19 @@ int main(int argc, char **argv)
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cluster_BuildAvailableDemoList(&cluster);
|
// Cluster_BuildAvailableDemoList(cluster);
|
||||||
|
|
||||||
while (!cluster.wanttoexit)
|
while (!cluster->wanttoexit)
|
||||||
{
|
{
|
||||||
Cluster_Run(&cluster, true);
|
Cluster_Run(cluster, true);
|
||||||
#ifdef VIEWER
|
#ifdef VIEWER
|
||||||
DemoViewer_Update(cluster.viewserver);
|
DemoViewer_Update(cluster->viewserver);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(cluster);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue