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(
masterserver${GAME_ID} ${SRC_LIST}
masterserver ${SRC_LIST}
)
add_custom_target(script_pb_protocol ALL)
@ -92,12 +92,12 @@ add_custom_command(TARGET script_pb_protocol
PRE_BUILD
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")
target_link_libraries(
masterserver${GAME_ID}
masterserver
pthread
mysqlclient
protobuf
@ -115,7 +115,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
)
else()
target_link_libraries(
masterserver${GAME_ID}
masterserver
pthread
mysqlclient
protobuf

View File

@ -28,7 +28,7 @@ static void SavePerfLog()
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()
@ -106,3 +106,8 @@ void App::DispatchSocketMsg(f8::MsgHdr* 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 void DispatchSocketMsg(f8::MsgHdr* hdr) override;
int GetGameId() const;
private:
void QuickExecute();
void SlowerExecute();

View File

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