OSDN Git Service

[Refactor] #37353 alloc_entry 構造体定義を util.h に移動して関連変数を整理.
[hengband/hengband.git] / src / util.h
1 #pragma once
2
3 /*
4  * Sort-array element
5  */
6 typedef struct tag_type tag_type;
7
8 struct tag_type
9 {
10         int tag;
11         int index;
12 };
13
14 /*
15  * An entry for the object/monster allocation functions
16  *
17  * Pass 1 is determined from allocation information
18  * Pass 2 is determined from allocation restriction
19  * Pass 3 is determined from allocation calculation
20  */
21
22 typedef struct alloc_entry alloc_entry;
23
24 struct alloc_entry
25 {
26         KIND_OBJECT_IDX index;          /* The actual index */
27
28         DEPTH level;            /* Base dungeon level */
29         PROB prob1;             /* Probability, pass 1 */
30         PROB prob2;             /* Probability, pass 2 */
31         PROB prob3;             /* Probability, pass 3 */
32
33         u16b total;             /* Unused for now */
34 };
35
36 /* util.c */
37 extern errr path_parse(char *buf, int max, concptr file);
38 extern errr path_build(char *buf, int max, concptr path, concptr file);
39 extern FILE *my_fopen(concptr file, concptr mode);
40 extern FILE *my_fopen_temp(char *buf, int max);
41 extern errr my_fgets(FILE *fff, char *buf, huge n);
42 extern errr my_fputs(FILE *fff, concptr buf, huge n);
43 extern errr my_fclose(FILE *fff);
44 extern errr fd_kill(concptr file);
45 extern errr fd_move(concptr file, concptr what);
46 extern errr fd_copy(concptr file, concptr what);
47 extern int fd_make(concptr file, BIT_FLAGS mode);
48 extern int fd_open(concptr file, int flags);
49 extern errr fd_lock(int fd, int what);
50 extern errr fd_seek(int fd, huge n);
51 extern errr fd_chop(int fd, huge n);
52 extern errr fd_read(int fd, char *buf, huge n);
53 extern errr fd_write(int fd, concptr buf, huge n);
54 extern errr fd_close(int fd);
55 extern void flush(void);
56 extern void bell(void);
57 extern errr play_music(int type, int num);
58 extern void select_floor_music(void);
59 extern void sound(int num);
60 extern void move_cursor(int row, int col);
61 extern void text_to_ascii(char *buf, concptr str);
62 extern void ascii_to_text(char *buf, concptr str);
63 extern errr macro_add(concptr pat, concptr act);
64 extern sint macro_find_exact(concptr pat);
65 extern char inkey(void);
66 extern concptr quark_str(STR_OFFSET num);
67 extern void quark_init(void);
68 extern u16b quark_add(concptr str);
69 extern s32b message_num(void);
70 extern concptr message_str(int age);
71 extern void message_add(concptr msg);
72 extern void msg_erase(void);
73 extern void msg_print(concptr msg);
74 extern void msg_print_wizard(int cheat_type, concptr msg);
75 #ifndef SWIG
76 extern void msg_format(concptr fmt, ...);
77 extern void msg_format_wizard(int cheat_type, concptr fmt, ...);
78 #endif /* SWIG */
79 extern void screen_save(void);
80 extern void screen_load(void);
81 extern void c_put_str(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col);
82 extern void put_str(concptr str, TERM_LEN row, TERM_LEN col);
83 extern void c_prt(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col);
84 extern void prt(concptr str, TERM_LEN row, TERM_LEN col);
85 extern void c_roff(TERM_COLOR attr, concptr str);
86 extern void roff(concptr str);
87 extern void clear_from(int row);
88 extern bool askfor_aux(char *buf, int len, bool numpad_cursor);
89 extern bool askfor(char *buf, int len);
90 extern bool get_string(concptr prompt, char *buf, int len);
91 extern bool get_check(concptr prompt);
92 extern bool get_check_strict(concptr prompt, BIT_FLAGS mode);
93 extern bool get_com(concptr prompt, char *command, bool z_escape);
94 extern QUANTITY get_quantity(concptr prompt, QUANTITY max);
95 extern void pause_line(int row);
96 extern void request_command(int shopping);
97 extern bool is_a_vowel(int ch);
98 extern int get_keymap_dir(char ch);
99 extern errr type_string(concptr str, uint len);
100 extern void roff_to_buf(concptr str, int wlen, char *tbuf, size_t bufsize);
101
102 #ifdef SORT_R_INFO
103 extern void tag_sort(tag_type elements[], int number);
104 #endif /* SORT_R_INFO */
105
106 #ifdef SUPPORT_GAMMA
107 extern byte gamma_table[256];
108 extern void build_gamma_table(int gamma);
109 #endif /* SUPPORT_GAMMA */
110
111 extern size_t my_strcpy(char *buf, concptr src, size_t bufsize);
112 extern size_t my_strcat(char *buf, concptr src, size_t bufsize);
113 extern char *my_strstr(concptr haystack, concptr needle);
114 extern char *my_strchr(concptr ptr, char ch);
115 extern void str_tolower(char *str);
116 extern int inkey_special(bool numpad_cursor);
117