Skip to content

Commit

Permalink
Fixed|All Games: Do not allow loading non-userwritable save slots wit…
Browse files Browse the repository at this point in the history
…h -loadgame

Previously it was possible to coax Hexen into loading the base slot
from an earlier game session from the command line with -loadgame.

Also, use the save system's SV_ParseSlotIdentifier() to interpret
the argument given with -loadgame.
  • Loading branch information
danij-deng committed Jul 31, 2012
1 parent e4cce63 commit 24dc367
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doomsday/plugins/jdoom/src/d_main.c
Expand Up @@ -517,8 +517,8 @@ void D_PostInit(void)
p = CommandLine_Check("-loadgame");
if(p && p < myargc - 1)
{
const int saveSlot = CommandLine_At(p + 1)[0] - '0';
if(G_LoadGame(saveSlot))
const int saveSlot = SV_ParseSlotIdentifier(CommandLine_At(p + 1));
if(SV_IsUserWritableSlot(saveSlot) && G_LoadGame(saveSlot))
{
// No further initialization is to be done.
return;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/jdoom64/src/d_main.c
Expand Up @@ -429,8 +429,8 @@ void D_PostInit(void)
p = CommandLine_Check("-loadgame");
if(p && p < myargc - 1)
{
const int saveSlot = CommandLine_At(p + 1)[0] - '0';
if(G_LoadGame(saveSlot))
const int saveSlot = SV_ParseSlotIdentifier(CommandLine_At(p + 1));
if(SV_IsUserWritableSlot(saveSlot) && G_LoadGame(saveSlot))
{
// No further initialization is to be done.
return;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/jheretic/src/h_main.c
Expand Up @@ -441,8 +441,8 @@ void H_PostInit(void)
p = CommandLine_Check("-loadgame");
if(p && p < myargc - 1)
{
const int saveSlot = CommandLine_At(p + 1)[0] - '0';
if(G_LoadGame(saveSlot))
const int saveSlot = SV_ParseSlotIdentifier(CommandLine_At(p + 1));
if(SV_IsUserWritableSlot(saveSlot) && G_LoadGame(saveSlot))
{
// No further initialization is to be done.
return;
Expand Down
3 changes: 2 additions & 1 deletion doomsday/plugins/jhexen/src/h2_main.c
Expand Up @@ -415,7 +415,8 @@ void X_PostInit(void)
p = CommandLine_CheckWith("-loadgame", 1);
if(p != 0)
{
if(G_LoadGame(atoi(CommandLine_At(p + 1))))
const int saveSlot = SV_ParseSlotIdentifier(CommandLine_At(p + 1));
if(SV_IsUserWritableSlot(saveSlot) && G_LoadGame(saveSlot))
{
// No further initialization is to be done.
return;
Expand Down

0 comments on commit 24dc367

Please sign in to comment.