OSDN Git Service

[Refactor] #37353 player-sex.c/h を作成して関連構造体と変数を移動.
[hengband/hengband.git] / src / types.h
1 #pragma once
2
3 /*!
4  * @file types.h
5  * @brief グローバルな構造体の定義 / global type declarations
6  * @date 2014/08/10
7  * @author
8  * <pre>
9  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
10  * This software may be copied and distributed for educational, research,
11  * and not for profit purposes provided that this copyright and statement
12  * are included in all such copies.  Other copyrights may also apply.
13  * </pre>
14  * @details
15  * <pre>
16  * このファイルはangband.hでのみインクルードすること。
17  * This file should ONLY be included by "angband.h"
18  *
19  * Note that "char" may or may not be signed, and that "signed char"
20  * may or may not work on all machines.  So always use "s16b" or "s32b"
21  * for signed values.  Also, note that unsigned values cause math problems
22  * in many cases, so try to only use "u16b" and "u32b" for "bit flags",
23  * unless you really need the extra bit of information, or you really
24  * need to restrict yourself to a single byte for storage reasons.
25  *
26  * Also, if possible, attempt to restrict yourself to sub-fields of
27  * known size (use "s16b" or "s32b" instead of "int", and "byte" instead
28  * of "bool"), and attempt to align all fields along four-byte words, to
29  * optimize storage issues on 32-bit machines.  Also, avoid "bit flags"
30  * since these increase the code size and slow down execution.  When
31  * you need to store bit flags, use one byte per flag, or, where space
32  * is an issue, use a "byte" or "u16b" or "u32b", and add special code
33  * to access the various bit flags.
34  *
35  * Many of these structures were developed to reduce the number of global
36  * variables, facilitate structured program design, allow the use of ascii
37  * template files, simplify access to indexed data, or facilitate efficient
38  * clearing of many variables at once.
39  *
40  * Certain data is saved in multiple places for efficient access, currently,
41  * this includes the tval/sval/weight fields in "object_type", various fields
42  * in "header_type", and the "m_idx" and "o_idx" fields in "grid_type".  All
43  * of these could be removed, but this would, in general, slow down the game
44  * and increase the complexity of the code.
45  * </pre>
46  */
47
48 #include "h-type.h"
49 #include "defines.h"
50 #include "object.h"
51
52 //#include "player-skill.h"
53
54
55
56 typedef struct mbe_info_type mbe_info_type;
57
58 struct mbe_info_type
59 {
60         int power;        /* The attack "power" */
61         int explode_type; /* Explosion effect */
62 };
63
64 /*
65  * The "name" of spell 'N' is stored as spell_names[X][N],
66  * where X is 0 for mage-spells and 1 for priest-spells.
67  */
68 typedef struct magic_type magic_type;
69
70 struct magic_type
71 {
72         PLAYER_LEVEL slevel;    /* Required level (to learn) */
73         MANA_POINT smana;               /* Required mana (to cast) */
74         PERCENTAGE sfail;               /* Minimum chance of failure */
75         EXP sexp;                               /* Encoded experience bonus */
76 };
77
78
79 typedef struct kamae kamae;
80
81 struct kamae
82 {
83         concptr desc;       /* A verbose kamae description */
84         PLAYER_LEVEL min_level;  /* Minimum level to use */
85         concptr info;
86 };
87
88
89 typedef bool (*monsterrace_hook_type)(MONRACE_IDX r_idx);
90
91
92 /*
93  * This seems like a pretty standard "typedef"
94  */
95 typedef int (*inven_func)(object_type *);
96
97
98 typedef struct
99 {
100         FEAT_IDX feat;    /* Feature tile */
101         PERCENTAGE percent; /* Chance of type */
102 }
103 feat_prob;
104
105 typedef struct {
106         int flag;
107         int type;
108         concptr name;
109 } dragonbreath_type;