mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Add updating to online content browser
This commit is contained in:
parent
45e48295d2
commit
3eb363f813
11 changed files with 196 additions and 107 deletions
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue