Changeset View
Changeset View
Standalone View
Standalone View
source/ps/Mod.h
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 15 Lines | |||||
class ScriptContext; | class ScriptContext; | ||||
extern std::vector<CStr> g_modsLoaded; | extern std::vector<CStr> g_modsLoaded; | ||||
extern CmdLineArgs g_args; | extern CmdLineArgs g_args; | ||||
namespace Mod | namespace Mod | ||||
{ | { | ||||
JS::Value GetAvailableMods(const ScriptInterface& scriptInterface); | JS::Value GetAvailableMods(const ScriptInterface& scriptInterface); | ||||
const std::vector<CStr>& GetEnabledMods(); | |||||
const std::vector<CStr>& GetIncompatibleMods(); | |||||
const std::vector<CStr>& GetFailedMods(); | |||||
vladislavbelov: const reference if not plans to change the list. | |||||
Done Inline Actionsi dont think you can, it is not class function Silier: i dont think you can, it is not class function | |||||
Not Done Inline ActionsDo you know how references work in C++? vladislavbelov: Do you know how references work in C++? | |||||
/** | /** | ||||
* This reads the version numbers from the launched mods. | * This reads the version numbers from the launched mods. | ||||
* It caches the result, since the reading of zip files is slow and | * It caches the result, since the reading of zip files is slow and | ||||
* JS pages can request the version numbers too often easily. | * JS pages can request the version numbers too often easily. | ||||
* Make sure this is called after each MountMods call. | * Make sure this is called after each MountMods call. | ||||
*/ | */ | ||||
void CacheEnabledModVersions(const shared_ptr<ScriptContext>& scriptContext); | void CacheEnabledModVersions(const shared_ptr<ScriptContext>& scriptContext); | ||||
const std::vector<CStr>& GetModsFromArguments(const CmdLineArgs& args, int flags); | |||||
bool AreModsCompatible(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods, const JS::RootedValue& availableMods); | |||||
bool CheckAndEnableMods(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods); | |||||
bool CompareVersionStrings(const CStr& required, const CStr& op, const CStr& version); | |||||
void SetDefaultMods(const CmdLineArgs& args, int flags); | |||||
void ClearIncompatibleMods(); | |||||
/** | /** | ||||
* Get the loaded mods and their version. | * Get the loaded mods and their version. | ||||
* "user" mod and "mod" mod are ignored as they are irrelevant for compatibility checks. | * "user" mod and "mod" mod are ignored as they are irrelevant for compatibility checks. | ||||
* | * | ||||
* @param scriptInterface the ScriptInterface in which to create the return data. | * @param scriptInterface the ScriptInterface in which to create the return data. | ||||
* @return list of loaded mods with the format [[modA, versionA], [modB, versionB], ...] | * @return list of loaded mods with the format [[modA, versionA], [modB, versionB], ...] | ||||
*/ | */ | ||||
JS::Value GetLoadedModsWithVersions(const ScriptInterface& scriptInterface); | JS::Value GetLoadedModsWithVersions(const ScriptInterface& scriptInterface); | ||||
Show All 10 Lines |
Wildfire Games · Phabricator
const reference if not plans to change the list.