]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
-Added the cvar sv_progs, which allows you to set the name of the server
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 19 Dec 2004 14:40:34 +0000 (14:40 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 19 Dec 2004 14:40:34 +0000 (14:40 +0000)
 progs file.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4870 d7cf8633-e32d-0410-b094-e92efae38249

pr_edict.c
progs.h
sv_main.c
todo

index 62688275ad08d60e94774ae820caf11d3c469dc3..2ea21f97ffde0ba94e64756c11d6b2d90e3174cd 100644 (file)
@@ -1289,13 +1289,16 @@ PR_LoadProgs
 ===============
 */
 extern void PR_Cmd_Reset (void);
-void PR_LoadProgs (void)
+void PR_LoadProgs (const char *progsname)
 {
        int i;
        dstatement_t *st;
        ddef_t *infielddefs;
        dfunction_t *dfunctions;
 
+       if (!progsname || !*progsname) 
+               Host_Error("PR_LoadProgs: passed empty progsname");
+
 // flush the non-C variable lookup cache
        for (i=0 ; i<GEFV_CACHESIZE ; i++)
                gefvCache[i].field[0] = 0;
@@ -1303,9 +1306,9 @@ void PR_LoadProgs (void)
        Mem_EmptyPool(progs_mempool);
        Mem_EmptyPool(edictstring_mempool);
 
-       progs = (dprograms_t *)FS_LoadFile ("progs.dat", progs_mempool, false);
+       progs = (dprograms_t *)FS_LoadFile (progsname, progs_mempool, false);
        if (!progs)
-               Host_Error ("PR_LoadProgs: couldn't load progs.dat");
+               Host_Error ("PR_LoadProgs: couldn't load %s", progsname);
 
        Con_DPrintf("Programs occupy %iK.\n", fs_filesize/1024);
 
diff --git a/progs.h b/progs.h
index 5e01bd87262b04adf87e1af7112853955b652e50..cdae2523cc26b9c59913ae88313c9a5777049c9c 100644 (file)
--- a/progs.h
+++ b/progs.h
@@ -161,7 +161,7 @@ extern      int                             pr_edictareasize; // LordHavoc: for bounds checking
 void PR_Init (void);
 
 void PR_ExecuteProgram (func_t fnum, const char *errormessage);
-void PR_LoadProgs (void);
+void PR_LoadProgs (const char *progsname);
 
 void PR_Profile_f (void);
 
index afdd8c7965a7843c9c1330e4d78963346999c35c..d4b6b2d50552436570e197a2c597ee6beb5b40cf 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -41,6 +41,8 @@ cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping",
 cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1"};
 cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1"};
 
+cvar_t sv_progs = {0, "sv_progs", "progs.dat" };
+
 server_t sv;
 server_static_t svs;
 
@@ -84,6 +86,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_protocolname);
        Cvar_RegisterVariable (&sv_ratelimitlocalplayer);
        Cvar_RegisterVariable (&sv_maxrate);
+       Cvar_RegisterVariable (&sv_progs);
 
        SV_Phys_Init();
        SV_World_Init();
@@ -1665,7 +1668,7 @@ void SV_SpawnServer (const char *server)
        }
 
 // load progs to get entity field count
-       PR_LoadProgs ();
+       PR_LoadProgs ( sv_progs.string );
 
 // allocate server memory
        // start out with just enough room for clients and a reasonable estimate of entities
diff --git a/todo b/todo
index 672f7cb7a63d6bc31e8de3f08b1110670d8707aa..fa2208f93d632196acdb601b3ae19e01ce4f0b94 100644 (file)
--- a/todo
+++ b/todo
@@ -98,7 +98,7 @@
 0 darkplaces server: add an extension to check if a file exists outside the data directory, FRIK_FILE can do this but only inside data directory (Error)
 0 darkplaces server: add filename/line number reporting to progs stack and opcode printouts (Spike)
 0 darkplaces server: add sv_playerphysicsqc cvar to allow engine to ignore SV_PlayerPhysics function, this would also have to change the reported extensions (Gleeb)
-0 darkplaces server: add sv_progs cvar, defaulted to "progs.dat", can be set from console or by menu to choose a mod (Black)
+d darkplaces server: add sv_progs cvar, defaulted to "progs.dat", can be set from console or by menu to choose a mod (Black)
 0 darkplaces server: make dedicated server not load images (maybe all fail?)
 0 darkplaces server: make fopen have the ability to disable fopen builtin access to read /, read data/, write data/, or disable fopen builtin entirely
 0 darkplaces sound: Lordhavoc needs to talk to fuh about snd_macos.c (fuh)