ensure entities are cleared at map change (fixes segfault)

This commit is contained in:
Bill Currie 2007-03-20 13:23:17 +00:00 committed by Jeff Teunissen
parent b6e52faea8
commit 4c234c2c27

View file

@ -1117,7 +1117,16 @@ CL_Rotate_f (void)
void void
CL_SetState (cactive_t state) CL_SetState (cactive_t state)
{ {
static const char *state_names[] = {
"ca_disconnected",
"ca_demostate",
"ca_connected",
"ca_onserver",
"ca_active",
};
cactive_t old_state = cls.state; cactive_t old_state = cls.state;
Con_DPrintf ("CL_SetState (%s)\n", state_names[state]);
cls.state = state; cls.state = state;
if (old_state != state) { if (old_state != state) {
if (old_state == ca_active) { if (old_state == ca_active) {
@ -1134,6 +1143,7 @@ CL_SetState (cactive_t state)
// entering active state // entering active state
VID_SetCaption (cls.servername); VID_SetCaption (cls.servername);
IN_ClearStates (); IN_ClearStates ();
R_ClearEnts ();
r_active = true; r_active = true;
game_target = IMT_0; game_target = IMT_0;
key_dest = key_game; key_dest = key_game;