OSDN Git Service

2d3131b93fc32e919dad14703a255dd6355768f2
[hengband/hengband.git] / src / load / angband-version-comparer.c
1 #include "load/angband-version-comparer.h"
2 #include "world/world.h"
3
4 /*!
5  * @brief 馬鹿馬鹿蛮怒のバージョン比較処理 / This function determines if the version of the savefile currently being read is older than version
6  * "major.minor.patch.extra".
7  * @param major メジャーバージョン値
8  * @param minor マイナーバージョン値
9  * @param patch パッチバージョン値
10  * @param extra エクストラパージョン値
11  * @return 現在のバージョンより値が古いならtrue
12  */
13 bool h_older_than(byte major, byte minor, byte patch, byte extra)
14 {
15     if (current_world_ptr->h_ver_major < major)
16         return TRUE;
17     if (current_world_ptr->h_ver_major > major)
18         return FALSE;
19
20     if (current_world_ptr->h_ver_minor < minor)
21         return TRUE;
22     if (current_world_ptr->h_ver_minor > minor)
23         return FALSE;
24
25     if (current_world_ptr->h_ver_patch < patch)
26         return TRUE;
27     if (current_world_ptr->h_ver_patch > patch)
28         return FALSE;
29
30     if (current_world_ptr->h_ver_extra < extra)
31         return TRUE;
32     if (current_world_ptr->h_ver_extra > extra)
33         return FALSE;
34
35     return FALSE;
36 }
37
38 /*!
39  * @brief Zangbandのバージョン比較処理 / The above function, adapted for Zangband
40  * @param x メジャーバージョン値
41  * @param y マイナーバージョン値
42  * @param z パッチバージョン値
43  * @return 現在のバージョンより値が古いならtrue
44  */
45 bool z_older_than(byte x, byte y, byte z)
46 {
47     if (current_world_ptr->z_major < x)
48         return TRUE;
49     if (current_world_ptr->z_major > x)
50         return FALSE;
51
52     if (current_world_ptr->z_minor < y)
53         return TRUE;
54     if (current_world_ptr->z_minor > y)
55         return FALSE;
56
57     if (current_world_ptr->z_patch < z)
58         return TRUE;
59     if (current_world_ptr->z_patch > z)
60         return FALSE;
61
62     return FALSE;
63 }