添加分服处理

This commit is contained in:
aozhiwei 2020-08-14 21:54:41 +08:00
parent 6df7d2d5fb
commit afbecc0c95
4 changed files with 11 additions and 3 deletions

View File

@ -143,11 +143,12 @@ bool App::Init(int argc, char* argv[])
PlayerMgr::Instance()->Init();
GGListener::Instance()->Init();
a8::UdpLog::Instance()->Info("gameserver starting instance_id:%d pid:%d debug_mode:%d",
a8::UdpLog::Instance()->Info("gameserver starting instance_id:%d pid:%d debug_mode:%d channel:%d",
{
instance_id,
getpid(),
debug_mode
debug_mode,
JsonDataMgr::Instance()->channel
});
{
int perf_log_time = 1000 * 30;

View File

@ -34,6 +34,9 @@ void JsonDataMgr::Init()
gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file);
ip = GetConf()->At("ip")->AsXValue().GetString();
listen_port = GetConf()->At("listen_port")->AsXValue();
if (GetConf()->HasKey("channel")) {
channel = GetConf()->At("channel")->AsXValue();
}
server_info = a8::Format("%s:%d", {ip, listen_port});
Reload();
}

View File

@ -15,7 +15,7 @@ public:
std::string ip;
int listen_port = 0;
int channel = 0;
std::string server_info;
void Reload();

View File

@ -7,6 +7,7 @@
#include "metamgr.h"
#include "app.h"
#include "jsondatamgr.h"
#define METAMGR_READ(field_name, def_val) MetaMgr::Instance()->field_name = \
a8::XValue(MetaMgr::Instance()->GetSysParamAsString(#field_name, #def_val));
@ -111,6 +112,9 @@ public:
} else {
res_path = "../res/";
}
if (JsonDataMgr::Instance()->channel != 0) {
res_path = a8::Format("%s%d", {res_path, JsonDataMgr::Instance()->channel});
}
f8::ReadCsvMetaFile(res_path + "parameter@parameter.csv", parameter_meta_list);
f8::ReadCsvMetaFile(res_path + "map@map.csv", map_meta_list);