OSDN Git Service

Merge pull request #765 from sikabane-works/release/3.0.0Alpha17
[hengbandforosx/hengbandosx.git] / src / load / angband-version-comparer.cpp
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 [互換性用/新規仕様禁止]変愚蛮怒のバージョン比較処理 / The above function, adapted for Hengband
40  * @param major メジャーバージョン値
41  * @param minor マイナーバージョン値
42  * @param patch パッチバージョン値
43  * @return 現在のバージョンより値が古いならtrue
44  * @detail
45  * 旧バージョン比較の互換性のためにのみ保持。
46  */
47 bool h_older_than(byte major, byte minor, byte patch)
48 {
49     if (current_world_ptr->h_ver_major < major)
50         return TRUE;
51     if (current_world_ptr->h_ver_major > major)
52         return FALSE;
53
54     if (current_world_ptr->h_ver_minor < minor)
55         return TRUE;
56     if (current_world_ptr->h_ver_minor > minor)
57         return FALSE;
58
59     if (current_world_ptr->h_ver_patch < patch)
60         return TRUE;
61     if (current_world_ptr->h_ver_patch > patch)
62         return FALSE;
63
64     return FALSE;
65 }