Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3422342d28 | ||
![]() |
0bbfd36c3d | ||
![]() |
d66d386270 | ||
![]() |
3723810667 |
@ -151,6 +151,6 @@ long long GGListener::GetSentBytesNum()
|
||||
void GGListener::OnListenError(int errorid)
|
||||
{
|
||||
a8::XPrintf("GGListeneron_error %d\n", {errorid});
|
||||
App::Instance()->Terminate();
|
||||
f8::App::Instance()->Terminate();
|
||||
exit(1);
|
||||
}
|
||||
|
@ -123,8 +123,9 @@ static void SavePerfLog()
|
||||
f8::HttpClientPool::Instance()->max_user_request_delay = 0;
|
||||
}
|
||||
|
||||
bool App::Init(int argc, char* argv[])
|
||||
void App::Init()
|
||||
{
|
||||
#if 0
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
this->argc_ = argc;
|
||||
this->argv_ = argv;
|
||||
@ -227,6 +228,7 @@ bool App::Init(int argc, char* argv[])
|
||||
);
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void App::UnInit()
|
||||
@ -267,6 +269,7 @@ void App::UnInit()
|
||||
int App::Run()
|
||||
{
|
||||
int ret = 0;
|
||||
#if 0
|
||||
f8::UdpLog::Instance()->Info("gameserver running", {});
|
||||
last_run_tick_ = a8::XGetTickCount();
|
||||
int delta_time = 0;
|
||||
@ -282,6 +285,7 @@ int App::Run()
|
||||
}
|
||||
delta_time = end_tick - begin_tick;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -423,25 +427,25 @@ void App::ProcessGameGateMsg(f8::MsgHdr& hdr)
|
||||
if (handler) {
|
||||
switch (handler->handlerid) {
|
||||
case HID_RoomMgr:
|
||||
ProcessNetMsg(handler, RoomMgr::Instance(), hdr);
|
||||
ProcessNetMsg(handler, RoomMgr::Instance(), &hdr);
|
||||
break;
|
||||
case HID_MatchTeam:
|
||||
{
|
||||
auto match_info = MatchMgr::Instance()->GetMatchInfo(hdr.socket_handle);
|
||||
if (match_info) {
|
||||
ProcessNetMsg(handler, std::get<1>(*match_info).get(), hdr);
|
||||
ProcessNetMsg(handler, std::get<1>(*match_info).get(), &hdr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HID_PlayerMgr:
|
||||
ProcessNetMsg(handler, PlayerMgr::Instance(), hdr);
|
||||
ProcessNetMsg(handler, PlayerMgr::Instance(), &hdr);
|
||||
break;
|
||||
case HID_Player:
|
||||
{
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr.socket_handle);
|
||||
if (hum) {
|
||||
hdr.hum = hum;
|
||||
ProcessNetMsg(handler, hum, hdr);
|
||||
ProcessNetMsg(handler, hum, &hdr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -473,67 +477,6 @@ void App::UnInitLog()
|
||||
f8::UdpLog::Instance()->UnInit();
|
||||
}
|
||||
|
||||
bool App::ParseOpt()
|
||||
{
|
||||
int ch = 0;
|
||||
while ((ch = getopt(argc_, argv_, "z:i:t:r:f:n:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'z':
|
||||
{
|
||||
zone_id_ = a8::XValue(optarg);
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
{
|
||||
node_id_ = a8::XValue(optarg);
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
{
|
||||
instance_id_ = a8::XValue(optarg);
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
{
|
||||
is_test_mode_ = true;
|
||||
test_param_ = a8::XValue(optarg);
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(optarg, strings, ',');
|
||||
for (auto& str : strings) {
|
||||
flags.insert(a8::XValue(str).GetInt());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return zone_id_ > 0 && instance_id_ > 0 && node_id_ > 0;
|
||||
}
|
||||
|
||||
std::string App::NewUuid()
|
||||
{
|
||||
std::string id = a8::Format("%d%d", {100 + zone_id_, uuid_.Generate()});
|
||||
return id;
|
||||
}
|
||||
|
||||
bool App::HasFlag(int flag)
|
||||
{
|
||||
return flags.find(flag) != flags.end();
|
||||
}
|
||||
|
||||
void App::SetFlag(int flag)
|
||||
{
|
||||
flags.insert(flag);
|
||||
}
|
||||
|
||||
void App::UnSetFlag(int flag)
|
||||
{
|
||||
flags.erase(flag);
|
||||
}
|
||||
|
||||
void App::FreeSocketMsgQueue()
|
||||
{
|
||||
msg_mutex_->lock();
|
||||
@ -581,3 +524,18 @@ long long App::AllocTempWeaponUniId()
|
||||
++curr_uniid_;
|
||||
return -curr_uniid_;
|
||||
}
|
||||
|
||||
const std::string App::GetPkgName()
|
||||
{
|
||||
return a8::Format("gameserver2006", {});
|
||||
}
|
||||
|
||||
void App::Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void App::DispatchSocketMsg(f8::MsgHdr* hdr)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -4,9 +4,10 @@
|
||||
#include <a8/singleton.h>
|
||||
|
||||
#include <f8/protoutils.h>
|
||||
#include <f8/app.h>
|
||||
|
||||
struct MsgNode;
|
||||
class App : public a8::Singleton<App>
|
||||
class App : public f8::UserApp, public a8::Singleton<App>
|
||||
{
|
||||
private:
|
||||
App() {};
|
||||
@ -17,8 +18,12 @@ public:
|
||||
std::map<int, int> debug_params;
|
||||
#endif
|
||||
|
||||
bool Init(int argc, char* argv[]);
|
||||
void UnInit();
|
||||
virtual const std::string GetPkgName() override;
|
||||
virtual void Init() override;
|
||||
virtual void UnInit() override;
|
||||
virtual void Update() override;
|
||||
virtual bool HasTask() override;
|
||||
virtual void DispatchSocketMsg(f8::MsgHdr* hdr) override;
|
||||
|
||||
int Run();
|
||||
|
||||
@ -32,18 +37,8 @@ public:
|
||||
|
||||
void NotifyLoopCond();
|
||||
|
||||
std::string NewUuid();
|
||||
bool HasFlag(int flag);
|
||||
void SetFlag(int flag);
|
||||
void UnSetFlag(int flag);
|
||||
long long AllocTempHeroUniId();
|
||||
long long AllocTempWeaponUniId();
|
||||
void Terminate() { terminated_ = true; }
|
||||
int GetInstanceId() const { return instance_id_; }
|
||||
int GetZoneId() const { return zone_id_; }
|
||||
int GetNodeId() const { return node_id_; }
|
||||
bool IsTestMode() const { return is_test_mode_; }
|
||||
int GetTestParam() const { return test_param_; }
|
||||
bool IsServicing() const { return servicing_; }
|
||||
void SetServicing(bool open) { servicing_ = open; }
|
||||
|
||||
@ -51,7 +46,6 @@ private:
|
||||
void QuickExecute(int delta_time);
|
||||
void SlowerExecute(int delta_time);
|
||||
void Schedule();
|
||||
bool HasTask();
|
||||
|
||||
void DispatchMsg();
|
||||
|
||||
@ -60,32 +54,9 @@ private:
|
||||
void InitLog();
|
||||
void UnInitLog();
|
||||
|
||||
bool ParseOpt();
|
||||
void FreeSocketMsgQueue();
|
||||
|
||||
private:
|
||||
/*
|
||||
1: 是否自动匹配机器人组队
|
||||
2: 是否发布环境
|
||||
3: battleReport环境
|
||||
4: 打印性能日志
|
||||
5: 压力测试
|
||||
6:
|
||||
7: 内存泄露测试
|
||||
8: httpclientpool压力测试
|
||||
*/
|
||||
std::set<int> flags;
|
||||
|
||||
private:
|
||||
int argc_ = 0;
|
||||
char** argv_ = nullptr;
|
||||
|
||||
volatile bool terminated_ = false;
|
||||
int zone_id_ = 0;
|
||||
int instance_id_ = 0;
|
||||
int node_id_ = 0;
|
||||
bool is_test_mode_ = false;
|
||||
int test_param_ = 0;
|
||||
bool servicing_ = true;
|
||||
|
||||
a8::uuid::SnowFlake uuid_;
|
||||
|
@ -64,16 +64,6 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
||||
room->grid_service->MoveCreature(this);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "setmode") {
|
||||
if (cmds.empty()) {
|
||||
App::Instance()->UnSetFlag(20);
|
||||
} else {
|
||||
if (cmds[1] == "peace") {
|
||||
App::Instance()->SetFlag(20);
|
||||
} else {
|
||||
App::Instance()->UnSetFlag(20);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "additem" && cmds.size() >= 3) {
|
||||
int item_id = a8::XValue(cmds[1]);
|
||||
int item_num = a8::XValue(cmds[2]);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
bool DebugCmd::Enable()
|
||||
{
|
||||
return App::Instance()->GetInstanceId() == 6;
|
||||
return f8::App::Instance()->GetInstanceId() == 6;
|
||||
}
|
||||
|
||||
void DebugCmd::CreateSphere(Creature* c,
|
||||
|
@ -208,7 +208,7 @@ void FrameMaker::SerializeNewObjects(cs::SMUpdate* msg, Room* room, Human* hum,
|
||||
a8::XPrintf("add full object can_see:%d sync:%d type:%d\n", {e->CanSeeMe(hum), sync, hum->IsPlayer()});
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
if (App::Instance()->HasFlag(2) && e->GetEntityType() == ET_Player) {
|
||||
if (f8::App::Instance()->HasFlag(2) && e->GetEntityType() == ET_Player) {
|
||||
hum->room->BroadcastDebugMsg(a8::Format("投放 %d pos:%d,%d 出现",
|
||||
{
|
||||
e->GetUniId(),
|
||||
@ -279,7 +279,7 @@ void FrameMaker::SerializeDelObjects(cs::SMUpdate* msg, Room* room, Human* hum,
|
||||
for (auto& itr : framedata->del_objects) {
|
||||
msg->add_del_objids(itr);
|
||||
#ifdef DEBUG
|
||||
if (App::Instance()->HasFlag(2)) {
|
||||
if (f8::App::Instance()->HasFlag(2)) {
|
||||
room->BroadcastDebugMsg(a8::Format("投放 删除对象%d",
|
||||
{
|
||||
itr
|
||||
@ -300,7 +300,7 @@ void FrameMaker::SerializeOutObjects(cs::SMUpdate* msg, Room* room, Human* hum,
|
||||
for (auto& itr : framedata->out_objects) {
|
||||
msg->add_out_objids(itr);
|
||||
#ifdef DEBUG
|
||||
if (App::Instance()->HasFlag(2)) {
|
||||
if (f8::App::Instance()->HasFlag(2)) {
|
||||
room->BroadcastDebugMsg(a8::Format("投放 移除视野对象%d",
|
||||
{
|
||||
itr
|
||||
|
@ -35,8 +35,8 @@ void GameLog::GameStart(Player* hum)
|
||||
//prop->SetVal("localuuid", "");
|
||||
//prop->SetVal("start_param", "");
|
||||
prop->SetVal("team_id", hum->team_id);
|
||||
prop->SetVal("server_node_id", App::Instance()->GetNodeId());
|
||||
prop->SetVal("server_instance_id", App::Instance()->GetInstanceId());
|
||||
prop->SetVal("server_node_id", f8::App::Instance()->GetNodeId());
|
||||
prop->SetVal("server_instance_id", f8::App::Instance()->GetInstanceId());
|
||||
|
||||
prop->SetVal("map_id", hum->room->GetMapMeta()->map_id());
|
||||
prop->SetVal("map_name", hum->room->GetMapMeta()->map_name());
|
||||
@ -75,8 +75,8 @@ void GameLog::GameEnd(Player* hum)
|
||||
prop->SetVal("game_time", a8::XGetTickCount() - hum->create_tick);
|
||||
//prop->SetVal("start_param", "");
|
||||
prop->SetVal("team_id", hum->team_id);
|
||||
prop->SetVal("server_node_id", App::Instance()->GetNodeId());
|
||||
prop->SetVal("server_instance_id", App::Instance()->GetInstanceId());
|
||||
prop->SetVal("server_node_id", f8::App::Instance()->GetNodeId());
|
||||
prop->SetVal("server_instance_id", f8::App::Instance()->GetInstanceId());
|
||||
|
||||
prop->SetVal("map_id", hum->room->GetMapMeta()->map_id());
|
||||
prop->SetVal("map_name", hum->room->GetMapMeta()->map_name());
|
||||
@ -103,8 +103,8 @@ void GameLog::ForceOver(Room* room)
|
||||
prop->SetVal("battle_started", a8::XValue(room->BattleStarted() ? 1 : 0));
|
||||
prop->SetVal("game_duration", room->GetFrameNo() * SERVER_FRAME_RATE);
|
||||
prop->SetVal("player_num", room->GetRealPlayerNum());
|
||||
prop->SetVal("server_node_id", App::Instance()->GetNodeId());
|
||||
prop->SetVal("server_instance_id", App::Instance()->GetInstanceId());
|
||||
prop->SetVal("server_node_id", f8::App::Instance()->GetNodeId());
|
||||
prop->SetVal("server_instance_id", f8::App::Instance()->GetInstanceId());
|
||||
|
||||
f8::TGLog::Instance()->AddTrackLog(game_id, "forceover", 0, "forceover", prop.get());
|
||||
}
|
||||
|
@ -22,50 +22,49 @@
|
||||
|
||||
static void _GMOpsSelfChecking(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
{
|
||||
request->resp_xobj->SetVal("errcode", 0);
|
||||
request->resp_xobj->SetVal("errmsg", "");
|
||||
request->resp_xobj->SetVal("healthy", 1);
|
||||
request->resp_xobj->SetVal("servicing", App::Instance()->IsServicing() ? 1 : 0);
|
||||
request->resp_xobj->SetVal("max_rundelay", PerfMonitor::Instance()->max_run_delay_time);
|
||||
request->resp_xobj->SetVal("max_timer_idle", PerfMonitor::Instance()->max_timer_idle);
|
||||
request->GetResp()->SetVal("errcode", 0);
|
||||
request->GetResp()->SetVal("errmsg", "");
|
||||
request->GetResp()->SetVal("healthy", 1);
|
||||
request->GetResp()->SetVal("servicing", App::Instance()->IsServicing() ? 1 : 0);
|
||||
request->GetResp()->SetVal("max_rundelay", PerfMonitor::Instance()->max_run_delay_time);
|
||||
request->GetResp()->SetVal("max_timer_idle", PerfMonitor::Instance()->max_timer_idle);
|
||||
}
|
||||
|
||||
static void _GMOpsStopService(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
{
|
||||
request->resp_xobj->SetVal("errcode", 0);
|
||||
request->resp_xobj->SetVal("errmsg", "");
|
||||
request->GetResp()->SetVal("errcode", 0);
|
||||
request->GetResp()->SetVal("errmsg", "");
|
||||
App::Instance()->SetServicing(false);
|
||||
}
|
||||
|
||||
static void _GMOpsStartService(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
{
|
||||
request->resp_xobj->SetVal("errcode", 0);
|
||||
request->resp_xobj->SetVal("errmsg", "");
|
||||
request->GetResp()->SetVal("errcode", 0);
|
||||
request->GetResp()->SetVal("errmsg", "");
|
||||
App::Instance()->SetServicing(true);
|
||||
}
|
||||
|
||||
static void _GMOpsServerInfo(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
{
|
||||
request->resp_xobj->SetVal("errcode", 0);
|
||||
request->resp_xobj->SetVal("errmsg", "");
|
||||
request->resp_xobj->SetVal("node_id", App::Instance()->GetNodeId());
|
||||
request->resp_xobj->SetVal("instance_id", App::Instance()->GetInstanceId());
|
||||
request->GetResp()->SetVal("errcode", 0);
|
||||
request->GetResp()->SetVal("errmsg", "");
|
||||
request->GetResp()->SetVal("node_id", f8::App::Instance()->GetNodeId());
|
||||
request->GetResp()->SetVal("instance_id", f8::App::Instance()->GetInstanceId());
|
||||
}
|
||||
|
||||
static void _GMOpsTerminate(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
{
|
||||
request->resp_xobj->SetVal("errcode", 0);
|
||||
request->resp_xobj->SetVal("errmsg", "");
|
||||
App::Instance()->Terminate();
|
||||
request->GetResp()->SetVal("errcode", 0);
|
||||
request->GetResp()->SetVal("errmsg", "");
|
||||
f8::App::Instance()->Terminate();
|
||||
}
|
||||
|
||||
|
||||
static void _GMStatGetRealTimeOnline(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
{
|
||||
request->resp_xobj->SetVal("errcode", 0);
|
||||
request->resp_xobj->SetVal("errmsg", "");
|
||||
request->resp_xobj->SetVal("num", PerfMonitor::Instance()->entity_num[ET_Player]);
|
||||
request->resp_xobj->SetVal("room_num", RoomMgr::Instance()->RoomNum());
|
||||
request->GetResp()->SetVal("errcode", 0);
|
||||
request->GetResp()->SetVal("errmsg", "");
|
||||
request->GetResp()->SetVal("num", PerfMonitor::Instance()->entity_num[ET_Player]);
|
||||
request->GetResp()->SetVal("room_num", RoomMgr::Instance()->RoomNum());
|
||||
}
|
||||
|
||||
void HandlerMgr::Init()
|
||||
@ -103,6 +102,7 @@ void HandlerMgr::UnInit()
|
||||
|
||||
void HandlerMgr::RegisterNetMsgHandlers()
|
||||
{
|
||||
#if 0
|
||||
RegisterNetMsgHandler(&ggmsghandler, &PlayerMgr::_SS_WSP_SocketDisconnect);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &PlayerMgr::_SS_Ping);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &RoomMgr::_CMJoin);
|
||||
@ -132,6 +132,7 @@ void HandlerMgr::RegisterNetMsgHandlers()
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMTeamMarkTargetPos);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMSetRevivePosition);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMGetSettlementTeamList);
|
||||
#endif
|
||||
}
|
||||
|
||||
void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
||||
@ -148,20 +149,22 @@ void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
||||
std::string msgname = a8::Get(request, "c").GetString() + "@" + a8::Get(request, "a").GetString();
|
||||
auto itr = gmhandlers_.find(msgname);
|
||||
if (itr != gmhandlers_.end()) {
|
||||
#if 0
|
||||
auto request = std::make_shared<f8::JsonHttpRequest>();
|
||||
request->saddr = saddr;
|
||||
request->socket_handle = sockhandle;
|
||||
request->query_str = querystr;
|
||||
request->params->ReadFromUrlQueryString(querystr);
|
||||
request->resp_xobj->SetVal("errcode", 0);
|
||||
request->resp_xobj->SetVal("errmsg", "");
|
||||
request->GetResp()->SetVal("errcode", 0);
|
||||
request->GetResp()->SetVal("errmsg", "");
|
||||
itr->second(request);
|
||||
|
||||
if (!request->pending){
|
||||
std::string response;
|
||||
request->resp_xobj->ToJsonStr(response);
|
||||
request->GetResp()->ToJsonStr(response);
|
||||
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse(response));
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse("{}"));
|
||||
}
|
||||
|
@ -27,24 +27,24 @@ static void _ProxyCallback(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||
#ifdef DEBUG
|
||||
f8::UdpLog::Instance()->Debug("ProxyCallbBack request:%s",
|
||||
{
|
||||
request->params->ToJsonStr()
|
||||
request->GetParams()->ToJsonStr()
|
||||
});
|
||||
#endif
|
||||
std::string seq_id = request->params->Get("seq_id");
|
||||
std::string seq_id = request->GetParams()->Get("seq_id");
|
||||
std::shared_ptr<HttpProxyRequest> req = HttpProxy::Instance()->GetRequest(seq_id);
|
||||
if (req) {
|
||||
a8::XObject data;
|
||||
|
||||
data.ReadFromJsonString(request->params->Get("data").GetString());
|
||||
data.ReadFromJsonString(request->GetParams()->Get("data").GetString());
|
||||
if (data.GetType() == a8::XOT_SIMPLE) {
|
||||
data.ReadFromJsonString("{}");
|
||||
}
|
||||
f8::HttpContext ctx;
|
||||
if (request->params->HasKey("errcode") &&
|
||||
request->params->Get("errcode").GetInt() == 0) {
|
||||
if (request->GetParams()->HasKey("errcode") &&
|
||||
request->GetParams()->Get("errcode").GetInt() == 0) {
|
||||
req->cb(true, &data, &ctx);
|
||||
} else {
|
||||
req->cb(false, request->params.get(), &ctx);
|
||||
req->cb(false, request->GetParams().get(), &ctx);
|
||||
}
|
||||
HttpProxy::Instance()->DestoryRequest(req);
|
||||
}
|
||||
@ -125,7 +125,7 @@ std::string HttpProxy::HttpGet(
|
||||
|
||||
std::string HttpProxy::CreateRequestId()
|
||||
{
|
||||
return request_prefix_ + a8::XValue(App::Instance()->NewUuid()).GetString();
|
||||
return request_prefix_ + a8::XValue(f8::App::Instance()->NewNodeUuid()).GetString();
|
||||
}
|
||||
|
||||
std::shared_ptr<HttpProxyRequest> HttpProxy::GetRequest(const std::string& req_id)
|
||||
|
@ -25,15 +25,15 @@ void JsonDataMgr::Init()
|
||||
("%s/zone%d/node%d/gameserver.cluster.json",
|
||||
{
|
||||
work_path_,
|
||||
App::Instance()->GetZoneId(),
|
||||
App::Instance()->GetNodeId(),
|
||||
f8::App::Instance()->GetZoneId(),
|
||||
f8::App::Instance()->GetNodeId(),
|
||||
});
|
||||
masterserver_cluster_json_file = a8::Format
|
||||
("%s/zone%d/node%d/masterserver.cluster.json",
|
||||
{
|
||||
work_path_,
|
||||
App::Instance()->GetZoneId(),
|
||||
App::Instance()->GetNodeId(),
|
||||
f8::App::Instance()->GetZoneId(),
|
||||
f8::App::Instance()->GetNodeId(),
|
||||
});
|
||||
|
||||
setting_json_file = a8::Format
|
||||
@ -45,8 +45,8 @@ void JsonDataMgr::Init()
|
||||
("%s/zone%d/node%d/httpproxy.cluster.json",
|
||||
{
|
||||
work_path_,
|
||||
App::Instance()->GetZoneId(),
|
||||
App::Instance()->GetNodeId(),
|
||||
f8::App::Instance()->GetZoneId(),
|
||||
f8::App::Instance()->GetNodeId(),
|
||||
});
|
||||
gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file);
|
||||
masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file);
|
||||
@ -91,7 +91,8 @@ std::shared_ptr<a8::XObject> JsonDataMgr::GetConf()
|
||||
{
|
||||
for (int i = 0; i < gameserver_cluster_json_.Size(); ++i) {
|
||||
std::shared_ptr<a8::XObject> conf = gameserver_cluster_json_.At(i);
|
||||
if (conf->At("instance_id")->AsXValue().GetInt() == App::Instance()->GetInstanceId()) {
|
||||
if (conf->At("instance_id")->AsXValue().GetInt() ==
|
||||
f8::App::Instance()->GetInstanceId()) {
|
||||
return conf;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <f8/app.h>
|
||||
|
||||
#include "app.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int exitcode = 0;
|
||||
if (App::Instance()->Init(argc, argv)) {
|
||||
exitcode = App::Instance()->Run();
|
||||
App::Instance()->UnInit();
|
||||
}
|
||||
return exitcode;
|
||||
return f8::App::Instance()->Run(argc, argv, App::Instance());
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ namespace mt
|
||||
if (f8::IsTestEnv()) {
|
||||
res_path_ = a8::Format("../test_res%d/",
|
||||
{
|
||||
App::Instance()->GetInstanceId()
|
||||
f8::App::Instance()->GetInstanceId()
|
||||
});
|
||||
} else {
|
||||
res_path_ = a8::Format("../dev_res%d/",
|
||||
{
|
||||
App::Instance()->GetInstanceId()
|
||||
f8::App::Instance()->GetInstanceId()
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -183,8 +183,8 @@ namespace mt
|
||||
abort();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (App::Instance()->GetInstanceId() == 600 ||
|
||||
App::Instance()->GetInstanceId() == 100) {
|
||||
if (f8::App::Instance()->GetInstanceId() == 600 ||
|
||||
f8::App::Instance()->GetInstanceId() == 100) {
|
||||
_float_cd = 6;
|
||||
}
|
||||
#endif
|
||||
|
@ -449,8 +449,8 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po
|
||||
port
|
||||
});
|
||||
auto url_params = a8::MutableXObject::CreateObject();
|
||||
url_params->SetVal("node_id", App::Instance()->GetNodeId());
|
||||
url_params->SetVal("instance_id", App::Instance()->GetInstanceId());
|
||||
url_params->SetVal("node_id", f8::App::Instance()->GetNodeId());
|
||||
url_params->SetVal("instance_id", f8::App::Instance()->GetInstanceId());
|
||||
url_params->SetVal("ip", JsonDataMgr::Instance()->ip);
|
||||
url_params->SetVal("port", JsonDataMgr::Instance()->listen_port);
|
||||
url_params->SetVal("online_num", PlayerMgr::Instance()->OnlineNum());
|
||||
@ -543,7 +543,7 @@ std::shared_ptr<Room> RoomMgr::CreateRoom(const cs::CMJoin& msg,
|
||||
RoomInitInfo init_info;
|
||||
{
|
||||
init_info.room_idx = room_idx;
|
||||
init_info.room_uuid = App::Instance()->NewUuid();
|
||||
init_info.room_uuid = f8::App::Instance()->NewGlobalUuid();
|
||||
init_info.room_type = room_type;
|
||||
init_info.room_mode = (RoomMode_e)msg.room_mode();
|
||||
init_info.init_map_id = map_id;
|
||||
@ -731,7 +731,7 @@ void RoomMgr::SendGetBattleData(int mode,
|
||||
for (auto& msg : join_msgs) {
|
||||
std::shared_ptr<BattleDataContext> context = std::make_shared<BattleDataContext>();
|
||||
context->join_msg = msg;
|
||||
context->battle_uuid = App::Instance()->NewUuid();
|
||||
context->battle_uuid = f8::App::Instance()->NewGlobalUuid();
|
||||
context->errcode = 100;
|
||||
context->errmsg = "";
|
||||
result->push_back(context);
|
||||
|
@ -483,7 +483,7 @@ void Team::GenBattleUuid()
|
||||
}
|
||||
}
|
||||
if (!battle_uuid.empty()) {
|
||||
battle_uuid = App::Instance()->NewUuid();
|
||||
battle_uuid = f8::App::Instance()->NewGlobalUuid();
|
||||
}
|
||||
|
||||
for (Human* hum : members_) {
|
||||
|
2
third_party/f8
vendored
2
third_party/f8
vendored
@ -1 +1 @@
|
||||
Subproject commit 7fb9c9083275fd35c2bb4456999673444dcfe986
|
||||
Subproject commit 39cf53ed693b0c6e6d9119c38b894013ac9716e6
|
Loading…
x
Reference in New Issue
Block a user