This pretty much works now.

git-svn-id: https://svn.eduke32.com/eduke32@131 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-05-01 06:30:33 +00:00
parent 111c923844
commit 106f0efd24
3 changed files with 41 additions and 15 deletions

View file

@ -235,7 +235,7 @@ void CONFIG_SetDefaults( void )
ud.msgdisptime = 640;
ud.brightness = 16;
ud.statusbarmode = 0;
ShowOpponentWeapons = 0;
Bstrcpy(ud.rtsname, "DUKE.RTS");
Bstrcpy(myname, "Duke");

View file

@ -61,7 +61,7 @@ char qe,cp;
static int32 CommandSoundToggleOff = 0;
static int32 CommandMusicToggleOff = 0;
static char *CommandMap = NULL;
static char *CommandName = NULL;
static char *CommandName = NULL,*CommandNet = NULL;
int32 CommandWeaponChoice = 0;
char confilename[BMAX_PATH] = {"EDUKE.CON"}, boardfilename[BMAX_PATH] = {0};
@ -7471,7 +7471,7 @@ enum {
};
signed int rancid_players = 0;
char rancid_ips[MAXPLAYERS][16];
char rancid_ips[MAXPLAYERS+1][16];
typedef struct { char *text; int tokenid; } tokenlist;
static tokenlist basetokens[] =
@ -7507,6 +7507,13 @@ static int parserancidnet(scriptfile *script)
cmdtokptr = script->ltextptr;
switch (tokn) {
case T_INTERFACE:
{
char *ip;
if (scriptfile_getstring(script,&ip)) break;
Bstrcpy(rancid_ips[MAXPLAYERS],ip);
Bstrcpy(rancid_ips[rancid_players++],ip);
}
break;
case T_ALLOW:
{
char *ip;
@ -7538,6 +7545,11 @@ int loadrancidnet(char *fn)
return 0;
}
static int stringsort(const char *p1, const char *p2)
{
return Bstrcmp(&p1[0],&p2[0]);
}
void checkcommandline(int argc,char **argv)
{
short i, j;
@ -7574,14 +7586,20 @@ void checkcommandline(int argc,char **argv)
{
if (!Bstrcasecmp(c+1,"rmnet")) {
if (argc > i+1) {
CommandName = argv[i+1];
CommandNet = argv[i+1];
i++;
}
if(CommandName) {
loadrancidnet(CommandName);
if(CommandNet) {
loadrancidnet(CommandNet);
qsort((char *)rancid_ips, rancid_players, sizeof(rancid_ips[0]), (int(*)(const void*,const void*))stringsort);
for(j=0;j<rancid_players;j++)
initprintf("Rancidmeat configuration IP %d: %s\n",j,rancid_ips[j]);
CommandName = 0;
if(Bstrcmp(rancid_ips[j],rancid_ips[MAXPLAYERS]) == 0)
Bsprintf(rancid_ips[j],"/n1");
CommandNet = 0;
netparamcount = rancid_players;
netparam = (char **)calloc(netparamcount, sizeof(char **));
for(j=0;j<netparamcount;j++)
netparam[j] = rancid_ips[j];
}
i++;
continue;

View file

@ -2,6 +2,7 @@
// gcc -o duke3d_w32.exe wrapper.c
#include <windows.h>
#include <string.h>
#include <stdio.h>
#define ISWS(x) ((x == ' ') || (x == '\t') || (x == '\r') || (x == '\n'))
@ -19,32 +20,39 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
STARTUPINFO si;
PROCESS_INFORMATION pi;
for(i=0;i<sizeof(CmdLine);i++)
ZeroMemory(&szFileName,sizeof(szFileName));
for(i=0;i<strlen(lpCmdLine);i++)
{
if(lpCmdLine[i] == ' ' && lpCmdLine[i+1] == '-' && lpCmdLine[i+2] == 'n' && lpCmdLine[i+3] == 'e' && lpCmdLine[i+4] == 't')
if(lpCmdLine[i] == '-' && lpCmdLine[i+1] == 'n' && lpCmdLine[i+2] == 'e' && lpCmdLine[i+3] == 't')
{
i += 6;
i += 5;
j = 0;
while(!ISWS(lpCmdLine[i]))
while(!ISWS(lpCmdLine[i]) && i<strlen(lpCmdLine))
{
szFileName[j] = lpCmdLine[i];
j++,i++;
fprintf(fp,"%d %d\n",j,i);
if(lpCmdLine[i] == ' ' || lpCmdLine[i] == '\n' || lpCmdLine[i] == '\r')
if(lpCmdLine[i+1] == ' ' || lpCmdLine[i+1] == '\n' || lpCmdLine[i+1] == '\r')
break;
j++,i++;
}
break;
}
else CmdLine[i] = lpCmdLine[i];
}
sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName);
if(szFileName[0])
sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName);
else sprintf(sCmdLine,"eduke32.exe %s",CmdLine);
szCmdLine = sCmdLine;
fprintf(fp,"EDuke32 wrapper for Dukester X v0.01\
\nCopyright (c) 2006 EDuke32 team\n\
\nArgs passed to wrapper: %s\
\nRancidmeat net filename: %s\
\nFinal command line: %s\n",lpCmdLine,szFileName,szCmdLine);
fclose(fp);
ZeroMemory(&si,sizeof(si));