summaryrefslogtreecommitdiff
path: root/include/SSVOpenHexagon/Global/Version.hpp
blob: a3e4539f4971a33311c2b5d816d06f0e2708ab7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2013-2020 Vittorio Romeo
// License: Academic Free License ("AFL") v. 3.0
// AFL License page: https://opensource.org/licenses/AFL-3.0

#pragma once

namespace hg {

// Allow us to represent the game's version in a major.minor.micro format
struct GameVersion
{
    int major;
    int minor;
    int micro;

    [[nodiscard]] constexpr bool operator<(
        const GameVersion& rhs) const noexcept
    {
        if(major != rhs.major)
        {
            return major < rhs.major;
        }

        if(minor != rhs.minor)
        {
            return minor < rhs.minor;
        }

        return micro < rhs.micro;
    }

    [[nodiscard]] constexpr bool operator==(
        const GameVersion& other) const noexcept
    {
        return (major == other.major) && (minor == other.minor) &&
               (micro == other.micro);
    }

    [[nodiscard]] constexpr bool operator!=(
        const GameVersion& other) const noexcept
    {
        return !(*this == other);
    }
};

inline constexpr GameVersion GAME_VERSION{2, 1, 4};
inline constexpr auto& GAME_VERSION_STR = "2.1.4";

} // namespace hg