OSDN Git Service

4194b14b0f92090dc755b850cc194cac00015a26
[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  * The "name" of spell 'N' is stored as spell_names[X][N],
57  * where X is 0 for mage-spells and 1 for priest-spells.
58  */
59 typedef struct magic_type magic_type;
60
61 struct magic_type
62 {
63         PLAYER_LEVEL slevel;    /* Required level (to learn) */
64         MANA_POINT smana;               /* Required mana (to cast) */
65         PERCENTAGE sfail;               /* Minimum chance of failure */
66         EXP sexp;                               /* Encoded experience bonus */
67 };
68
69 typedef bool (*monsterrace_hook_type)(MONRACE_IDX r_idx);