自動デバッグセーブをlib/save/log以下に保存するよう変更した。
また、ファイルネームをyyyy-mm-dd-hh-mm-ssにして履歴を残すようにした。
concptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
concptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
concptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
concptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
concptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
concptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
+concptr ANGBAND_DIR_DEBUG_SAVE; //*< Savefiles for debug data
concptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
concptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
*/
char savefile[1024];
char savefile_base[40];
*/
char savefile[1024];
char savefile_base[40];
+char debug_savefile[1024];
/*!
* @brief プレイヤーステータスをファイルダンプ出力する
/*!
* @brief プレイヤーステータスをファイルダンプ出力する
extern char savefile[1024];
extern char savefile_base[40];
extern char savefile[1024];
extern char savefile_base[40];
+extern char debug_savefile[1024];
extern concptr ANGBAND_DIR;
extern concptr ANGBAND_DIR_APEX;
extern concptr ANGBAND_DIR;
extern concptr ANGBAND_DIR_APEX;
extern concptr ANGBAND_DIR_INFO;
extern concptr ANGBAND_DIR_PREF;
extern concptr ANGBAND_DIR_SAVE;
extern concptr ANGBAND_DIR_INFO;
extern concptr ANGBAND_DIR_PREF;
extern concptr ANGBAND_DIR_SAVE;
+extern concptr ANGBAND_DIR_DEBUG_SAVE;
extern concptr ANGBAND_DIR_USER;
extern concptr ANGBAND_DIR_XTRA;
extern concptr ANGBAND_DIR_USER;
extern concptr ANGBAND_DIR_XTRA;
validate_dir(ANGBAND_DIR_INFO, FALSE);
validate_dir(ANGBAND_DIR_PREF, TRUE);
validate_dir(ANGBAND_DIR_SAVE, FALSE);
validate_dir(ANGBAND_DIR_INFO, FALSE);
validate_dir(ANGBAND_DIR_PREF, TRUE);
validate_dir(ANGBAND_DIR_SAVE, FALSE);
+ validate_dir(ANGBAND_DIR_DEBUG_SAVE, FALSE);
validate_dir(ANGBAND_DIR_USER, TRUE);
validate_dir(ANGBAND_DIR_XTRA, TRUE);
path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
validate_dir(ANGBAND_DIR_USER, TRUE);
validate_dir(ANGBAND_DIR_XTRA, TRUE);
path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
#include "system/system-variables.h"
#include "term/screen-processor.h"
#include "term/term-color-types.h"
#include "system/system-variables.h"
#include "term/screen-processor.h"
#include "term/term-color-types.h"
#include "util/angband-files.h"
#include "world/world.h"
#include "util/angband-files.h"
#include "world/world.h"
string_free(ANGBAND_DIR_HELP);
string_free(ANGBAND_DIR_INFO);
string_free(ANGBAND_DIR_SAVE);
string_free(ANGBAND_DIR_HELP);
string_free(ANGBAND_DIR_INFO);
string_free(ANGBAND_DIR_SAVE);
+ string_free(ANGBAND_DIR_DEBUG_SAVE);
string_free(ANGBAND_DIR_USER);
string_free(ANGBAND_DIR_XTRA);
string_free(ANGBAND_DIR_USER);
string_free(ANGBAND_DIR_XTRA);
ANGBAND_DIR_PREF = string_make(libpath);
strcpy(vartail, "save");
ANGBAND_DIR_SAVE = string_make(varpath);
ANGBAND_DIR_PREF = string_make(libpath);
strcpy(vartail, "save");
ANGBAND_DIR_SAVE = string_make(varpath);
+ strcpy(vartail, "save\\log");
+ ANGBAND_DIR_DEBUG_SAVE = string_make(varpath);
#ifdef PRIVATE_USER_PATH
path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
ANGBAND_DIR_USER = string_make(buf);
#ifdef PRIVATE_USER_PATH
path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
ANGBAND_DIR_USER = string_make(buf);
#endif
strcpy(libtail, "xtra");
ANGBAND_DIR_XTRA = string_make(libpath);
#endif
strcpy(libtail, "xtra");
ANGBAND_DIR_XTRA = string_make(libpath);
+
+ time_t now = time(NULL);
+ struct tm *t = localtime(&now);
+ char tmp[128];
+ strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", t);
+ path_build(debug_savefile, sizeof(debug_savefile), ANGBAND_DIR_DEBUG_SAVE, tmp);
*/
void process_player_name(player_type *creature_ptr, bool sf)
{
*/
void process_player_name(player_type *creature_ptr, bool sf)
{
- char old_player_base[32] = "";
- if (current_world_ptr->character_generated)
- strcpy(old_player_base, creature_ptr->base_name);
+ char old_player_base[32] = "";
+ if (current_world_ptr->character_generated)
+ strcpy(old_player_base, creature_ptr->base_name);
- for (int i = 0; creature_ptr->name[i]; i++)
- {
+ for (int i = 0; creature_ptr->name[i]; i++) {
- if (iskanji(creature_ptr->name[i]))
- {
- i++;
- continue;
- }
+ if (iskanji(creature_ptr->name[i])) {
+ i++;
+ continue;
+ }
- if (iscntrl((unsigned char)creature_ptr->name[i]))
+ if (iscntrl((unsigned char)creature_ptr->name[i]))
- if (iscntrl(creature_ptr->name[i]))
+ if (iscntrl(creature_ptr->name[i]))
- {
- quit_fmt(_("'%s' という名前は不正なコントロールコードを含んでいます。", "The name '%s' contains control chars!"), creature_ptr->name);
- }
- }
-
- int k = 0;
- for (int i = 0; creature_ptr->name[i]; i++)
- {
+ {
+ quit_fmt(_("'%s' という名前は不正なコントロールコードを含んでいます。", "The name '%s' contains control chars!"), creature_ptr->name);
+ }
+ }
+
+ int k = 0;
+ for (int i = 0; creature_ptr->name[i]; i++) {
- unsigned char c = creature_ptr->name[i];
+ unsigned char c = creature_ptr->name[i];
- char c = creature_ptr->name[i];
+ char c = creature_ptr->name[i];
- if (iskanji(c)) {
- if (k + 2 >= (int)sizeof(creature_ptr->base_name) || !creature_ptr->name[i + 1])
- break;
-
- creature_ptr->base_name[k++] = c;
- i++;
- creature_ptr->base_name[k++] = creature_ptr->name[i];
- }
+ if (iskanji(c)) {
+ if (k + 2 >= (int)sizeof(creature_ptr->base_name) || !creature_ptr->name[i + 1])
+ break;
+
+ creature_ptr->base_name[k++] = c;
+ i++;
+ creature_ptr->base_name[k++] = creature_ptr->name[i];
+ }
- else if (iskana(c)) creature_ptr->base_name[k++] = c;
+ else if (iskana(c))
+ creature_ptr->base_name[k++] = c;
- if (!strncmp(PATH_SEP, creature_ptr->name + i, strlen(PATH_SEP)))
- {
- creature_ptr->base_name[k++] = '_';
- i += strlen(PATH_SEP);
- }
+ if (!strncmp(PATH_SEP, creature_ptr->name + i, strlen(PATH_SEP))) {
+ creature_ptr->base_name[k++] = '_';
+ i += strlen(PATH_SEP);
+ }
- else if (angband_strchr("\"*,/:;<>?\\|", c))
- creature_ptr->base_name[k++] = '_';
+ else if (angband_strchr("\"*,/:;<>?\\|", c))
+ creature_ptr->base_name[k++] = '_';
- else if (isprint(c))
- creature_ptr->base_name[k++] = c;
- }
+ else if (isprint(c))
+ creature_ptr->base_name[k++] = c;
+ }
- creature_ptr->base_name[k] = '\0';
- if (!creature_ptr->base_name[0])
- strcpy(creature_ptr->base_name, "PLAYER");
+ creature_ptr->base_name[k] = '\0';
+ if (!creature_ptr->base_name[0])
+ strcpy(creature_ptr->base_name, "PLAYER");
- if (!savefile_base[0] && savefile[0])
- {
- concptr s = savefile;
- while (TRUE)
- {
- concptr t;
- t = angband_strstr(s, PATH_SEP);
- if (!t)
- break;
- s = t + 1;
- }
-
- strcpy(savefile_base, s);
- }
-
- if (!savefile_base[0] || !savefile[0])
- sf = TRUE;
-
- if (sf)
- {
- char temp[128];
- strcpy(savefile_base, creature_ptr->base_name);
+ if (!savefile_base[0] && savefile[0]) {
+ concptr s = savefile;
+ while (TRUE) {
+ concptr t;
+ t = angband_strstr(s, PATH_SEP);
+ if (!t)
+ break;
+ s = t + 1;
+ }
+
+ strcpy(savefile_base, s);
+ }
+
+ if (!savefile_base[0] || !savefile[0])
+ sf = TRUE;
+
+ if (sf) {
+ char temp[128];
+ strcpy(savefile_base, creature_ptr->base_name);
- /* Rename the savefile, using the creature_ptr->player_uid and creature_ptr->base_name */
- (void)sprintf(temp, "%d.%s", creature_ptr->player_uid, creature_ptr->base_name);
+ /* Rename the savefile, using the creature_ptr->player_uid and creature_ptr->base_name */
+ (void)sprintf(temp, "%d.%s", creature_ptr->player_uid, creature_ptr->base_name);
- /* Rename the savefile, using the creature_ptr->base_name */
- (void)sprintf(temp, "%s", creature_ptr->base_name);
+ /* Rename the savefile, using the creature_ptr->base_name */
+ (void)sprintf(temp, "%s", creature_ptr->base_name);
- path_build(savefile, sizeof(savefile), ANGBAND_DIR_SAVE, temp);
- }
+ path_build(savefile, sizeof(savefile), ANGBAND_DIR_SAVE, temp);
+ }
- if (current_world_ptr->character_generated && !streq(old_player_base, creature_ptr->base_name))
- {
- autopick_load_pref(creature_ptr, FALSE);
- }
+ if (current_world_ptr->character_generated && !streq(old_player_base, creature_ptr->base_name)) {
+ autopick_load_pref(creature_ptr, FALSE);
+ }
/*!
* @brief プレイヤーの名前を変更するコマンドのメインルーチン
* Gets a name for the character, reacting to name changes.
/*!
* @brief プレイヤーの名前を変更するコマンドのメインルーチン
* Gets a name for the character, reacting to name changes.
*/
void get_name(player_type *creature_ptr)
{
*/
void get_name(player_type *creature_ptr)
{
- char tmp[64];
- strcpy(tmp, creature_ptr->name);
+ char tmp[64];
+ strcpy(tmp, creature_ptr->name);
- if (get_string(_("キャラクターの名前を入力して下さい: ", "Enter a name for your character: "), tmp, 15))
- {
- strcpy(creature_ptr->name, tmp);
- }
+ if (get_string(_("キャラクターの名前を入力して下さい: ", "Enter a name for your character: "), tmp, 15)) {
+ strcpy(creature_ptr->name, tmp);
+ }
- if (strlen(creature_ptr->name) == 0)
- {
- strcpy(creature_ptr->name, "PLAYER");
- }
+ if (strlen(creature_ptr->name) == 0) {
+ strcpy(creature_ptr->name, "PLAYER");
+ }
- strcpy(tmp, ap_ptr->title);
+ strcpy(tmp, ap_ptr->title);
- if (ap_ptr->no == 1)
- strcat(tmp, "の");
+ if (ap_ptr->no == 1)
+ strcat(tmp, "の");
- strcat(tmp, creature_ptr->name);
+ strcat(tmp, creature_ptr->name);
- term_erase(34, 1, 255);
- c_put_str(TERM_L_BLUE, tmp, 1, 34);
- clear_from(22);
-}
+ term_erase(34, 1, 255);
+ c_put_str(TERM_L_BLUE, tmp, 1, 34);
+ clear_from(22);
+}
\ No newline at end of file
strcat(temp, ".old");
safe_setuid_grab(player_ptr);
fd_kill(temp);
strcat(temp, ".old");
safe_setuid_grab(player_ptr);
fd_kill(temp);
- strcpy(filename, savefile);
if (type == SAVE_TYPE_DEBUG)
if (type == SAVE_TYPE_DEBUG)
- strcat(filename, ".debug");
+ strcpy(filename, debug_savefile);
+ if (type == SAVE_TYPE_NORMAL)
+ strcpy(filename, savefile);
+
fd_move(filename, temp);
fd_move(safe, filename);
fd_kill(temp);
fd_move(filename, temp);
fd_move(safe, filename);
fd_kill(temp);