diff --git a/server/gameserver/jsondatamgr.cc b/server/gameserver/jsondatamgr.cc index ccd4abd..4e81bcc 100644 --- a/server/gameserver/jsondatamgr.cc +++ b/server/gameserver/jsondatamgr.cc @@ -47,10 +47,13 @@ void JsonDataMgr::UnInit() std::shared_ptr JsonDataMgr::GetConf() { - if (App::Instance()->instance_id < 1 || App::Instance()->instance_id > gameserver_cluster_json_.Size()) { - abort(); + for (int i = 0; i < gameserver_cluster_json_.Size(); ++i) { + std::shared_ptr conf = gameserver_cluster_json_.At(i); + if (conf->At("instance_id")->AsXValue().GetInt() == App::Instance()->instance_id) { + return conf; + } } - return gameserver_cluster_json_[App::Instance()->instance_id - 1]; + abort(); } std::shared_ptr JsonDataMgr::GetMasterServerClusterConf()