diff options
| author | Petr Mrázek <peterix@gmail.com> | 2021-02-06 15:58:03 +0100 | 
|---|---|---|
| committer | Petr Mrázek <peterix@gmail.com> | 2021-02-06 15:58:03 +0100 | 
| commit | 1868e0ccf1beba675736c1d2c47579854110241e (patch) | |
| tree | 125e38230b4708c2d0cf93ca52ab5caaf2be947f /api/logic/minecraft/World.h | |
| parent | f8ca96a335acc6d37a2d41e44c2104255bce5e30 (diff) | |
| download | PrismLauncher-1868e0ccf1beba675736c1d2c47579854110241e.tar.gz PrismLauncher-1868e0ccf1beba675736c1d2c47579854110241e.tar.bz2 PrismLauncher-1868e0ccf1beba675736c1d2c47579854110241e.zip  | |
GH-3229 fix copy seed button not working for newer worlds
Added the `optional-bare` library and refactored NBT reading
code to support this change.
Diffstat (limited to 'api/logic/minecraft/World.h')
| -rw-r--r-- | api/logic/minecraft/World.h | 26 | 
1 files changed, 18 insertions, 8 deletions
diff --git a/api/logic/minecraft/World.h b/api/logic/minecraft/World.h index d04c1040..ba7c357c 100644 --- a/api/logic/minecraft/World.h +++ b/api/logic/minecraft/World.h @@ -16,17 +16,27 @@  #pragma once  #include <QFileInfo>  #include <QDateTime> +#include <nonstd/optional>  #include "multimc_logic_export.h" -enum class GameType -{ -    Survival, -    Creative, -    Adventure, -    Spectator +struct MULTIMC_LOGIC_EXPORT GameType { +    GameType() = default; +    GameType (nonstd::optional<int> original); + +    QString toTranslatedString() const; +    QString toLogString() const; + +    enum +    { +        Unknown = -1, +        Survival = 0, +        Creative, +        Adventure, +        Spectator +    } type = Unknown; +    nonstd::optional<int> original;  }; -QString MULTIMC_LOGIC_EXPORT gameTypeToString(GameType type);  class MULTIMC_LOGIC_EXPORT World  { @@ -98,6 +108,6 @@ protected:      QDateTime levelDatTime;      QDateTime m_lastPlayed;      int64_t m_randomSeed = 0; -    GameType m_gameType = GameType::Survival; +    GameType m_gameType;      bool is_valid = false;  };  | 
