mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-21 21:20:04 +00:00
Replace enabledpatches config option with patchmap.json
This should make it a lot easier to manage patch directories when we add support for each known client build.
This commit is contained in:
parent
23ab908366
commit
6537e38987
12
config.ini
12
config.ini
@ -1,3 +1,8 @@
|
|||||||
|
# name of the client build the server is targetting.
|
||||||
|
# used for determining which patches to apply.
|
||||||
|
# default is beta-20111013 for Academy, beta-20100104 otherwise.
|
||||||
|
#buildname=beta-20100104
|
||||||
|
|
||||||
# verbosity level
|
# verbosity level
|
||||||
# 0 = mostly silence
|
# 0 = mostly silence
|
||||||
# 1 = debug prints and unknown packets
|
# 1 = debug prints and unknown packets
|
||||||
@ -46,11 +51,6 @@ motd=Welcome to OpenFusion!
|
|||||||
# location of the patch folder
|
# location of the patch folder
|
||||||
#patchdir=tdata/patch/
|
#patchdir=tdata/patch/
|
||||||
|
|
||||||
# Space-separated list of patch folders in patchdir to load from.
|
|
||||||
# If you uncomment this, note that Academy builds *must* contain 1013,
|
|
||||||
# and pre-Academy builds must *not* contain it.
|
|
||||||
#enabledpatches=1013
|
|
||||||
|
|
||||||
# xdt json filename
|
# xdt json filename
|
||||||
#xdtdata=xdt.json
|
#xdtdata=xdt.json
|
||||||
# NPC json filename
|
# NPC json filename
|
||||||
@ -61,6 +61,8 @@ motd=Welcome to OpenFusion!
|
|||||||
#pathdata=paths.json
|
#pathdata=paths.json
|
||||||
# drop json filename
|
# drop json filename
|
||||||
#dropdata=drops.json
|
#dropdata=drops.json
|
||||||
|
# patchmap json filename
|
||||||
|
#patchmapdata=patchmap.json
|
||||||
# gruntwork output filename (this is what you submit)
|
# gruntwork output filename (this is what you submit)
|
||||||
#gruntwork=gruntwork.json
|
#gruntwork=gruntwork.json
|
||||||
# location of the database
|
# location of the database
|
||||||
|
@ -1086,6 +1086,26 @@ static void patchJSON(json* base, json* patch) {
|
|||||||
|
|
||||||
void TableData::init() {
|
void TableData::init() {
|
||||||
int32_t nextId = INT32_MAX; // next dynamic ID to hand out
|
int32_t nextId = INT32_MAX; // next dynamic ID to hand out
|
||||||
|
json patchmap;
|
||||||
|
|
||||||
|
// load patch map
|
||||||
|
{
|
||||||
|
std::fstream fstream;
|
||||||
|
fstream.open(settings::TDATADIR + "/" + settings::PATCHMAPJSON);
|
||||||
|
|
||||||
|
if (fstream.fail()) {
|
||||||
|
std::cerr << "[FATAL] Critical tdata file missing: " << settings::PATCHMAPJSON << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fstream.peek() == std::ifstream::traits_type::eof()) {
|
||||||
|
std::cerr << "[FATAL] Critical tdata file is empty: " << settings::PATCHMAPJSON << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fstream >> patchmap;
|
||||||
|
fstream.close();
|
||||||
|
}
|
||||||
|
|
||||||
// base JSON tables
|
// base JSON tables
|
||||||
json xdt, paths, drops, eggs, npcs, mobs, gruntwork;
|
json xdt, paths, drops, eggs, npcs, mobs, gruntwork;
|
||||||
@ -1134,15 +1154,13 @@ void TableData::init() {
|
|||||||
fstream >> *table.first;
|
fstream >> *table.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
// patching: load each patch directory specified in the config file
|
// patching: load each patch directory specified in patchmap.json
|
||||||
|
|
||||||
// split config field into individual patch entries
|
|
||||||
std::stringstream ss(settings::ENABLEDPATCHES);
|
|
||||||
std::istream_iterator<std::string> begin(ss);
|
|
||||||
std::istream_iterator<std::string> end;
|
|
||||||
|
|
||||||
|
// fetch list of patches that need to be applied for the current build
|
||||||
json patch;
|
json patch;
|
||||||
for (auto it = begin; it != end; it++) {
|
json patchlist = patchmap["patchmap"][settings::BUILDNAME];
|
||||||
|
|
||||||
|
for (auto it = patchlist.begin(); it != patchlist.end(); it++) {
|
||||||
// this is the theoretical path of a corresponding patch for this file
|
// this is the theoretical path of a corresponding patch for this file
|
||||||
std::string patchModuleName = *it;
|
std::string patchModuleName = *it;
|
||||||
std::string patchFile = settings::PATCHDIR + patchModuleName + "/" + table.second;
|
std::string patchFile = settings::PATCHDIR + patchModuleName + "/" + table.second;
|
||||||
|
@ -47,12 +47,13 @@ std::string settings::GRUNTWORKJSON = "gruntwork.json";
|
|||||||
std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
|
std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
|
||||||
std::string settings::DROPSJSON = "drops.json";
|
std::string settings::DROPSJSON = "drops.json";
|
||||||
std::string settings::PATHJSON = "paths.json";
|
std::string settings::PATHJSON = "paths.json";
|
||||||
|
std::string settings::PATCHMAPJSON = "patchmap.json";
|
||||||
#ifdef ACADEMY
|
#ifdef ACADEMY
|
||||||
std::string settings::XDTJSON = "xdt1013.json";
|
std::string settings::XDTJSON = "xdt1013.json";
|
||||||
std::string settings::ENABLEDPATCHES = "1013";
|
std::string settings::BUILDNAME = "beta-20111013";
|
||||||
#else
|
#else
|
||||||
std::string settings::XDTJSON = "xdt.json";
|
std::string settings::XDTJSON = "xdt.json";
|
||||||
std::string settings::ENABLEDPATCHES = "";
|
std::string settings::BUILDNAME = "beta-20100104";
|
||||||
#endif // ACADEMY
|
#endif // ACADEMY
|
||||||
|
|
||||||
int settings::ACCLEVEL = 1;
|
int settings::ACCLEVEL = 1;
|
||||||
@ -78,6 +79,7 @@ void settings::init() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BUILDNAME = reader.Get("", "buildname", BUILDNAME);
|
||||||
VERBOSITY = reader.GetInteger("", "verbosity", VERBOSITY);
|
VERBOSITY = reader.GetInteger("", "verbosity", VERBOSITY);
|
||||||
SANDBOX = reader.GetBoolean("", "sandbox", SANDBOX);
|
SANDBOX = reader.GetBoolean("", "sandbox", SANDBOX);
|
||||||
LOGINPORT = reader.GetInteger("login", "port", LOGINPORT);
|
LOGINPORT = reader.GetInteger("login", "port", LOGINPORT);
|
||||||
@ -105,7 +107,7 @@ void settings::init() {
|
|||||||
DBPATH = reader.Get("shard", "dbpath", DBPATH);
|
DBPATH = reader.Get("shard", "dbpath", DBPATH);
|
||||||
TDATADIR = reader.Get("shard", "tdatadir", TDATADIR);
|
TDATADIR = reader.Get("shard", "tdatadir", TDATADIR);
|
||||||
PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR);
|
PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR);
|
||||||
ENABLEDPATCHES = reader.Get("shard", "enabledpatches", ENABLEDPATCHES);
|
PATCHMAPJSON = reader.Get("shard", "patchmapdata", PATCHMAPJSON);
|
||||||
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
||||||
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
||||||
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
|
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
|
||||||
|
@ -29,7 +29,8 @@ namespace settings {
|
|||||||
extern std::string GRUNTWORKJSON;
|
extern std::string GRUNTWORKJSON;
|
||||||
extern std::string DBPATH;
|
extern std::string DBPATH;
|
||||||
extern std::string PATCHDIR;
|
extern std::string PATCHDIR;
|
||||||
extern std::string ENABLEDPATCHES;
|
extern std::string PATCHMAPJSON;
|
||||||
|
extern std::string BUILDNAME;
|
||||||
extern std::string TDATADIR;
|
extern std::string TDATADIR;
|
||||||
extern int EVENTMODE;
|
extern int EVENTMODE;
|
||||||
extern bool MONITORENABLED;
|
extern bool MONITORENABLED;
|
||||||
|
Loading…
Reference in New Issue
Block a user