mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[nq] Fix some level change segfaults
I really need to play more while working on the code. Anyway, ca_active works nicely for the status bar in general, and CL_ClearMemory needs to be called before Host_ClearMemory when doing single-player.
This commit is contained in:
parent
ceaac00453
commit
0b9d36b08d
5 changed files with 25 additions and 2 deletions
|
@ -56,6 +56,8 @@ extern double realtime; // not bounded in any way, changed at
|
|||
extern struct cbuf_s *host_cbuf;
|
||||
|
||||
void Host_ClearMemory (void);
|
||||
void Host_SpawnServer (void);
|
||||
void Host_OnServerSpawn (void (*onSpawn)(void));
|
||||
void Host_ServerFrame (void);
|
||||
void Host_InitCommands (void);
|
||||
void Host_Init (void);
|
||||
|
|
|
@ -625,6 +625,8 @@ CL_Init (cbuf_t *cbuf)
|
|||
if (!colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
Host_OnServerSpawn (CL_ClearMemory);
|
||||
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
VID_Init (basepal, colormap);
|
||||
IN_Init ();
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "QF/image.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/listener.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/png.h"
|
||||
#include "QF/progs.h"
|
||||
|
@ -632,6 +633,22 @@ Host_ClearMemory (void)
|
|||
Hunk_FreeToLowMark (0, host_hunklevel);
|
||||
}
|
||||
|
||||
static struct LISTENER_SET_TYPE(void) host_server_spawn = LISTENER_SET_STATIC_INIT(4);
|
||||
|
||||
void
|
||||
Host_SpawnServer (void)
|
||||
{
|
||||
LISTENER_INVOKE (&host_server_spawn, NULL);
|
||||
Host_ClearMemory ();
|
||||
}
|
||||
|
||||
void
|
||||
Host_OnServerSpawn (void (*onSpawn) (void))
|
||||
{
|
||||
LISTENER_ADD (&host_server_spawn,
|
||||
(void(*)(void *, const void*)) onSpawn, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Host_FilterTime
|
||||
|
||||
|
|
|
@ -1003,7 +1003,9 @@ sbar_update_vis (void)
|
|||
void
|
||||
Sbar_Draw (void)
|
||||
{
|
||||
if (!cl.players) return; //FIXME draw_miniteam
|
||||
if (cls.state != ca_active) {
|
||||
return;
|
||||
}
|
||||
sbar_update_vis ();
|
||||
hud_main_view->draw (hud_main_view);
|
||||
}
|
||||
|
|
|
@ -1113,7 +1113,7 @@ SV_SpawnServer (const char *server)
|
|||
skill = current_skill;
|
||||
|
||||
// set up the new server
|
||||
Host_ClearMemory ();
|
||||
Host_SpawnServer ();
|
||||
|
||||
memset (&sv, 0, sizeof (sv));
|
||||
|
||||
|
|
Loading…
Reference in a new issue