Skip to content

Commit

Permalink
Fixed bug #1545655 it was possible to save the game when the player w…
Browse files Browse the repository at this point in the history
…as dead. The global variable usergame is no longer being manipulated as expected so instead actually check the player's state.
  • Loading branch information
danij committed Aug 24, 2006
1 parent 3171757 commit 8095957
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions doomsday/plugins/common/src/mn_menu.c
Expand Up @@ -141,8 +141,8 @@ void M_StartControlPanel(void);
void M_ReadSaveStrings(void);
void M_DoSave(int slot);
void M_DoLoad(int slot);
void M_QuickSave(void);
void M_QuickLoad(void);
static void M_QuickSave(void);
static void M_QuickLoad(void);

void M_DrawMainMenu(void);
void M_DrawReadThis1(void);
Expand Down Expand Up @@ -2627,17 +2627,21 @@ boolean M_QuickSaveResponse(int ch, void *data)
return false;
}

void M_QuickSave(void)
/**
* Called via the bindings mechanism when a player wishes to save their
* game to a preselected save slot.
*/
static void M_QuickSave(void)
{
if(!usergame)
player_t *player = &players[consoleplayer];

if(player->playerstate == PST_DEAD || gamestate != GS_LEVEL ||
Get(DD_PLAYBACK))
{
S_LocalSound(menusnds[6], NULL);
M_StartMessage(SAVEDEAD, NULL, false);
return;
}

if(gamestate != GS_LEVEL)
return;

if(quickSaveSlot < 0)
{
M_StartControlPanel();
Expand Down Expand Up @@ -2681,7 +2685,7 @@ boolean M_QuickLoadResponse(int ch, void *data)
return false;
}

void M_QuickLoad(void)
static void M_QuickLoad(void)
{
if(IS_NETGAME)
{
Expand Down Expand Up @@ -3475,28 +3479,28 @@ void M_LoadGame(int option, void *data)
M_ReadSaveStrings();
}

//---------------------------------------------------------------------------
//
// PROC M_SaveGame
//
//---------------------------------------------------------------------------

/**
* Called via the menu or the control bindings mechanism when the player
* wishes to save their game.
*/
void M_SaveGame(int option, void *data)
{
if(!usergame || Get(DD_PLAYBACK))
player_t *player = &players[consoleplayer];

if(player->playerstate == PST_DEAD || gamestate != GS_LEVEL ||
Get(DD_PLAYBACK))
{
M_StartMessage(SAVEDEAD, NULL, false);
return;
}

if(IS_CLIENT)
{
#ifdef __JDOOM__
M_StartMessage(GET_TXT(TXT_SAVENET), NULL, false);
#endif
return;
}
if(gamestate != GS_LEVEL)
return;

M_SetupNextMenu(&SaveDef);;
M_ReadSaveStrings();
Expand Down

0 comments on commit 8095957

Please sign in to comment.