Load and use correct save slot.
This commit is contained in:
parent
c91aac41fe
commit
09afbfc0d9
|
@ -272,7 +272,7 @@ static void loadMetaInfo(void)
|
|||
free(text);
|
||||
}
|
||||
|
||||
void loadGame(void)
|
||||
void loadGame(int slot)
|
||||
{
|
||||
cJSON *root, *node, *statsJSON;
|
||||
char *text, filename[MAX_PATH_LENGTH], *statName;
|
||||
|
@ -283,6 +283,8 @@ void loadGame(void)
|
|||
destroyGame();
|
||||
|
||||
initGame();
|
||||
|
||||
game.saveSlot = slot;
|
||||
|
||||
sprintf(filename, "%s/%d/game.json", app.saveDir, game.saveSlot);
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ void returnToTitle(void);
|
|||
|
||||
static Texture *atlasTexture;
|
||||
static Atlas *title;
|
||||
static int recentSaveSlot;
|
||||
static int saveAction;
|
||||
static Widget *startNewGame;
|
||||
static Widget *load;
|
||||
|
@ -91,13 +90,16 @@ void initTitle(void)
|
|||
|
||||
titleAlpha = 0;
|
||||
|
||||
recentSaveSlot = getRecentSave();
|
||||
continueGame->value[1] = getRecentSave();
|
||||
|
||||
showWidgetGroup("title");
|
||||
|
||||
if (recentSaveSlot != -1)
|
||||
if (continueGame->value[1] != -1)
|
||||
{
|
||||
setSelectedWidget("continue", "title");
|
||||
|
||||
load->disabled = 0;
|
||||
continueGame->disabled = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -255,11 +257,9 @@ static void doContinueGame(void)
|
|||
{
|
||||
stopMusic();
|
||||
|
||||
loadGame();
|
||||
loadGame(continueGame->value[1]);
|
||||
|
||||
initHub();
|
||||
|
||||
game.saveSlot = continueGame->value[1];
|
||||
}
|
||||
|
||||
static void doOptions(void)
|
||||
|
@ -291,7 +291,7 @@ static void doSaveSlot(void)
|
|||
{
|
||||
stopMusic();
|
||||
|
||||
loadGame();
|
||||
loadGame(game.saveSlot);
|
||||
|
||||
initHub();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ extern Widget *getWidget(char *name, char *group);
|
|||
extern void initCredits(int playMusic);
|
||||
extern void initHub(void);
|
||||
extern void initOptions(void (*callback)(void));
|
||||
extern void loadGame(void);
|
||||
extern void loadGame(int slot);
|
||||
extern void loadMusic(char *filename);
|
||||
extern void newGame(void);
|
||||
extern void playMusic(int loop);
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
void initWorldTest(char *worldId)
|
||||
{
|
||||
loadGame();
|
||||
loadGame(0);
|
||||
|
||||
saveGame();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
extern void initHub(void);
|
||||
extern void initWorld(void);
|
||||
extern void loadGame(void);
|
||||
extern void loadGame(int slot);
|
||||
extern void saveGame(void);
|
||||
|
||||
extern Game game;
|
||||
|
|
Loading…
Reference in New Issue