p2p.json can now be changed from config folder
This commit is contained in:
parent
011f8ba0b4
commit
6ce16849df
6 changed files with 83 additions and 19 deletions
|
|
@ -158,6 +158,10 @@ void MainProgram::set_tab_to_close(size_t tabToClose) {
|
|||
setTabToClose = tabToClose;
|
||||
}
|
||||
|
||||
void MainProgram::init_net_library() {
|
||||
NetLibrary::init(configPath / "p2p.json");
|
||||
}
|
||||
|
||||
void MainProgram::save_config() {
|
||||
std::ofstream f(configPath / "config.json");
|
||||
if(f.is_open()) {
|
||||
|
|
@ -227,6 +231,8 @@ void MainProgram::load_config() {
|
|||
toolbar.load_palettes();
|
||||
toolbar.load_theme();
|
||||
toolbar.load_licenses();
|
||||
|
||||
NetLibrary::copy_default_p2p_config_to_path(configPath / "p2p.json");
|
||||
}
|
||||
|
||||
void MainProgram::draw(SkCanvas* canvas) {
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ class MainProgram {
|
|||
void save_config();
|
||||
void load_config();
|
||||
|
||||
void init_net_library();
|
||||
|
||||
std::filesystem::path homePath;
|
||||
std::filesystem::path configPath;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ World::World(MainProgram& initMain, OpenWorldInfo& worldInfo):
|
|||
netSource = worldInfo.netSource;
|
||||
|
||||
if(worldInfo.conType == CONNECTIONTYPE_CLIENT || worldInfo.conType == CONNECTIONTYPE_SERVER)
|
||||
NetLibrary::init();
|
||||
main.init_net_library();
|
||||
|
||||
drawData.rMan = &rMan;
|
||||
drawData.main = &main;
|
||||
|
|
@ -254,7 +254,7 @@ void World::set_name(const std::string& n) {
|
|||
void World::start_hosting(const std::string& initNetSource, const std::string& serverLocalID) {
|
||||
if(conType != CONNECTIONTYPE_LOCAL)
|
||||
return;
|
||||
NetLibrary::init();
|
||||
main.init_net_library();
|
||||
con.init_local_p2p(*this, serverLocalID);
|
||||
drawProg.init_client_callbacks();
|
||||
rMan.init_client_callbacks();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue