#include "angband.h"
#include "util.h"
+#include "files.h"
+#include "core.h"
#include "birth.h"
#include "files.h"
#include "bldg.h"
+#include "cmd-magiceat.h"
+#include "cmd-dump.h"
#include "world.h"
+#include "player-race.h"
#include "player-status.h"
#include "player-move.h"
#include "player-class.h"
#include "player-skill.h"
+#include "player-personality.h"
+#include "player-sex.h"
+#include "player-effects.h"
#include "sort.h"
#include "mutation.h"
#include "quest.h"
#include "monster-status.h"
#include "object-flavor.h"
#include "object-hook.h"
+#include "realm.h"
#include "realm-hex.h"
#include "cmd-pet.h"
#include "spells.h"
#include "term.h"
#include "view-mainwindow.h"
#include "floor-events.h"
+#include "floor-town.h"
#include "dungeon-file.h"
#include "init.h"
#include "monster-spell.h"
#include "melee.h"
#include "objectkind.h"
#include "autopick.h"
+#include "save.h"
+#include "realm-song.h"
+
+concptr ANGBAND_DIR; //!< Path name: The main "lib" directory This variable is not actually used anywhere in the code
+concptr ANGBAND_DIR_APEX; //!< High score files (binary) These files may be portable between platforms
+concptr ANGBAND_DIR_BONE; //!< Bone files for player ghosts (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_DATA; //!< Binary image files for the "*_info" arrays (binary) These files are not portable between platforms
+concptr ANGBAND_DIR_EDIT; //!< Textual template files for the "*_info" arrays (ascii) These files are portable between platforms
+concptr ANGBAND_DIR_SCRIPT; //!< Script files These files are portable between platforms.
+concptr ANGBAND_DIR_FILE; //!< Various extra files (ascii) These files may be portable between platforms
+concptr ANGBAND_DIR_HELP; //!< Help files (normal) for the online help (ascii) These files are portable between platforms
+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_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
+
+s16b signal_count; /* Hack -- Count interupts */
+
+/*
+ * Buffer to hold the current savefile name
+ * 'savefile' holds full path name. 'savefile_base' holds only base name.
+ */
+char savefile[1024];
+char savefile_base[40];
+
/*
# ifdef SAFE_SETUID_POSIX
- if (setuid(player_euid) != 0)
+ if (setuid(p_ptr->player_egid) != 0)
{
quit(_("setuid(): 正しく許可が取れません!", "setuid(): cannot set permissions correctly!"));
}
- if (setgid(player_egid) != 0)
+ if (setgid(p_ptr->player_egid) != 0)
{
quit(_("setgid(): 正しく許可が取れません!", "setgid(): cannot set permissions correctly!"));
}
int os = option_info[i].o_set;
int ob = option_info[i].o_bit;
- if ((p_ptr->playing || character_xtra) &&
+ if ((p_ptr->playing || current_world_ptr->character_xtra) &&
(OPT_PAGE_BIRTH == option_info[i].o_page) && !p_ptr->wizard)
{
msg_format(_("初期オプションは変更できません! '%s'", "Birth options can not changed! '%s'"), buf);
char buf[1024];
errr err1, err2;
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_PREF, name);
/* Process the system pref file */
/* Stop at parser errors, but not at non-existing file */
if (err1 > 0) return err1;
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
/* Process the user pref file */
char buf[1024];
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "time.txt");
/* Open the file */
char temphost[MAXHOSTNAMELEN+1];
char thishost[MAXHOSTNAMELEN+1];
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "load.txt");
/* Open the "load" file */
if (IS_FAST() || p_ptr->slow)
add_flag(flgs, TR_SPEED);
- if (IS_OPPOSE_ACID() && !(p_ptr->special_defense & DEFENSE_ACID) && !(prace_is_(RACE_YEEK) && (p_ptr->lev > 19)))
+ if (IS_OPPOSE_ACID() && !(p_ptr->special_defense & DEFENSE_ACID) && !(PRACE_IS_(p_ptr, RACE_YEEK) && (p_ptr->lev > 19)))
add_flag(flgs, TR_RES_ACID);
if (IS_OPPOSE_ELEC() && !(p_ptr->special_defense & DEFENSE_ELEC))
add_flag(flgs, TR_RES_ELEC);
for (i = 0; i < TR_FLAG_SIZE; i++)
flgs[i] = 0L;
- if (prace_is_(RACE_SPECTRE))
+ if (PRACE_IS_(p_ptr, RACE_SPECTRE))
add_flag(flgs, TR_RES_NETHER);
- if (p_ptr->mimic_form == MIMIC_VAMPIRE || prace_is_(RACE_VAMPIRE))
+ if (p_ptr->mimic_form == MIMIC_VAMPIRE || PRACE_IS_(p_ptr, RACE_VAMPIRE))
add_flag(flgs, TR_RES_DARK);
if (p_ptr->mimic_form == MIMIC_DEMON_LORD)
add_flag(flgs, TR_RES_FIRE);
- else if (prace_is_(RACE_YEEK) && p_ptr->lev > 19)
+ else if (PRACE_IS_(p_ptr, RACE_YEEK) && p_ptr->lev > 19)
add_flag(flgs, TR_RES_ACID);
}
add_flag(flgs, TR_RES_FIRE);
add_flag(flgs, TR_RES_COLD);
}
- if (prace_is_(RACE_ANDROID))
+ if (PRACE_IS_(p_ptr, RACE_ANDROID))
add_flag(flgs, TR_RES_ELEC);
- if (prace_is_(RACE_ENT))
+ if (PRACE_IS_(p_ptr, RACE_ENT))
add_flag(flgs, TR_RES_FIRE);
- if (prace_is_(RACE_VAMPIRE) || prace_is_(RACE_S_FAIRY) ||
+ if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || PRACE_IS_(p_ptr, RACE_S_FAIRY) ||
(p_ptr->mimic_form == MIMIC_VAMPIRE))
add_flag(flgs, TR_RES_LITE);
}
}
else if (flag1 == TR_LITE_1)
{
- if (have_dark_flag(flgs))
+ if (HAVE_DARK_FLAG(flgs))
{
c_put_str(TERM_L_DARK, "+", row, col);
header_color = TERM_WHITE;
}
- else if (have_lite_flag(flgs))
+ else if (HAVE_LITE_FLAG(flgs))
{
c_put_str(TERM_WHITE, "+", row, col);
header_color = TERM_WHITE;
if ((p_ptr->stat_max[i] > 18) && (p_ptr->stat_top[i] <= 18))
e_adj = p_ptr->stat_top[i] - (p_ptr->stat_max[i] - 19) / 10 - 19;
- if (prace_is_(RACE_ENT))
+ if (PRACE_IS_(p_ptr, RACE_ENT))
{
switch (i)
{
#endif
}
}
- else if (character_dungeon)
+ else if (current_world_ptr->character_dungeon)
{
if (!current_floor_ptr->dun_level)
{
int fd = -1;
FILE *fff = NULL;
char buf[1024];
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
/* File type is "TEXT" */
Term_get_size(&wid, &hgt);
rows = hgt - 4;
- /* Wipe finder */
strcpy(finder_str, "");
-
- /* Wipe shower */
strcpy(shower_str, "");
-
- /* Wipe caption */
strcpy(caption, "");
-
- /* Wipe the hooks */
for (i = 0; i < 68; i++)
{
hook[i][0] = '\0';
}
- /* Copy the filename */
strcpy(filename, name);
n = strlen(filename);
/* Redirect the name */
name = filename;
- /* Hack */
if (what)
{
/* Caption */
{
/* Caption */
sprintf(caption, _("ヘルプ・ファイル'%s'", "Help file '%s'"), name);
-
- /* Build the filename */
path_build(path, sizeof(path), ANGBAND_DIR_HELP, name);
/* Open the file */
{
/* Caption */
sprintf(caption, _("スポイラー・ファイル'%s'", "Info file '%s'"), name);
-
- /* Build the filename */
path_build(path, sizeof(path), ANGBAND_DIR_INFO, name);
/* Open the file */
/* Look in "info" */
if (!fff)
{
- /* Build the filename */
path_build(path, sizeof(path), ANGBAND_DIR, name);
for (i = 0; path[i]; i++)
if (!get_string(_("ファイル名: ", "File name: "), xtmp, 80)) continue;
my_fclose(fff);
-
- /* Build the filename */
path_build(buff, sizeof(buff), ANGBAND_DIR_USER, xtmp);
/* Hack -- Re-Open the file */
int i, k = 0;
char old_player_base[32] = "";
- if (character_generated) strcpy(old_player_base, player_base);
+ if (current_world_ptr->character_generated) strcpy(old_player_base, p_ptr->base_name);
/* Cannot be too long */
#if defined(MACINTOSH) || defined(ACORN)
if (c == '.') c = '_';
/* Accept all the letters */
- player_base[k++] = c;
+ p_ptr->base_name[k++] = c;
}
#else
/* Accept some letters */
#ifdef JP
if(iskanji(c)){
- if(k + 2 >= sizeof(player_base) || !p_ptr->name[i+1]) break;
- player_base[k++] = c;
+ if(k + 2 >= sizeof(p_ptr->base_name) || !p_ptr->name[i+1]) break;
+ p_ptr->base_name[k++] = c;
i++;
- player_base[k++] = p_ptr->name[i];
+ p_ptr->base_name[k++] = p_ptr->name[i];
}
#ifdef SJIS
- else if (iskana(c)) player_base[k++] = c;
+ else if (iskana(c)) p_ptr->base_name[k++] = c;
#endif
else
#endif
/* Convert path separator to underscore */
if (!strncmp(PATH_SEP, p_ptr->name+i, strlen(PATH_SEP))){
- player_base[k++] = '_';
+ p_ptr->base_name[k++] = '_';
i += strlen(PATH_SEP);
}
/* Convert some characters to underscore */
#if defined(WINDOWS)
- else if (my_strchr("\"*,/:;<>?\\|", c)) player_base[k++] = '_';
+ else if (my_strchr("\"*,/:;<>?\\|", c)) p_ptr->base_name[k++] = '_';
#endif
- else if (isprint(c)) player_base[k++] = c;
+ else if (isprint(c)) p_ptr->base_name[k++] = c;
}
#endif
/* Terminate */
- player_base[k] = '\0';
+ p_ptr->base_name[k] = '\0';
/* Require a "base" name */
- if (!player_base[0]) strcpy(player_base, "PLAYER");
+ if (!p_ptr->base_name[0]) strcpy(p_ptr->base_name, "PLAYER");
#ifdef SAVEFILE_MUTABLE
{
char temp[128];
- strcpy(savefile_base, player_base);
+ strcpy(savefile_base, p_ptr->base_name);
#ifdef SAVEFILE_USE_UID
- /* Rename the savefile, using the player_uid and player_base */
- (void)sprintf(temp, "%d.%s", player_uid, player_base);
+ /* Rename the savefile, using the p_ptr->player_uid and p_ptr->base_name */
+ (void)sprintf(temp, "%d.%s", p_ptr->player_uid, p_ptr->base_name);
#else
- /* Rename the savefile, using the player_base */
- (void)sprintf(temp, "%s", player_base);
+ /* Rename the savefile, using the p_ptr->base_name */
+ (void)sprintf(temp, "%s", p_ptr->base_name);
#endif
-
- /* Build the filename */
path_build(savefile, sizeof(savefile), ANGBAND_DIR_SAVE, temp);
}
/* Load an autopick preference file */
- if (character_generated)
+ if (current_world_ptr->character_generated)
{
- if (!streq(old_player_base, player_base)) autopick_load_pref(FALSE);
+ if (!streq(old_player_base, p_ptr->base_name)) autopick_load_pref(FALSE);
}
}
(void)strcpy(p_ptr->died_from, _("(元気に生きている)", "(alive and well)"));
/* HACK -- don't get sanity blast on updating view */
- is_loading_now = FALSE;
+ current_world_ptr->is_loading_now = FALSE;
update_creature(p_ptr);
mproc_init();
/* HACK -- reset the hackish flag */
- is_loading_now = TRUE;
+ current_world_ptr->is_loading_now = TRUE;
}
/* "Bones" name */
sprintf(tmp, "bone.%03d", current_floor_ptr->dun_level);
-
- /* Build the filename */
path_build(str, sizeof(str), ANGBAND_DIR_BONE, tmp);
/* Attempt to open the bones file */
int extra_line = 0;
#endif
Term_clear();
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("dead_j.txt", "dead.txt"));
/* Open the News file */
if (p_ptr->equip_cnt)
{
Term_clear();
- (void)show_equip(0, USE_FULL);
+ (void)show_equip(0, USE_FULL, 0);
prt(_("装備していたアイテム: -続く-", "You are using: -more-"), 0, 0);
if (inkey() == ESCAPE) return;
if (p_ptr->inven_cnt)
{
Term_clear();
- (void)show_inven(0, USE_FULL);
+ (void)show_inven(0, USE_FULL, 0);
prt(_("持っていたアイテム: -続く-", "You are carrying: -more-"), 0, 0);
if (inkey() == ESCAPE) return;
}
}
-/*!
- * @brief スコアファイル出力
- * Display some character info
- * @return なし
- */
-bool check_score(void)
-{
- Term_clear();
-
- /* No score file */
- if (highscore_fd < 0)
- {
- msg_print(_("スコア・ファイルが使用できません。", "Score file unavailable."));
- msg_print(NULL);
- return FALSE;
- }
-
-#ifndef SCORE_WIZARDS
- /* Wizard-mode pre-empts scoring */
- if (p_ptr->noscore & 0x000F)
- {
- msg_print(_("ウィザード・モードではスコアが記録されません。", "Score not registered for wizards."));
- msg_print(NULL);
- return FALSE;
- }
-#endif
-
-#ifndef SCORE_BORGS
- /* Borg-mode pre-empts scoring */
- if (p_ptr->noscore & 0x00F0)
- {
- msg_print(_("ボーグ・モードではスコアが記録されません。", "Score not registered for borgs."));
- msg_print(NULL);
- return FALSE;
- }
-#endif
-
-#ifndef SCORE_CHEATERS
- /* Cheaters are not scored */
- if (p_ptr->noscore & 0xFF00)
- {
- msg_print(_("詐欺をやった人はスコアが記録されません。", "Score not registered for cheaters."));
- msg_print(NULL);
- return FALSE;
- }
-#endif
-
- /* Interupted */
- if (!p_ptr->total_winner && streq(p_ptr->died_from, _("強制終了", "Interrupting")))
- {
- msg_print(_("強制終了のためスコアが記録されません。", "Score not registered due to interruption."));
- msg_print(NULL);
- return FALSE;
- }
-
- /* Quitter */
- if (!p_ptr->total_winner && streq(p_ptr->died_from, _("途中終了", "Quitting")))
- {
- msg_print(_("途中終了のためスコアが記録されません。", "Score not registered due to quitting."));
- msg_print(NULL);
- return FALSE;
- }
- return TRUE;
-}
-
/*!
* @brief 異常発生時のゲーム緊急終了処理 /
void exit_game_panic(void)
{
/* If nothing important has happened, just quit */
- if (!character_generated || character_saved) quit(_("緊急事態", "panic"));
+ if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(_("緊急事態", "panic"));
/* Mega-Hack -- see "msg_print()" */
msg_flag = FALSE;
int counter, test;
int line_num = 0;
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, file_name);
/* Open the file */
char buf[1024];
errr err = 0;
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
err = process_pref_file_aux(buf, PREF_TYPE_AUTOPICK);
{
char buf[1024];
errr err = 0;
- bool old_character_xtra = character_xtra;
-
- /* Build the filename */
+ bool old_character_xtra = current_world_ptr->character_xtra;
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
/* Hack -- prevent modification birth options in this file */
- character_xtra = TRUE;
+ current_world_ptr->character_xtra = TRUE;
err = process_pref_file_aux(buf, PREF_TYPE_HISTPREF);
- character_xtra = old_character_xtra;
+ current_world_ptr->character_xtra = old_character_xtra;
return (err);
}
int i;
#ifdef SAVEFILE_USE_UID
- (void)sprintf(temp1, "%d.%s.%d%d%d", player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
+ (void)sprintf(temp1, "%d.%s.%d%d%d", p_ptr->player_uid, savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
#else
(void)sprintf(temp1, "%s.%d%d%d", savefile_base, p_ptr->pclass, p_ptr->pseikaku, p_ptr->age);
#endif
/* Nothing to save, just quit */
- if (!character_generated || character_saved) quit(NULL);
+ if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(NULL);
/* Count the signals */
/* Nothing to save, just quit */
- if (!character_generated || character_saved) quit(NULL);
+ if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(NULL);
forget_lite();