예제 #1
0
/**
 * @brief Console command binding for save function
 * @sa SAV_GameSave
 * @note called via 'game_save' command
 */
static void SAV_GameSave_f (void)
{
	char comment[MAX_VAR] = "";
	char *error = NULL;
	bool result;

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

	if (!CP_IsRunning()) {
		Com_Printf("No running game - no saving...\n");
		return;
	}

	/* get comment */
	if (Cmd_Argc() > 2) {
		const char *arg = Cmd_Argv(2);
		Q_strncpyz(comment, arg, sizeof(comment));
	}

	result = SAV_GameSave(Cmd_Argv(1), comment, &error);
	if (!result) {
		if (error)
			CP_Popup(_("Note"), "%s\n%s", _("Error saving game."), error);
		else
			CP_Popup(_("Note"), "%s\n%s", "%s\n", _("Error saving game."));
	}
}
예제 #2
0
/**
 * @brief Quick save the current campaign
 * @sa CP_StartMissionMap
 */
bool SAV_QuickSave (void)
{
	char *error = NULL;
	bool result;

	if (cgi->CL_OnBattlescape())
		return false;

	result = SAV_GameSave("slotquick", _("QuickSave"), &error);
	if (!result)
		Com_Printf("Error saving the xml game: %s\n", error ? error : "");

	return true;
}
예제 #3
0
파일: cp_save.cpp 프로젝트: AresAndy/ufoai
/**
 * @brief Saves to the quick save slot
 */
static void SAV_GameQuickSave_f (void)
{
	if (!CP_IsRunning())
		return;
	if (cgi->CL_OnBattlescape())
		return;

	char* error = nullptr;
	bool result = SAV_GameSave("slotquick", _("QuickSave"), &error);
	if (!result)
		Com_Printf("Error saving the xml game: %s\n", error ? error : "");
	else
		MS_AddNewMessage(_("Quicksave"), _("Campaign was successfully saved."), MSG_INFO);
}