diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index f5fc88f9..ba7ae636 100644 --- a/server/gameserver/app.cc +++ b/server/gameserver/app.cc @@ -581,3 +581,20 @@ long long App::AllocTempWeaponUniId() ++curr_uniid_; return -curr_uniid_; } + +int App::GetVersion() +{ + const char* current_file_name = __FILE__; + if (!version_) { + std::vector strings; + a8::Split(current_file_name, strings, '/'); + std::string tag = strings.at(strings.size() - 6); + std::vector strings2; + a8::Split(tag, strings2, '.'); + std::string version_str = strings2.at(strings2.size() - 1); + a8::ReplaceString(version_str, "R", "0"); + version_ = std::make_shared(a8::XValue(version_str).GetInt()); + //a8::XPrintf("%s %s %s\n", {current_file_name, *version_, version_str}); + } + return *version_; +} diff --git a/server/gameserver/app.h b/server/gameserver/app.h index 9ce4e30e..3e4e804e 100644 --- a/server/gameserver/app.h +++ b/server/gameserver/app.h @@ -47,6 +47,7 @@ public: int GetTestParam() const { return test_param_; } bool IsServicing() const { return servicing_; } void SetServicing(bool open) { servicing_ = open; } + int GetVersion(); private: void QuickExecute(int delta_time); @@ -102,6 +103,8 @@ private: long long curr_uniid_ = 0; + std::shared_ptr version_; + public: int msgnode_size_ = 0 ; int working_msgnode_size_ = 0; diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index fe97c2b7..52d5c2e1 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -462,6 +462,7 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po url_params->SetVal("channel", JsonDataMgr::Instance()->channel); url_params->SetVal("alive_count", PerfMonitor::Instance()->real_alive_count); url_params->SetVal("servicing", App::Instance()->IsServicing() ? 1 : 0); + url_params->SetVal("version", App::Instance()->GetVersion()); f8::HttpClientPool::Instance()->HttpGet ( cb,