40 if (
cgi->Cmd_Argc() < 1) {
41 cgi->Com_Printf(
"usage: %s\n",
cgi->Cmd_Argv(0));
46 cgi->GetRelativeSavePath(pathMask,
sizeof(pathMask));
47 Q_strcat(pathMask,
sizeof(pathMask),
"/*.savx");
49 cgi->FS_BuildFileList(pathMask);
52 while ((path =
cgi->FS_NextFileFromFileList(pathMask)) !=
nullptr) {
59 cgi->UI_ExecuteConfunc(
"ui_add_savegame %i \"%s\" \"%s\" \"%s\" \"%s\"", idx++,
62 cgi->FS_NextFileFromFileList(
nullptr);
72 const char* error =
nullptr;
75 if (
cgi->Cmd_Argc() < 2) {
76 cgi->Com_Printf(
"Usage: %s <filename>\n",
cgi->Cmd_Argv(0));
82 cgi->GetRelativeSavePath(
buf,
sizeof(
buf));
84 cgi->Com_Printf(
"savegame file '%s' doesn't exist or an empty file\n",
cgi->Cmd_Argv(1));
93 cgi->Cmd_ExecuteString(
"game_exit");
94 cgi->Cmd_ExecuteString(
"game_setmode campaign");
95 cgi->UI_Popup(
_(
"Error"),
"%s\n%s",
_(
"Error loading game."), error ? error :
"");
106 const char* error =
nullptr;
108 if (
cgi->CL_OnBattlescape()) {
109 cgi->UI_PopWindow(
false);
117 cgi->UI_Popup(
_(
"Error"),
"%s\n%s",
_(
"Error loading game."), error ? error :
"");
118 cgi->Cmd_ExecuteString(
"game_exit");
122 cgi->UI_PopWindow(
false);
134 if (
cgi->Cmd_Argc() < 2) {
135 cgi->Com_Printf(
"Usage: %s <filename> <comment|*cvar>\n",
cgi->Cmd_Argv(0));
141 if (
cgi->Cmd_Argc() > 2) {
142 const char* arg =
cgi->Cmd_Argv(2);
146 char* error =
nullptr;
152 CP_Popup(
_(
"Note"),
"%s\n%s",
_(
"Error saving game."), error);
154 CP_Popup(
_(
"Note"),
"%s\n%s",
"%s\n",
_(
"Error saving game."));
162 if (
cgi->Cmd_Argc() != 2) {
163 cgi->Com_Printf(
"Usage: %s <filename>\n",
cgi->Cmd_Argv(0));
166 const char* savegame =
cgi->Cmd_Argv(1);
169 cgi->GetAbsoluteSavePath(
buf,
sizeof(
buf));
181 if (
cgi->CL_OnBattlescape()) {
186 cgi->GetRelativeSavePath(
buf,
sizeof(
buf));
188 cgi->UI_PushWindow(
"quickload");
199 if (
cgi->CL_OnBattlescape())
202 char* error =
nullptr;
203 bool result =
SAV_GameSave(
"slotquick",
_(
"QuickSave"), &error);
205 cgi->Com_Printf(
"Error saving the xml game: %s\n", error ? error :
"");
216 const char* error =
nullptr;
218 if (
cgi->CL_OnBattlescape()) {
219 cgi->Com_Printf(
"Could not load the campaign while you are on the battlefield\n");
225 CP_Popup(
_(
"Error"),
"%s\n%s",
_(
"Error loading game."), error ? error :
"");
237 if (
cgi->Cmd_Argc() < 2) {
238 cgi->Com_Printf(
"Usage: %s <confunc_callback>\n",
cgi->Cmd_Argv(0));
241 const char* callback =
cgi->Cmd_Argv(1);
243 char* error =
nullptr;
246 cgi->UI_ExecuteConfunc(
"%s %s \"%s\"", callback, allowed ?
"true" :
"false", error ? error :
"");
259 {
nullptr,
nullptr,
nullptr}
Share stuff between the different cgame implementations.
bool CP_IsRunning(void)
Checks whether a campaign mode game is running.
Header file for single player campaign control.
const cgame_import_t * cgi
uiMessageListNodeMessage_t * MS_AddNewMessage(const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup, bool playSound)
Adds a new message to message stack.
void CP_CheckBaseAttacks(void)
Check and start baseattack missions.
Campaign mission headers.
bool SAV_GameLoad(const char *file, const char **error)
Loads the given savegame from an xml File.
bool SAV_LoadHeader(const char *filename, saveFileHeader_t *header)
Loads and verifies a savegame header.
bool SAV_GameSaveAllowed(char **error=nullptr)
Determines if saving is allowed.
bool SAV_GameSave(const char *filename, const char *comment, char **error)
This is a savegame function which stores the game in xml-Format.
Defines some savefile structures.
#define SAVEGAME_EXTENSION
static void SAV_GameLoad_f(void)
Console command to load a savegame.
void SAV_InitCallbacks(void)
Register UI callbacks for the savegame-subsystem.
static void SAV_GameQuickSave_f(void)
Saves to the quick save slot.
static const cmdList_t saveCallbacks[]
static void SAV_GameQuickLoadInit_f(void)
Checks whether there is a quicksave file and opens the quickload menu if there is one.
void SAV_ShutdownCallbacks(void)
UnregisterUI callbacks for the savegame-subsystem.
static void SAV_GameContinue_f(void)
Loads the last saved game.
static void SAV_GameQuickLoad_f(void)
Loads the quick save slot.
static void SAV_GameDelete_f(void)
Removes savegame file.
static void SAV_GameSave_f(void)
Console command binding for save function.
static void SAV_GameSaveAllowed_f(void)
Returns whether saving game is allowed.
static cvar_t * cl_lastsave
static void SAV_ListSaveGames_f(void)
Console command to list savegames.
Header file for Savegame UI callbacks.
void Com_StripExtension(const char *in, char *out, const size_t size)
Removes the file extension from a filename.
const char * Com_SkipPath(const char *pathname)
Returns just the filename from a given path.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
This is a cvar definition. Cvars can be user modified and used in our menus e.g.