diff options
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/content.cpp | 3 | ||||
-rw-r--r-- | src/content/content.h | 2 | ||||
-rw-r--r-- | src/content/mods.cpp | 3 | ||||
-rw-r--r-- | src/content/mods.h | 1 | ||||
-rw-r--r-- | src/content/packages.cpp | 1 | ||||
-rw-r--r-- | src/content/packages.h | 4 | ||||
-rw-r--r-- | src/content/subgames.cpp | 6 | ||||
-rw-r--r-- | src/content/subgames.h | 5 |
8 files changed, 21 insertions, 4 deletions
diff --git a/src/content/content.cpp b/src/content/content.cpp index d45c5feab..d7a2c9652 100644 --- a/src/content/content.cpp +++ b/src/content/content.cpp @@ -98,6 +98,9 @@ void parseContentInfo(ContentSpec &spec) if (conf.exists("author")) spec.author = conf.get("author"); + + if (conf.exists("release")) + spec.release = conf.getS32("release"); } if (spec.desc.empty()) { diff --git a/src/content/content.h b/src/content/content.h index 782a4fd7a..e246ed411 100644 --- a/src/content/content.h +++ b/src/content/content.h @@ -20,11 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "config.h" #include "convert_json.h" +#include "irrlichttypes.h" struct ContentSpec { std::string type; std::string author; + u32 release = 0; std::string name; std::string desc; std::string path; diff --git a/src/content/mods.cpp b/src/content/mods.cpp index 694bbcca8..a3e706760 100644 --- a/src/content/mods.cpp +++ b/src/content/mods.cpp @@ -56,6 +56,9 @@ void parseModContents(ModSpec &spec) if (info.exists("author")) spec.author = info.get("author"); + if (info.exists("release")) + spec.release = info.getS32("release"); + spec.depends.clear(); spec.optdepends.clear(); spec.is_modpack = false; diff --git a/src/content/mods.h b/src/content/mods.h index a7cad07cf..6e2506dbf 100644 --- a/src/content/mods.h +++ b/src/content/mods.h @@ -39,6 +39,7 @@ struct ModSpec std::string author; std::string path; std::string desc; + int release = 0; // if normal mod: std::unordered_set<std::string> depends; diff --git a/src/content/packages.cpp b/src/content/packages.cpp index a769c31af..d50e63a6b 100644 --- a/src/content/packages.cpp +++ b/src/content/packages.cpp @@ -49,6 +49,7 @@ std::vector<Package> getPackagesFromURL(const std::string &url) package.type = json[i]["type"].asString(); package.shortDesc = json[i]["shortDesc"].asString(); package.url = json[i]["url"].asString(); + package.release = json[i]["release"].asInt(); Json::Value jScreenshots = json[i]["screenshots"]; for (unsigned int j = 0; j < jScreenshots.size(); ++j) { diff --git a/src/content/packages.h b/src/content/packages.h index 6774678de..2290bd607 100644 --- a/src/content/packages.h +++ b/src/content/packages.h @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "config.h" #include "convert_json.h" +#include "irrlichttypes.h" struct Package { @@ -30,12 +31,13 @@ struct Package std::string shortDesc; std::string url; // download URL + u32 release; std::vector<std::string> screenshots; bool valid() { return !(name.empty() || title.empty() || author.empty() || - type.empty() || url.empty()); + type.empty() || url.empty() || release <= 0); } }; diff --git a/src/content/subgames.cpp b/src/content/subgames.cpp index fd6231a1f..9f05b751d 100644 --- a/src/content/subgames.cpp +++ b/src/content/subgames.cpp @@ -116,13 +116,17 @@ SubgameSpec findSubgame(const std::string &id) if (conf.exists("author")) game_author = conf.get("author"); + int game_release = 0; + if (conf.exists("release")) + game_release = conf.getS32("release"); + std::string menuicon_path; #ifndef SERVER menuicon_path = getImagePath( game_path + DIR_DELIM + "menu" + DIR_DELIM + "icon.png"); #endif return SubgameSpec(id, game_path, gamemod_path, mods_paths, game_name, - menuicon_path, game_author); + menuicon_path, game_author, game_release); } SubgameSpec findWorldSubgame(const std::string &world_path) diff --git a/src/content/subgames.h b/src/content/subgames.h index 70a9d2713..4198ea860 100644 --- a/src/content/subgames.h +++ b/src/content/subgames.h @@ -30,6 +30,7 @@ struct SubgameSpec std::string id; std::string name; std::string author; + int release; std::string path; std::string gamemods_path; std::set<std::string> addon_mods_paths; @@ -41,9 +42,9 @@ struct SubgameSpec std::set<std::string>(), const std::string &name = "", const std::string &menuicon_path = "", - const std::string &author = "") : + const std::string &author = "", int release = 0) : id(id), - name(name), author(author), path(path), + name(name), author(author), release(release), path(path), gamemods_path(gamemods_path), addon_mods_paths(addon_mods_paths), menuicon_path(menuicon_path) { |