Skip to content

Commit

Permalink
Use map restart callback for host_loopmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Diordany committed Jun 13, 2024
1 parent 0ef7cc2 commit bdbbc7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Quake/host_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,12 @@ Goes to a new map, taking all clients along
*/
static void Host_Changelevel_f (void)
{
if (host_loopmap.value)
{
Host_Restart_f();
return;
}

if (host_intruder.value)
{
Host_Map_f();
Expand All @@ -903,11 +909,8 @@ static void Host_Changelevel_f (void)
return;
}

if (host_loopmap.value)
q_snprintf (level, sizeof(cl.mapname), "maps/%s.bsp", cl.mapname);
else
q_snprintf (level, sizeof(level), "maps/%s.bsp", Cmd_Argv(1));
//johnfitz -- check for client having map before anything else
q_snprintf (level, sizeof(level), "maps/%s.bsp", Cmd_Argv(1));
if (!COM_FileExists(level, NULL))
Host_Error ("cannot find map %s", level);
//johnfitz
Expand All @@ -916,10 +919,7 @@ static void Host_Changelevel_f (void)
IN_Activate(); // -- S.A.
key_dest = key_game; // remove console or menu
SV_SaveSpawnparms ();
if (host_loopmap.value)
q_strlcpy (level, cl.mapname, sizeof(level));
else
q_strlcpy (level, Cmd_Argv(1), sizeof(level));
q_strlcpy (level, Cmd_Argv(1), sizeof(level));
SV_SpawnServer (level);
// also issue an error if spawn failed -- O.S.
if (!sv.active)
Expand All @@ -933,7 +933,7 @@ Host_Restart_f
Restarts the current server for a dead player
==================
*/
static void Host_Restart_f (void)
void Host_Restart_f (void)
{
char mapname[MAX_QPATH];

Expand Down
1 change: 1 addition & 0 deletions Quake/quakedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ FUNC_NORETURN void Host_EndGame (const char *message, ...) FUNC_PRINTF(1,2);
#endif
void Host_Frame (float time);
void Host_Quit_f (void);
void Host_Restart_f(void);
void Host_ClientCommands (const char *fmt, ...) FUNC_PRINTF(1,2);
void Host_ShutdownServer (qboolean crash);
void Host_WriteConfiguration (void);
Expand Down

0 comments on commit bdbbc7d

Please sign in to comment.