This commit is contained in:
azw 2023-11-10 11:01:52 +00:00
parent b29f436980
commit 80ce110950
4 changed files with 14 additions and 7 deletions

View File

@ -84,7 +84,7 @@ set(EXECUTABLE_OUTPUT_PATH
) )
add_executable( add_executable(
masterserver${GAME_ID} ${SRC_LIST} masterserver ${SRC_LIST}
) )
add_custom_target(script_pb_protocol ALL) add_custom_target(script_pb_protocol ALL)
@ -92,12 +92,12 @@ add_custom_command(TARGET script_pb_protocol
PRE_BUILD PRE_BUILD
COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=ss_proto,ss_msgid --nohooks 1 COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=ss_proto,ss_msgid --nohooks 1
) )
add_dependencies(masterserver${GAME_ID} script_pb_protocol) add_dependencies(masterserver script_pb_protocol)
if (CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries( target_link_libraries(
masterserver${GAME_ID} masterserver
pthread pthread
mysqlclient mysqlclient
protobuf protobuf
@ -115,7 +115,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
) )
else() else()
target_link_libraries( target_link_libraries(
masterserver${GAME_ID} masterserver
pthread pthread
mysqlclient mysqlclient
protobuf protobuf

View File

@ -28,7 +28,7 @@ static void SavePerfLog()
const std::string App::GetPkgName() const std::string App::GetPkgName()
{ {
return a8::Format("game%d_masterserver", {GAME_ID}); return a8::Format("game%d_masterserver", {App::Instance()->GetGameId()});
} }
void App::Init() void App::Init()
@ -106,3 +106,8 @@ void App::DispatchSocketMsg(f8::MsgHdr* hdr)
} }
f8::App::Instance()->FreeSocketMsg(hdr); f8::App::Instance()->FreeSocketMsg(hdr);
} }
int App::GetGameId() const
{
return GAME_ID;
}

View File

@ -25,6 +25,8 @@ public:
virtual bool HasTask() override; virtual bool HasTask() override;
virtual void DispatchSocketMsg(f8::MsgHdr* hdr) override; virtual void DispatchSocketMsg(f8::MsgHdr* hdr) override;
int GetGameId() const;
private: private:
void QuickExecute(); void QuickExecute();
void SlowerExecute(); void SlowerExecute();

View File

@ -9,9 +9,9 @@ void JsonDataMgr::Init()
{ {
if (!f8::IsOnlineEnv()) { if (!f8::IsOnlineEnv()) {
if (f8::IsTestEnv()) { if (f8::IsTestEnv()) {
work_path_ = a8::Format("../%d_test_config", {GAME_ID}); work_path_ = a8::Format("../%d_test_config", {App::Instance()->GetGameId()});
} else { } else {
work_path_ = a8::Format("../%d_dev_config", {GAME_ID}); work_path_ = a8::Format("../%d_dev_config", {App::Instance()->GetGameId()});
} }
} }