Esempio n. 1
0
/**
 * @brief Console command to load a savegame
 * @sa SAV_GameLoad
 */
static void SAV_GameLoad_f (void)
{
	const char *error = NULL;

	/* get argument */
	if (Cmd_Argc() < 2) {
		Com_Printf("Usage: %s <filename>\n", Cmd_Argv(0));
		return;
	}

	/* Check if savegame exists */
	if (FS_CheckFile("save/%s.%s", Cmd_Argv(1), SAVEGAME_EXTENSION) <= 0) {
		Com_Printf("savegame file '%s' doesn't exist or an empty file\n", Cmd_Argv(1));
		return;
	}

	Com_DPrintf(DEBUG_CLIENT, "load file '%s'\n", Cmd_Argv(1));

	/* load and go to map */
	if (!SAV_GameLoad(Cmd_Argv(1), &error)) {
		Cbuf_Execute(); /* wipe outstanding campaign commands */
		cgi->UI_Popup(_("Error"), "%s\n%s", _("Error loading game."), error ? error : "");
		Cmd_ExecuteString("game_exit");
	}
}
Esempio n. 2
0
/**
 * @brief Console command to load a savegame
 * @sa SAV_GameLoad
 */
static void SAV_GameLoad_f (void)
{
	const char* error = nullptr;

	/* get argument */
	if (cgi->Cmd_Argc() < 2) {
		Com_Printf("Usage: %s <filename>\n", cgi->Cmd_Argv(0));
		return;
	}

	/* Check if savegame exists */
	char buf[MAX_OSPATH];
	cgi->GetRelativeSavePath(buf, sizeof(buf));
	if (cgi->FS_CheckFile("%s%s.%s", buf, cgi->Cmd_Argv(1), SAVEGAME_EXTENSION) <= 0) {
		Com_Printf("savegame file '%s' doesn't exist or an empty file\n", cgi->Cmd_Argv(1));
		return;
	}

	Com_DPrintf(DEBUG_CLIENT, "load file '%s'\n", cgi->Cmd_Argv(1));

	/* load and go to map */
	if (!SAV_GameLoad(cgi->Cmd_Argv(1), &error)) {
		cgi->Cbuf_Execute(); /* wipe outstanding campaign commands */
		cgi->UI_Popup(_("Error"), "%s\n%s", _("Error loading game."), error ? error : "");
		cgi->Cmd_ExecuteString("game_exit");
	}
}
Esempio n. 3
0
/**
 * @brief Loads the quick save slot
 * @sa SAV_GameQuickSave_f
 */
static void SAV_GameQuickLoad_f (void)
{
	const char *error = NULL;

	if (cgi->CL_OnBattlescape()) {
		Com_Printf("Could not load the campaign while you are on the battlefield\n");
		return;
	}

	if (!SAV_GameLoad("slotquick", &error)) {
		Cbuf_Execute(); /* wipe outstanding campaign commands */
		CP_Popup(_("Error"), "%s\n%s", _("Error loading game."), error ? error : "");
	} else {
		MS_AddNewMessage(_("Campaign loaded"), _("Quicksave campaign was successfully loaded."), MSG_INFO);
		CP_CheckBaseAttacks();
	}
}
Esempio n. 4
0
/**
 * @brief Loads the last saved game
 * @note At saving the archive cvar cl_lastsave was set to the latest savegame
 * @sa SAV_GameLoad
 */
static void SAV_GameContinue_f (void)
{
	const char *error = NULL;

	if (cgi->CL_OnBattlescape()) {
		cgi->UI_PopWindow(false);
		return;
	}

	if (!CP_IsRunning()) {
		/* try to load the last saved campaign */
		if (!SAV_GameLoad(cl_lastsave->string, &error)) {
			Cbuf_Execute(); /* wipe outstanding campaign commands */
			cgi->UI_Popup(_("Error"), "%s\n%s", _("Error loading game."), error ? error : "");
			Cmd_ExecuteString("game_exit");
		}
	} else {
		/* just continue the current running game */
		cgi->UI_PopWindow(false);
	}
}