diff --git a/mvdsv/changes.txt b/mvdsv/changes.txt index 37773d2b..522dc7a0 100644 --- a/mvdsv/changes.txt +++ b/mvdsv/changes.txt @@ -1,8 +1,17 @@ -$Id: changes.txt,v 1.110 2006/10/24 14:05:22 vvd0 Exp $ +$Id: changes.txt,v 1.111 2006/10/25 11:09:44 vvd0 Exp $ MVDSV v0.25 build 2500 (2006.10.25) ---- +* qqshka +- allow player move even chat userinfo present + +* VVD +- optimized SV_DirSizeCheck - used every time on demo record start +- small optimization in Sys_listdir (used, for example, in 'cmd dlist') +- increased maximum of fps in qwdtools from 100 to 1000 +- replaced last 2 dangerous strcpy with strlcpy in qwdtools + * disconnect - field offsets cacheing (ported from ZQuake) - made localcommand more verbose diff --git a/mvdsv/source/qwdtools/defs.h b/mvdsv/source/qwdtools/defs.h index 23bbf1f1..3d6e969c 100644 --- a/mvdsv/source/qwdtools/defs.h +++ b/mvdsv/source/qwdtools/defs.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - $Id: defs.h,v 1.13 2006/08/01 11:58:47 vvd0 Exp $ + $Id: defs.h,v 1.14 2006/10/25 11:09:45 vvd0 Exp $ */ #ifndef __DEFS_H__ @@ -187,6 +187,7 @@ typedef struct int *Int; int opt; } opt1; + int str_len; int opt2; } param_t; diff --git a/mvdsv/source/qwdtools/init.c b/mvdsv/source/qwdtools/init.c index f22af656..078cfe92 100644 --- a/mvdsv/source/qwdtools/init.c +++ b/mvdsv/source/qwdtools/init.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - $Id: init.c,v 1.13 2006/05/26 14:51:09 disconn3ct Exp $ + $Id: init.c,v 1.14 2006/10/25 11:09:45 vvd0 Exp $ */ #include "defs.h" @@ -197,11 +197,11 @@ int whatToStdout = 0; #endif param_t params[] = { - {"-qizmo_dir", "-qd", TYPE_S, {(char *) qizmoDir}}, - {"-output_dir", "-od", TYPE_S, {(char *) outputDir}}, - {"-output", "-o", TYPE_S, {(char *) sworld.demo.name}}, - {"-debug_file", NULL, TYPE_S, {(char *) sworld.debug.name}}, - {"-log_file", NULL, TYPE_S, {(char *) sworld.log.name}}, + {"-qizmo_dir", "-qd", TYPE_S, {(char *) qizmoDir}, sizeof(qizmoDir)}, + {"-output_dir", "-od", TYPE_S, {(char *) outputDir}, sizeof(outputDir)}, + {"-output", "-o", TYPE_S, {(char *) sworld.demo.name}, sizeof(sworld.demo.name)}, + {"-debug_file", NULL, TYPE_S, {(char *) sworld.debug.name}, sizeof(sworld.debug.name)}, + {"-log_file", NULL, TYPE_S, {(char *) sworld.log.name}, sizeof(sworld.log.name)}, {"-fps", NULL, TYPE_I, {(char *) &sworld.fps}}, {"-filter_spectalk", "-fs", TYPE_O, {(char *) O_FS}}, {"-filter_qizmotalk", "-fq", TYPE_O, {(char *) O_FQ}}, @@ -214,10 +214,10 @@ param_t params[] = #ifdef _WIN32 {"-waitforkbhit", "-wait",TYPE_O, {(char *) O_WAITFORKBHIT}}, #endif - {"-stdin", NULL, (type_t) (TYPE_O | TYPE_S), {(char *) stdintype}, (int) O_STDIN}, + {"-stdin", NULL, (type_t) (TYPE_O | TYPE_S), {(char *) stdintype}, sizeof(stdintype), (int) O_STDIN}, {"-stdout", NULL, TYPE_O, {(char *) O_STDOUT}}, {"-noini"}, - {"-base_dir", "-bd", TYPE_S, {(char *) currentDir}}, + {"-base_dir", "-bd", TYPE_S, {(char *) currentDir}, sizeof(currentDir)}, {"-msglevel", "-msg", TYPE_I, {(char *) &sworld.msglevel}}, {"-marge", "-m", TYPE_O, {(char *) O_MARGE}}, {"-range", "-r", TYPE_I, {(char *) &sworld.range}}, @@ -312,16 +312,14 @@ void ParseArgv(void) i++; if (i < com_argc && com_argv[i][0] != '-') { - // FIXME - strcpy(param->opt1.str, com_argv[i]); + strlcpy(param->opt1.str, com_argv[i], param->str_len); } else { // if it's stdin assume qwd if (param->opt2 == O_STDIN) { - // FIXME - strcpy(param->opt1.str, "qwd"); + strlcpy(param->opt1.str, "qwd", param->str_len); i--; } else diff --git a/mvdsv/source/sv_demo.c b/mvdsv/source/sv_demo.c index ba977218..9a4bf828 100644 --- a/mvdsv/source/sv_demo.c +++ b/mvdsv/source/sv_demo.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - $Id: sv_demo.c,v 1.53 2006/10/23 19:45:20 disconn3ct Exp $ + $Id: sv_demo.c,v 1.54 2006/10/25 11:09:45 vvd0 Exp $ */ #include "qwsvdef.h" @@ -1510,30 +1510,34 @@ qbool SV_DirSizeCheck (void) { dir_t dir; file_t *list; - int i; + int n; - dir = Sys_listdir(va("%s/%s", fs_gamedir, sv_demoDir.string), ".*", SORT_BY_DATE); - if (sv_demoMaxDirSize.value && dir.size > sv_demoMaxDirSize.value*1024) + if (sv_demoMaxDirSize.value) { - if (sv_demoClearOld.value <= 0) - { - Con_Printf("insufficient directory space, increase sv_demoMaxDirSize\n"); - return false; - } - list = dir.files; - i = sv_demoClearOld.value; - Con_Printf("clearing %d old demos\n", i); - // HACK!!! HACK!!! HACK!!! - if (sv_demotxt.value) // if our server record demos and txts, then to remove - i=i*2; // 50 demos, we have to remove 50 demos and 50 txts = 50*2 = 100 files - - for (; list->name[0] && i > 0; list++) + dir = Sys_listdir(va("%s/%s", fs_gamedir, sv_demoDir.string), ".*", SORT_NO/*BY_DATE*/); + if (dir.size > sv_demoMaxDirSize.value * 1024) { - if (list->isdir) - continue; - Sys_remove(va("%s/%s/%s", fs_gamedir, sv_demoDir.string, list->name)); - //Con_Printf("remove %d - %s/%s/%s\n", i, fs_gamedir, sv_demoDir.string, list->name); - i--; + if (sv_demoClearOld.value <= 0) + { + Con_Printf("Insufficient directory space, increase sv_demoMaxDirSize\n"); + return false; + } + list = dir.files; + n = sv_demoClearOld.value; + Con_Printf("Clearing %d old demos\n", n); + // HACK!!! HACK!!! HACK!!! + if (sv_demotxt.value) // if our server record demos and txts, then to remove + n <<= 1; // 50 demos, we have to remove 50 demos and 50 txts = 50*2 = 100 files + + qsort((void *)list, dir.numfiles, sizeof(file_t), Sys_compare_by_date); + for (; list->name[0] && n > 0; list++) + { + if (list->isdir) + continue; + Sys_remove(va("%s/%s/%s", fs_gamedir, sv_demoDir.string, list->name)); + //Con_Printf("Remove %d - %s/%s/%s\n", n, fs_gamedir, sv_demoDir.string, list->name); + n--; + } } } return true; diff --git a/mvdsv/source/sv_sys_unix.c b/mvdsv/source/sv_sys_unix.c index df845389..2a5feec0 100644 --- a/mvdsv/source/sv_sys_unix.c +++ b/mvdsv/source/sv_sys_unix.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - $Id: sv_sys_unix.c,v 1.50 2006/06/30 18:12:55 vvd0 Exp $ + $Id: sv_sys_unix.c,v 1.51 2006/10/25 11:09:45 vvd0 Exp $ */ #include "qwsvdef.h" @@ -56,21 +56,22 @@ returns -1 if not present int Sys_FileTime (char *path) { struct stat buf; - - if (stat (path,&buf) == -1) - return -1; - - return buf.st_mtime; + return stat(path, &buf) == -1 ? -1 : buf.st_mtime; } -int Sys_FileSize (char *path) +int Sys_FileSizeTime (char *path, int *time) { struct stat buf; - - if (stat (path,&buf) == -1) + if (stat(path, &buf) == -1) + { + *time = -1; return 0; - - return buf.st_size; + } + else + { + *time = buf.st_mtime; + return buf.st_size; + } } @@ -127,7 +128,7 @@ dir_t Sys_listdir (char *path, char *ext, int sort_type) qbool all; int r; - pcre *preg=NULL; + pcre *preg = NULL; const char *errbuf; memset(list, 0, sizeof(list)); @@ -173,15 +174,15 @@ dir_t Sys_listdir (char *path, char *ext, int sort_type) { dir.numdirs++; list[dir.numfiles].isdir = true; - list[dir.numfiles].size = 0; - list[dir.numfiles].time = 0; + list[dir.numfiles].size = list[dir.numfiles].time = 0; closedir(testdir); } else { list[dir.numfiles].isdir = false; - list[dir.numfiles].time = Sys_FileTime(pathname); - dir.size += (list[dir.numfiles].size = Sys_FileSize(pathname)); + //list[dir.numfiles].time = Sys_FileTime(pathname); + dir.size += + (list[dir.numfiles].size = Sys_FileSizeTime(pathname, &list[dir.numfiles].time)); } strlcpy (list[dir.numfiles].name, oneentry->d_name, MAX_DEMO_NAME); diff --git a/mvdsv/source/sv_sys_win.c b/mvdsv/source/sv_sys_win.c index ae5b750c..659a10fa 100644 --- a/mvdsv/source/sv_sys_win.c +++ b/mvdsv/source/sv_sys_win.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - $Id: sv_sys_win.c,v 1.33 2006/08/07 13:03:59 vvd0 Exp $ + $Id: sv_sys_win.c,v 1.34 2006/10/25 11:09:45 vvd0 Exp $ */ #include "qwsvdef.h" @@ -45,11 +45,7 @@ Sys_FileTime int Sys_FileTime (char *path) { struct _stat buf; - - if (_stat (path,&buf) == -1) - return -1; - - return buf.st_mtime; + return _stat(path, &buf) == -1 ? -1 : buf.st_mtime; } /* @@ -149,8 +145,7 @@ dir_t Sys_listdir (char *path, char *ext, int sort_type) { dir.numdirs++; list[dir.numfiles].isdir = true; - list[dir.numfiles].size = 0; - list[dir.numfiles].time = 0; + list[dir.numfiles].size = list[dir.numfiles].time = 0; } else { diff --git a/mvdsv/source/version.h b/mvdsv/source/version.h index 7ddfbeed..a4f94012 100644 --- a/mvdsv/source/version.h +++ b/mvdsv/source/version.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - $Id: version.h,v 1.40 2006/10/24 14:05:23 vvd0 Exp $ + $Id: version.h,v 1.41 2006/10/25 11:09:45 vvd0 Exp $ */ // version.h @@ -62,8 +62,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define QW_VERSION "2.40" -#define QWE_VERSION "0.24.99-CVS" -#define QWE_VERNUM 0.2499 +#define QWE_VERSION "0.25" +#define QWE_VERNUM 0.2500 #define SERVER_NAME "MVDSV" #define QWDTOOLS_NAME "QWDtools" #define PROJECT_NAME SERVER_NAME