From 106f0efd24803fbca4d06d2572c60d4dfad752d7 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 1 May 2006 06:30:33 +0000 Subject: [PATCH] This pretty much works now. git-svn-id: https://svn.eduke32.com/eduke32@131 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/config.c | 2 +- polymer/eduke32/source/game.c | 32 +++++++++++++++++++++++++------- polymer/eduke32/source/wrapper.c | 22 +++++++++++++++------- 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 1f9ce33b7..14e368910 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -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"); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3af3bdf44..79074f695 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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 +#include #include #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