Use app.saveGame rather than forcing a save (trophy unlocks can cause saving to happen twice in a row).
This commit is contained in:
parent
2aa917ac59
commit
64d88faec8
|
@ -390,7 +390,7 @@ static void postBattle(void)
|
||||||
|
|
||||||
game.currentMission->completed = (battle.status == MS_COMPLETE || !battle.numObjectivesTotal);
|
game.currentMission->completed = (battle.status == MS_COMPLETE || !battle.numObjectivesTotal);
|
||||||
|
|
||||||
saveGame();
|
app.saveGame = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyBattle(void)
|
void destroyBattle(void)
|
||||||
|
|
|
@ -87,7 +87,6 @@ extern void runScriptFunction(const char *format, ...);
|
||||||
extern void doSpawners(void);
|
extern void doSpawners(void);
|
||||||
extern void doTrophyAlerts(void);
|
extern void doTrophyAlerts(void);
|
||||||
extern void drawTrophyAlert(void);
|
extern void drawTrophyAlert(void);
|
||||||
extern void saveGame(void);
|
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -71,7 +71,7 @@ void initChallengeHome(void)
|
||||||
|
|
||||||
awardStatsTrophies();
|
awardStatsTrophies();
|
||||||
|
|
||||||
saveGame();
|
app.saveGame = 1;
|
||||||
|
|
||||||
app.delegate.logic = &logic;
|
app.delegate.logic = &logic;
|
||||||
app.delegate.draw = &draw;
|
app.delegate.draw = &draw;
|
||||||
|
|
|
@ -44,7 +44,6 @@ extern void drawText(int x, int y, int size, int align, SDL_Color c, const char
|
||||||
extern void drawWidgets(char *groupName);
|
extern void drawWidgets(char *groupName);
|
||||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||||
extern Widget *getWidget(const char *name, const char *group);
|
extern Widget *getWidget(const char *name, const char *group);
|
||||||
extern void saveGame(void);
|
|
||||||
extern void initTitle(void);
|
extern void initTitle(void);
|
||||||
extern void initStatsDisplay(void);
|
extern void initStatsDisplay(void);
|
||||||
extern void drawOptions(void);
|
extern void drawOptions(void);
|
||||||
|
|
|
@ -93,7 +93,7 @@ void initGalacticMap(void)
|
||||||
|
|
||||||
awardStatsTrophies();
|
awardStatsTrophies();
|
||||||
|
|
||||||
saveGame();
|
app.saveGame = 1;
|
||||||
|
|
||||||
pulseTimer = 0;
|
pulseTimer = 0;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ extern void loadMission(char *filename);
|
||||||
extern SDL_Texture *getTexture(char *filename);
|
extern SDL_Texture *getTexture(char *filename);
|
||||||
extern void startSectionTransition(void);
|
extern void startSectionTransition(void);
|
||||||
extern void endSectionTransition(void);
|
extern void endSectionTransition(void);
|
||||||
extern void saveGame(void);
|
|
||||||
extern void blit(SDL_Texture *t, int x, int y, int centered);
|
extern void blit(SDL_Texture *t, int x, int y, int centered);
|
||||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||||
extern void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a);
|
extern void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a);
|
||||||
|
|
|
@ -218,6 +218,8 @@ void awardTrophy(char *id)
|
||||||
t->notify = 1;
|
t->notify = 1;
|
||||||
|
|
||||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Awarding trophy '%s'", id);
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Awarding trophy '%s'", id);
|
||||||
|
|
||||||
|
app.saveGame = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!t->awarded)
|
if (!t->awarded)
|
||||||
|
|
|
@ -163,6 +163,13 @@ int main(int argc, char *argv[])
|
||||||
expireTextTimer = SDL_GetTicks() + (1000 * 10);
|
expireTextTimer = SDL_GetTicks() + (1000 * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* trophy unlocks might cause the game to save several times in one frame */
|
||||||
|
if (app.saveGame)
|
||||||
|
{
|
||||||
|
saveGame();
|
||||||
|
app.saveGame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* always zero the mouse motion */
|
/* always zero the mouse motion */
|
||||||
app.mouse.dx = app.mouse.dy = 0;
|
app.mouse.dx = app.mouse.dy = 0;
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ extern void doKeyUp(SDL_KeyboardEvent *event);
|
||||||
extern void createScreenshotFolder(void);
|
extern void createScreenshotFolder(void);
|
||||||
extern int isControl(int type);
|
extern int isControl(int type);
|
||||||
extern void clearControl(int type);
|
extern void clearControl(int type);
|
||||||
|
extern void saveGame(void);
|
||||||
|
|
||||||
App app;
|
App app;
|
||||||
Colors colors;
|
Colors colors;
|
||||||
|
|
|
@ -460,6 +460,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int resetTimeDelta;
|
int resetTimeDelta;
|
||||||
char saveDir[MAX_FILENAME_LENGTH];
|
char saveDir[MAX_FILENAME_LENGTH];
|
||||||
|
int saveGame;
|
||||||
int winWidth;
|
int winWidth;
|
||||||
int winHeight;
|
int winHeight;
|
||||||
float scaleX;
|
float scaleX;
|
||||||
|
|
Loading…
Reference in New Issue