From fe5671e81223e716f85c120f4d436f7e1b5a18b1 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 24 Apr 2006 18:52:29 +0000 Subject: [PATCH] Fix a couple of tiny leaks and a couple of minor issues I noticed last night in multiplayer git-svn-id: https://svn.eduke32.com/eduke32@108 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/compat.c | 1 + polymer/build/src/mmulti.c | 2 +- polymer/build/src/osd.c | 3 +++ polymer/eduke32/source/duke3d.h | 5 ++--- polymer/eduke32/source/game.c | 14 +++++++++++--- polymer/eduke32/source/gamedef.c | 10 +++------- polymer/eduke32/source/global.c | 4 +--- polymer/eduke32/source/player.c | 2 +- polymer/eduke32/source/savegame.c | 4 ++-- 9 files changed, 25 insertions(+), 20 deletions(-) diff --git a/polymer/build/src/compat.c b/polymer/build/src/compat.c index d8341fe43..5f8f5adf3 100644 --- a/polymer/build/src/compat.c +++ b/polymer/build/src/compat.c @@ -384,6 +384,7 @@ int Bcorrectfilename(char *filename, int removefn) if (trailslash) *(first++) = '/'; *(first++) = 0; + Bfree(fn); return 0; } diff --git a/polymer/build/src/mmulti.c b/polymer/build/src/mmulti.c index cd38dd6c8..4d03468e2 100644 --- a/polymer/build/src/mmulti.c +++ b/polymer/build/src/mmulti.c @@ -274,7 +274,7 @@ long initmultiplayersparms(long argc, char **argv) if ((argv[i][1] == 'p' || argv[i][1] == 'P') && argv[i][2]) { char *p; j = strtol(argv[i]+2, &p, 10); - if (!(*p) && j > 0 && j<65535) portnum = j; + if (!(*p) && j > 1024 && j<65535) portnum = j; printf("mmulti: Using port %ld\n", portnum); } diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index ccbae069d..9b69f32b6 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -246,6 +246,9 @@ void OSD_Cleanup(void) Bfree(symbols); } + if (osdlog) Bfclose(osdlog); + osdlog = NULL; + osdinited=0; } diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 8fe65bc9e..699c29a68 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -128,7 +128,7 @@ enum gamemodes { #define MAXANIMWALLS 512 #define MAXINTERPOLATIONS 8192 -#define NUMOFFIRSTTIMEACTIVE 16384 +#define MAXQUOTES 16384 #define MAXCYCLERS 1024 @@ -435,7 +435,7 @@ extern char buf[1024]; //My own generic input buffer #define MAXQUOTELEN 64 -extern char *fta_quotes[NUMOFFIRSTTIMEACTIVE],*redefined_quotes[NUMOFFIRSTTIMEACTIVE]; +extern char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES]; extern char scantoasc[128],ready2send; extern char scantoascwithshift[128]; @@ -549,7 +549,6 @@ extern char restorepalette; extern short buttonstat; extern long cachecount; extern char boardfilename[BMAX_PATH],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768]; -extern char betaname[80]; extern char cachedebug,earthquaketime; extern char networkmode; extern char lumplockbyte[11]; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 2c6821e23..78a202f69 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1738,8 +1738,10 @@ void coolgaugetext(short snum) case 6: i = ((p->scuba_amount+63)>>6); break; case 7: i = (p->boot_amount>>1); break; } - invennum(284-30-o,200-6,(char)i,0,10+permbit); - if (p->inven_icon >= 6) minitext(284-35-o,180,"AUTO",2,10+16+permbit + 256); + invennum(284-30-o,200-6,(char)i,0,10+permbit); + if (j > 0) minitext(288-30-o,180,"ON",0,10+16+permbit + 256); + else if ((unsigned long)j != 0x80000000) minitext(284-30-o,180,"OFF",2,10+16+permbit + 256); + if (p->inven_icon >= 6) minitext(284-35-o,180,"AUTO",2,10+16+permbit + 256); } return; } @@ -7984,7 +7986,7 @@ void Shutdown( void ) CONTROL_Shutdown(); CONFIG_WriteSetup(); KB_Shutdown(); - for(i=0;i= NUMOFFIRSTTIMEACTIVE) + if(k >= MAXQUOTES) { - initprintf("%s:%ld: error: quote number exceeds limit of %ld.\n",compilefile,line_number,NUMOFFIRSTTIMEACTIVE); + initprintf("%s:%ld: error: quote number exceeds limit of %ld.\n",compilefile,line_number,MAXQUOTES); error++; } diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 9ef52f24f..3b8cbef11 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -42,7 +42,7 @@ short animatesect[MAXANIMATES]; long msx[2048],msy[2048]; short cyclers[MAXCYCLERS][6],numcyclers; -char *fta_quotes[NUMOFFIRSTTIMEACTIVE],*redefined_quotes[NUMOFFIRSTTIMEACTIVE]; +char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES]; char tempbuf[2048], packbuf[576]; @@ -53,8 +53,6 @@ short mirrorwall[64], mirrorsector[64], mirrorcnt; int current_menu; -char betaname[80]; - char level_names[MAXVOLUMES*11][33],level_file_names[MAXVOLUMES*11][BMAX_PATH]; long partime[MAXVOLUMES*11],designertime[MAXVOLUMES*11]; char volume_names[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" }; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 33b56de39..4e299b2f6 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -3829,7 +3829,7 @@ void processinput(short snum) if( p->dummyplayersprite == -1 ) p->dummyplayersprite = spawn(pi,PLAYERONWATER); - + sprite[p->dummyplayersprite].pal = sprite[p->i].pal; p->footprintcount = 6; if(sector[p->cursectnum].floorpicnum == FLOORSLIME) p->footprintpal = 8; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 30170ce08..6528ff76f 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -290,7 +290,7 @@ int loadplayer(signed char spot) if (kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt; - while(i != NUMOFFIRSTTIMEACTIVE) + while(i != MAXQUOTES) { if(fta_quotes[i] != NULL) Bfree(fta_quotes[i]); @@ -660,7 +660,7 @@ int saveplayer(signed char spot) dfwrite(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil); - for(i=0;i