#include "angband.h"
#include "store.h"
+#include "player-status.h"
+#include "player-move.h"
+#include "object-flavor.h"
+#include "object-hook.h"
+
+#include "files.h"
#define MAX_LINELEN 1024
/*
* A function to create new entry
*/
-static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_default)
+static bool autopick_new_entry(autopick_type *entry, concptr str, bool allow_default)
{
- cptr insc;
+ concptr insc;
int i;
byte act = 0;
char buf[MAX_LINELEN];
- cptr prev_ptr, ptr, old_ptr;
+ concptr prev_ptr, ptr, old_ptr;
int prev_flg;
if (str[0] && str[1] == ':') switch (str[0])
/*
* Get file name for autopick preference
*/
-static cptr pickpref_filename(int filename_mode)
+static concptr pickpref_filename(int filename_mode)
{
static const char namebase[] = _("picktype", "pickpref");
/*
* Reconstruct preference line from entry
*/
-cptr autopick_line_from_entry(autopick_type *entry)
+concptr autopick_line_from_entry(autopick_type *entry)
{
char buf[MAX_LINELEN];
char *ptr;
/*
* Reconstruct preference line from entry and kill entry
*/
-static cptr autopick_line_from_entry_kill(autopick_type *entry)
+static concptr autopick_line_from_entry_kill(autopick_type *entry)
{
- cptr ptr = autopick_line_from_entry(entry);
+ concptr ptr = autopick_line_from_entry(entry);
/* Free memory for original entry */
autopick_free_entry(entry);
* A function for Auto-picker/destroyer
* Examine whether the object matches to the entry
*/
-static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_name)
+static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, concptr o_name)
{
int j;
- cptr ptr = entry->name;
+ concptr ptr = entry->name;
/*** Unaware items ***/
if (IS_FLG(FLG_UNAWARE) && object_is_aware(o_ptr))
/* Destroy Later */
o_ptr->marked |= OM_AUTODESTROY;
- p_ptr->notice |= PN_AUTODESTROY;
+ p_ptr->update |= PU_AUTODESTROY;
return;
}
if (item >= 0) o_ptr = &inventory[item];
/* Get the item (on the floor) */
- else o_ptr = &o_list[0 - item];
+ else o_ptr = ¤t_floor_ptr->o_list[0 - item];
if (o_ptr->k_idx && (o_ptr->marked & OM_AUTODESTROY))
{
autopick_delayed_alter_aux(item);
/* Scan the pile of objects */
- item = cave[p_ptr->y][p_ptr->x].o_idx;
+ item = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx;
while (item)
{
- OBJECT_IDX next = o_list[item].next_o_idx;
+ OBJECT_IDX next = current_floor_ptr->o_list[item].next_o_idx;
autopick_delayed_alter_aux(-item);
item = next;
}
if (item >= 0) o_ptr = &inventory[item];
/* Get the item (on the floor) */
- else o_ptr = &o_list[0 - item];
+ else o_ptr = ¤t_floor_ptr->o_list[0 - item];
/* Get the index in the auto-pick/destroy list */
idx = is_autopick(o_ptr);
/*
* Automatically pickup/destroy items in this grid.
*/
-void autopick_pickup_items(cave_type *c_ptr)
+void autopick_pickup_items(grid_type *g_ptr)
{
OBJECT_IDX this_o_idx, next_o_idx = 0;
/* Scan the pile of objects */
- for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
int idx;
- object_type *o_ptr = &o_list[this_o_idx];
-
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
+ object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
+ next_o_idx = o_ptr->next_o_idx;
idx = is_autopick(o_ptr);
/* Already registered */
if (match_autopick != -1)
{
- cptr what;
+ concptr what;
byte act = autopick_list[match_autopick].action;
if (act & DO_AUTOPICK) what = _("自動で拾う", "auto-pickup");
byte mark;
object_type *search_o_ptr;
- cptr search_str;
- cptr last_destroyed;
+ concptr search_str;
+ concptr last_destroyed;
chain_str_type *yank;
bool yank_eol;
- cptr *lines_list;
+ concptr *lines_list;
byte states[MAX_LINES];
u16b dirty_flags;
*/
static void describe_autopick(char *buff, autopick_type *entry)
{
- cptr str = entry->name;
+ concptr str = entry->name;
byte act = entry->action;
- cptr insc = entry->insc;
+ concptr insc = entry->insc;
int i;
bool top = FALSE;
#ifdef JP
- cptr before_str[100], body_str;
+ concptr before_str[100], body_str;
int before_n = 0;
body_str = "アイテム";
#else /* JP */
- cptr before_str[20], after_str[20], which_str[20], whose_str[20], body_str;
+ concptr before_str[20], after_str[20], which_str[20], whose_str[20], body_str;
int before_n = 0, after_n = 0, which_n = 0, whose_n = 0;
body_str = "items";
/*
* Read whole lines of a file to memory
*/
-static cptr *read_text_lines(cptr filename)
+static concptr *read_text_lines(concptr filename)
{
- cptr *lines_list = NULL;
+ concptr *lines_list = NULL;
FILE *fff;
int lines = 0;
if (fff)
{
/* Allocate list of pointers */
- C_MAKE(lines_list, MAX_LINES, cptr);
+ C_MAKE(lines_list, MAX_LINES, concptr);
/* Parse it */
while (0 == my_fgets(fff, buf, sizeof(buf)))
*/
static void prepare_default_pickpref(void)
{
- const cptr messages[] = {
+ const concptr messages[] = {
_("あなたは「自動拾いエディタ」を初めて起動しました。", "You have activated the Auto-Picker Editor for the first time."),
_("自動拾いのユーザー設定ファイルがまだ書かれていないので、", "Since user pref file for autopick is not yet created,"),
_("基本的な自動拾い設定ファイルをlib/pref/picktype.prfからコピーします。", "the default setting is loaded from lib/pref/pickpref.prf ."),
FILE *pref_fp;
FILE *user_fp;
int i;
- cptr filename = pickpref_filename(PT_DEFAULT);
+ concptr filename = pickpref_filename(PT_DEFAULT);
/* Display messages */
for (i = 0; messages[i]; i++) msg_print(messages[i]);
* Read an autopick prefence file to memory
* Prepare default if no user file is found
*/
-static cptr *read_pickpref_text_lines(int *filename_mode_p)
+static concptr *read_pickpref_text_lines(int *filename_mode_p)
{
char buf[1024];
- cptr *lines_list;
+ concptr *lines_list;
/* Try a filename with player name */
*filename_mode_p = PT_WITH_PNAME;
if (!lines_list)
{
/* Allocate list of pointers */
- C_MAKE(lines_list, MAX_LINES, cptr);
+ C_MAKE(lines_list, MAX_LINES, concptr);
lines_list[0] = string_make("");
}
return lines_list;
/*
* Write whole lines of memory to a file.
*/
-static bool write_text_lines(cptr filename, cptr *lines_list)
+static bool write_text_lines(concptr filename, concptr *lines_list)
{
FILE *fff;
/*
* Free memory of lines_list.
*/
-static void free_text_lines(cptr *lines_list)
+static void free_text_lines(concptr *lines_list)
{
int lines;
string_free(lines_list[lines]);
/* free list of pointers */
- C_KILL(lines_list, MAX_LINES, cptr);
+ C_KILL(lines_list, MAX_LINES, concptr);
}
*/
static void check_expression_line(text_body_type *tb, int y)
{
- cptr s = tb->lines_list[y];
+ concptr s = tb->lines_list[y];
if ((s[0] == '?' && s[1] == ':') ||
(tb->states[y] & LSTAT_BYPASS))
static bool entry_from_choosed_object(autopick_type *entry)
{
object_type *o_ptr;
- cptr q, s;
+ concptr q, s;
q = _("どのアイテムを登録しますか? ", "Enter which item? ");
s = _("アイテムを持っていない。", "You have nothing to enter.");
/*
* Choose an item for search
*/
-static byte get_object_for_search(object_type **o_handle, cptr *search_strp)
+static byte get_object_for_search(object_type **o_handle, concptr *search_strp)
{
char buf[MAX_NLEN+20];
object_type *o_ptr;
- cptr q, s;
+ concptr q, s;
q = _("どのアイテムを検索しますか? ", "Enter which item? ");
s = _("アイテムを持っていない。", "You have nothing to enter.");
/*
* Prepare for search by destroyed object
*/
-static byte get_destroyed_object_for_search(object_type **o_handle, cptr *search_strp)
+static byte get_destroyed_object_for_search(object_type **o_handle, concptr *search_strp)
{
char buf[MAX_NLEN+20];
/*
* Choose an item or string for search
*/
-static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
+static byte get_string_for_search(object_type **o_handle, concptr *search_strp)
{
int pos = 0;
/*
* Search next line matches to the string
*/
-static void search_for_string(text_body_type *tb, cptr search_str, bool forward)
+static void search_for_string(text_body_type *tb, concptr search_str, bool forward)
{
int bypassed_cy = -1;
int bypassed_cx = 0;
while (TRUE)
{
- cptr pos;
+ concptr pos;
/* End of list? */
if (forward)
typedef struct {
- cptr name;
+ concptr name;
int level;
int key;
int com_id;
for (i = start; menu_data[i].level >= level; i++)
{
char com_key_str[3];
- cptr str;
+ concptr str;
/* Ignore lower level sub menus */
if (menu_data[i].level > level) continue;
}
-static chain_str_type *new_chain_str(cptr str)
+static chain_str_type *new_chain_str(concptr str)
{
chain_str_type *chain;
}
-static void add_str_to_yank(text_body_type *tb, cptr str)
+static void add_str_to_yank(text_body_type *tb, concptr str)
{
chain_str_type *chain;
for (y = 0; tb->lines_list[y]; y++)
{
char f;
- cptr v;
- cptr s = tb->lines_list[y];
+ concptr v;
+ concptr s = tb->lines_list[y];
char *ss, *s_keep;
int s_len;
{
int j;
int leftcol = 0;
- cptr msg;
+ concptr msg;
byte color;
int y = tb->upper+i;
if (tb->old_cy != tb->cy || (tb->dirty_flags & (DIRTY_ALL | DIRTY_NOT_FOUND | DIRTY_NO_SEARCH)) || tb->dirty_line == tb->cy)
{
autopick_type an_entry, *entry = &an_entry;
- cptr str1 = NULL, str2 = NULL;
+ concptr str1 = NULL, str2 = NULL;
/* Clear information line */
{
char buf[MAX_LINELEN];
char temp[MAX_LINELEN];
- cptr t;
+ concptr t;
describe_autopick(buf, entry);
static void kill_line_segment(text_body_type *tb, int y, int x0, int x1, bool whole)
{
char buf[MAX_LINELEN];
- cptr s = tb->lines_list[y];
+ concptr s = tb->lines_list[y];
char *d = buf;
int x;
char tmp[1024];
char buf[2];
BIT_FLAGS mode;
- cptr act;
+ concptr act;
/* Roguelike */
if (rogue_like_commands)
/* Paste text */
while (chain)
{
- cptr yank_str = chain->s;
+ concptr yank_str = chain->s;
char buf[MAX_LINELEN];
int i;
tb->dirty_line = -1;
tb->filename_mode = PT_DEFAULT;
- if (turn < old_autosave_turn)
+ if (current_world_ptr->game_turn < old_autosave_turn)
{
- while (old_autosave_turn > turn) old_autosave_turn -= TURNS_PER_TICK * TOWN_DAWN;
+ while (old_autosave_turn > current_world_ptr->game_turn) old_autosave_turn -= TURNS_PER_TICK * TOWN_DAWN;
}
/* Autosave */
- if (turn > old_autosave_turn + 100L)
+ if (current_world_ptr->game_turn > old_autosave_turn + 100L)
{
do_cmd_save_game(TRUE);
- old_autosave_turn = turn;
+ old_autosave_turn = current_world_ptr->game_turn;
}
- /* HACK -- Reset start_time to stop counting playtime while edit */
+ /* HACK -- Reset start_time to stop counting current_world_ptr->play_time while edit */
update_playtime();
/* Free old entries */
/* Reload autopick pref */
process_autopick_file(buf);
- /* HACK -- reset start_time so that playtime is not increase while edit */
+ /* HACK -- reset start_time so that current_world_ptr->play_time is not increase while edit */
start_time = (u32b)time(NULL);
/* Save cursor location */