From 59303ba30def1273d64d1cfd5b33feefabe8f054 Mon Sep 17 00:00:00 2001 From: gsemaj Date: Sat, 1 May 2021 20:49:54 -0400 Subject: [PATCH] Update tdata to patch format, change config constants accordingly --- config.ini | 31 +++++++++++++++++-------------- src/TableData.cpp | 4 ++-- src/settings.cpp | 29 ++++++++++++++++++----------- src/settings.hpp | 3 ++- tdata | 2 +- 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/config.ini b/config.ini index ae60078..7802b24 100644 --- a/config.ini +++ b/config.ini @@ -35,22 +35,25 @@ motd=Welcome to OpenFusion! # requires to run. You can override them by changing their values and # uncommenting them (removing the leading # character from that line). -# xdt json data -#xdtdata=tdata/xdt.json -# NPC json data -#npcdata=tdata/NPCs.json -# mob json -#mobdata=tdata/mobs.json -# path json -#pathdata=tdata/paths.json -# drop json -#dropdata=tdata/drops.json -# gruntwork output (this is what you submit) -#gruntwork=tdata/gruntwork.json +# location of the tabledata folder +#tdatadir=tdata/ +# location of the patch folder +#patchdir=tdata/patch/ + +# xdt json filename +#xdtdata=xdt.json +# NPC json filename +#npcdata=NPCs.json +# mob json filename +#mobdata=mobs.json +# path json filename +#pathdata=paths.json +# drop json filename +#dropdata=drops.json +# gruntwork output filename (this is what you submit) +#gruntwork=gruntwork.json # location of the database #dbpath=database.db -# location of the patch folder -#patchpath=tdata/patch # should tutorial flags be disabled off the bat? disablefirstuseflag=true diff --git a/src/TableData.cpp b/src/TableData.cpp index 107cd5d..3c958d0 100644 --- a/src/TableData.cpp +++ b/src/TableData.cpp @@ -998,12 +998,12 @@ void TableData::init() { std::ifstream fstream; for (int i = 0; i < 7; i++) { std::pair& table = tables[i]; - fstream.open(table.second); // open file + fstream.open(settings::TDATADIR + table.second); // open file if (!fstream.fail()) { fstream >> *table.first; // load file contents into table } else { if (i != 6) { // gruntwork isn't critical - std::cerr << "[FATAL] Critical tdata file missing: " << table.second << std::endl; + std::cerr << "[FATAL] Critical tdata file missing: " << settings::TDATADIR << table.second << std::endl; exit(1); } } diff --git a/src/settings.cpp b/src/settings.cpp index 48a0aef..c85aeb1 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -30,18 +30,24 @@ int settings::SPAWN_X = 19835; int settings::SPAWN_Y = 108682; int settings::SPAWN_Z = 8450; #endif - int settings::SPAWN_ANGLE = 130; -std::string settings::NPCJSON = "tdata/NPCs.json"; -std::string settings::MOBJSON = "tdata/mobs.json"; -std::string settings::EGGSJSON = "tdata/eggs.json"; -std::string settings::GRUNTWORKJSON = "tdata/gruntwork.json"; -std::string settings::MOTDSTRING = "Welcome to OpenFusion!"; + std::string settings::DBPATH = "database.db"; -std::string settings::PATCHPATH = "tdata/patch"; -std::string settings::DROPSJSON = "tdata/drops.json"; -std::string settings::XDTJSON = "tdata/xdt.json"; -std::string settings::PATHJSON = "tdata/paths.json"; +std::string settings::TDATADIR = "tdata/"; +std::string settings::PATCHDIR = "tdata/patch/"; + +std::string settings::NPCJSON = "NPCs.json"; +std::string settings::MOBJSON = "mobs.json"; +std::string settings::EGGSJSON = "eggs.json"; +std::string settings::GRUNTWORKJSON = "gruntwork.json"; +std::string settings::MOTDSTRING = "Welcome to OpenFusion!"; +std::string settings::DROPSJSON = "drops.json"; +std::string settings::PATHJSON = "paths.json"; +#ifdef ACADEMY +std::string settings::XDTJSON = "xdt1013.json"; +#else +std::string settings::XDTJSON = "xdt.json"; +#endif // ACADEMY int settings::ACCLEVEL = 1; bool settings::DISABLEFIRSTUSEFLAG = true; @@ -88,7 +94,8 @@ void settings::init() { GRUNTWORKJSON = reader.Get("shard", "gruntwork", GRUNTWORKJSON); MOTDSTRING = reader.Get("shard", "motd", MOTDSTRING); DBPATH = reader.Get("shard", "dbpath", DBPATH); - PATCHPATH = reader.Get("shard", "patchpath", PATCHPATH); + TDATADIR = reader.Get("shard", "tdatadir", TDATADIR); + PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR); ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL); EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE); DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG); diff --git a/src/settings.hpp b/src/settings.hpp index 5826578..ee07ec5 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -24,7 +24,8 @@ namespace settings { extern std::string EGGSJSON; extern std::string GRUNTWORKJSON; extern std::string DBPATH; - extern std::string PATCHPATH; + extern std::string PATCHDIR; + extern std::string TDATADIR; extern int EVENTMODE; extern bool MONITORENABLED; extern int MONITORPORT; diff --git a/tdata b/tdata index 77e394c..5b54c48 160000 --- a/tdata +++ b/tdata @@ -1 +1 @@ -Subproject commit 77e394c7ba8749af4907bdca222484c7595c0d8e +Subproject commit 5b54c48bc4b873ef3ff28f0a7f383fd44e698660