Refactor savegame information
Coalesce it out of three header files into one (save.h). This also includes references to NextActivity, which may be the wrong place to do it. Time will tell.
This commit is contained in:
+1
-1
@@ -31,8 +31,8 @@
|
|||||||
#include "endian_uqm.h"
|
#include "endian_uqm.h"
|
||||||
#include "gamestr.h"
|
#include "gamestr.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "load.h"
|
|
||||||
#include "oscill.h"
|
#include "oscill.h"
|
||||||
|
#include "save.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "sis.h"
|
#include "sis.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "gamestr.h"
|
#include "gamestr.h"
|
||||||
#include "load.h"
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "save.h"
|
#include "save.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|||||||
+1
-3
@@ -18,16 +18,14 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "load.h"
|
|
||||||
|
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "libs/declib.h"
|
#include "libs/declib.h"
|
||||||
#include "encount.h"
|
#include "encount.h"
|
||||||
#include "starmap.h"
|
#include "starmap.h"
|
||||||
#include "libs/file.h"
|
#include "libs/file.h"
|
||||||
#include "globdata.h"
|
#include "globdata.h"
|
||||||
#include "load.h"
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#include "save.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "grpinfo.h"
|
#include "grpinfo.h"
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LOAD_H
|
|
||||||
#define _LOAD_H
|
|
||||||
|
|
||||||
#include "sis.h"
|
|
||||||
// for SUMMARY_DESC
|
|
||||||
#include "libs/compiler.h"
|
|
||||||
#include "globdata.h"
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern ACTIVITY NextActivity;
|
|
||||||
|
|
||||||
extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc);
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _LOAD_H */
|
|
||||||
|
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
#include "../encount.h"
|
#include "../encount.h"
|
||||||
#include "../gamestr.h"
|
#include "../gamestr.h"
|
||||||
#include "../controls.h"
|
#include "../controls.h"
|
||||||
|
#include "../save.h"
|
||||||
#include "../settings.h"
|
#include "../settings.h"
|
||||||
#include "../shipcont.h"
|
#include "../shipcont.h"
|
||||||
#include "../load.h"
|
|
||||||
#include "../setup.h"
|
#include "../setup.h"
|
||||||
#include "../state.h"
|
#include "../state.h"
|
||||||
#include "../sis.h"
|
#include "../sis.h"
|
||||||
|
|||||||
@@ -30,13 +30,13 @@
|
|||||||
#include "../nameref.h"
|
#include "../nameref.h"
|
||||||
#include "../resinst.h"
|
#include "../resinst.h"
|
||||||
#include "../settings.h"
|
#include "../settings.h"
|
||||||
#include "../load.h"
|
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
#include "../process.h"
|
#include "../process.h"
|
||||||
#include "../setup.h"
|
#include "../setup.h"
|
||||||
#include "../sounds.h"
|
#include "../sounds.h"
|
||||||
#include "../state.h"
|
#include "../state.h"
|
||||||
#include "../sis.h"
|
#include "../sis.h"
|
||||||
|
#include "../save.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/graphics/drawable.h"
|
#include "libs/graphics/drawable.h"
|
||||||
|
|||||||
@@ -37,11 +37,11 @@
|
|||||||
#include "../ipdisp.h"
|
#include "../ipdisp.h"
|
||||||
#include "../grpinfo.h"
|
#include "../grpinfo.h"
|
||||||
#include "../process.h"
|
#include "../process.h"
|
||||||
#include "../load.h"
|
|
||||||
#include "../setup.h"
|
#include "../setup.h"
|
||||||
#include "../sounds.h"
|
#include "../sounds.h"
|
||||||
#include "../state.h"
|
#include "../state.h"
|
||||||
#include "../uqmdebug.h"
|
#include "../uqmdebug.h"
|
||||||
|
#include "../save.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/mathlib.h"
|
#include "libs/mathlib.h"
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
#include "supermelee/melee.h"
|
#include "supermelee/melee.h"
|
||||||
#include "resinst.h"
|
#include "resinst.h"
|
||||||
#include "nameref.h"
|
#include "nameref.h"
|
||||||
|
#include "save.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "load.h"
|
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
#include "setupmenu.h"
|
#include "setupmenu.h"
|
||||||
|
|||||||
+29
-2
@@ -17,14 +17,41 @@
|
|||||||
#ifndef _SAVE_H
|
#ifndef _SAVE_H
|
||||||
#define _SAVE_H
|
#define _SAVE_H
|
||||||
|
|
||||||
#include "sis.h"
|
#include "sis.h" // SUMMARY_DESC includes SIS_STATE in it
|
||||||
// for SUMMARY_DESC
|
#include "globdata.h"
|
||||||
#include "libs/compiler.h"
|
#include "libs/compiler.h"
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// XXX: Theoretically, a player can have 17 devices on board without
|
||||||
|
// cheating. We only provide
|
||||||
|
// room for 16 below, which is not really a problem since this
|
||||||
|
// is only used for displaying savegame summaries. There is also
|
||||||
|
// room for only 16 devices on screen.
|
||||||
|
#define MAX_EXCLUSIVE_DEVICES 16
|
||||||
|
#define SAVE_MAGIC 0x01534d55
|
||||||
|
#define SAVE_NAME_SIZE 24
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SIS_STATE SS;
|
||||||
|
BYTE Activity;
|
||||||
|
BYTE Flags;
|
||||||
|
BYTE day_index, month_index;
|
||||||
|
COUNT year_index;
|
||||||
|
BYTE MCreditLo, MCreditHi;
|
||||||
|
BYTE NumShips, NumDevices;
|
||||||
|
BYTE ShipList[MAX_BUILT_SHIPS];
|
||||||
|
BYTE DeviceList[MAX_EXCLUSIVE_DEVICES];
|
||||||
|
UNICODE SaveName[SAVE_NAME_SIZE];
|
||||||
|
} SUMMARY_DESC;
|
||||||
|
|
||||||
|
extern ACTIVITY NextActivity;
|
||||||
|
|
||||||
|
extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc);
|
||||||
|
|
||||||
extern void SaveProblem (void);
|
extern void SaveProblem (void);
|
||||||
extern BOOLEAN SaveGame (COUNT which_game, SUMMARY_DESC *summary_desc, const char *name);
|
extern BOOLEAN SaveGame (COUNT which_game, SUMMARY_DESC *summary_desc, const char *name);
|
||||||
|
|
||||||
|
|||||||
@@ -154,29 +154,6 @@ typedef struct
|
|||||||
UNICODE PlanetName[SIS_NAME_SIZE];
|
UNICODE PlanetName[SIS_NAME_SIZE];
|
||||||
} SIS_STATE;
|
} SIS_STATE;
|
||||||
|
|
||||||
// XXX: Theoretically, a player can have 17 devices on board without
|
|
||||||
// cheating. We only provide
|
|
||||||
// room for 16 below, which is not really a problem since this
|
|
||||||
// is only used for displaying savegame summaries. There is also
|
|
||||||
// room for only 16 devices on screen.
|
|
||||||
#define MAX_EXCLUSIVE_DEVICES 16
|
|
||||||
#define SAVE_MAGIC 0x01534d55
|
|
||||||
#define SAVE_NAME_SIZE 24
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
SIS_STATE SS;
|
|
||||||
BYTE Activity;
|
|
||||||
BYTE Flags;
|
|
||||||
BYTE day_index, month_index;
|
|
||||||
COUNT year_index;
|
|
||||||
BYTE MCreditLo, MCreditHi;
|
|
||||||
BYTE NumShips, NumDevices;
|
|
||||||
BYTE ShipList[MAX_BUILT_SHIPS];
|
|
||||||
BYTE DeviceList[MAX_EXCLUSIVE_DEVICES];
|
|
||||||
UNICODE SaveName[SAVE_NAME_SIZE];
|
|
||||||
} SUMMARY_DESC;
|
|
||||||
|
|
||||||
#define OVERRIDE_LANDER_FLAGS (1 << 7)
|
#define OVERRIDE_LANDER_FLAGS (1 << 7)
|
||||||
#define AFTER_BOMB_INSTALLED (1 << 7)
|
#define AFTER_BOMB_INSTALLED (1 << 7)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "starmap.h"
|
#include "starmap.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "gamestr.h"
|
#include "gamestr.h"
|
||||||
#include "load.h"
|
#include "save.h"
|
||||||
#include "starbase.h"
|
#include "starbase.h"
|
||||||
#include "sis.h"
|
#include "sis.h"
|
||||||
#include "resinst.h"
|
#include "resinst.h"
|
||||||
|
|||||||
@@ -24,10 +24,10 @@
|
|||||||
#include "gameev.h"
|
#include "gameev.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "globdata.h"
|
#include "globdata.h"
|
||||||
#include "load.h"
|
|
||||||
#include "resinst.h"
|
#include "resinst.h"
|
||||||
#include "restart.h"
|
#include "restart.h"
|
||||||
#include "starbase.h"
|
#include "starbase.h"
|
||||||
|
#include "save.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "master.h"
|
#include "master.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user