From 766e93378e7e36d4a96e839b108d44016e096451 Mon Sep 17 00:00:00 2001 From: notify Date: Sat, 20 Apr 2024 10:57:07 +0800 Subject: [PATCH] Changelog: v0.4.15 --- CHANGELOG.md | 3 ++- CMakeLists.txt | 2 +- android/AndroidManifest.xml | 4 ++-- lua/client/client.lua | 4 ++++ lua/core/engine.lua | 22 +++++++++++++++++++--- lua/server/scheduler.lua | 4 ++++ src/client/client.cpp | 6 ++++++ src/server/roomthread.cpp | 6 ++++++ 8 files changed, 44 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a922ae23..0072d29c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # ChangeLog -## v0.4.13 & v0.4.14 +## v0.4.13 & 14 & 15 - 优化重连逻辑 - 客户端代码大量删除JSON。可能影响部分拓展 +- 各种修bug ___ diff --git a/CMakeLists.txt b/CMakeLists.txt index a364367a..c14f53b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.16) -project(FreeKill VERSION 0.4.14) +project(FreeKill VERSION 0.4.15) add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\") find_package(Qt6 REQUIRED COMPONENTS diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index f3662015..ceae29e8 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -3,8 +3,8 @@ + android:versionCode="415" + android:versionName="0.4.15"> diff --git a/lua/client/client.lua b/lua/client/client.lua index b700e794..dbbd2d9d 100644 --- a/lua/client/client.lua +++ b/lua/client/client.lua @@ -1227,3 +1227,7 @@ end -- Create ClientInstance (used by Lua) ClientInstance = Client:new() dofile "lua/client/client_util.lua" + +if FileIO.pwd():endsWith("packages/freekill-core") then + FileIO.cd("../..") +end diff --git a/lua/core/engine.lua b/lua/core/engine.lua index facaff84..a822c882 100644 --- a/lua/core/engine.lua +++ b/lua/core/engine.lua @@ -201,12 +201,24 @@ end --- 标包和标准卡牌包比较特殊,它们永远会在第一个加载。 ---@return nil function Engine:loadPackages() + local new_core = false + if FileIO.pwd():endsWith("packages/freekill-core") then + new_core = true + FileIO.cd("../..") + end local directories = FileIO.ls("packages") -- load standard & standard_cards first - self:loadPackage(require("packages.standard")) - self:loadPackage(require("packages.standard_cards")) - self:loadPackage(require("packages.maneuvering")) + if new_core then + self:loadPackage(require("packages.freekill-core.standard")) + self:loadPackage(require("packages.freekill-core.standard_cards")) + self:loadPackage(require("packages.freekill-core.maneuvering")) + table.removeOne(directories, "freekill-core") + else + self:loadPackage(require("packages.standard")) + self:loadPackage(require("packages.standard_cards")) + self:loadPackage(require("packages.maneuvering")) + end table.removeOne(directories, "standard") table.removeOne(directories, "standard_cards") table.removeOne(directories, "maneuvering") @@ -235,6 +247,10 @@ function Engine:loadPackages() end end end + + if new_core then + FileIO.cd("packages/freekill-core") + end end ---@return nil diff --git a/lua/server/scheduler.lua b/lua/server/scheduler.lua index 3df69ece..f67a1e87 100644 --- a/lua/server/scheduler.lua +++ b/lua/server/scheduler.lua @@ -168,3 +168,7 @@ end function IsConsoleStart() return requestRoom.thread:isConsoleStart() end + +if FileIO.pwd():endsWith("packages/freekill-core") then + FileIO.cd("../..") +end diff --git a/src/client/client.cpp b/src/client/client.cpp index f2dc5e4c..a9578520 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -27,6 +27,12 @@ Client::Client(QObject *parent) : QObject(parent), callback(0) { router = new Router(this, socket, Router::TYPE_CLIENT); L = CreateLuaState(); + if (QFile::exists("packages/freekill-core") && + !GetDisabledPacks().contains("freekill-core")) { + // 危险的cd操作,记得在lua中切回游戏根目录 + QDir::setCurrent("packages/freekill-core"); + } + DoLuaScript(L, "lua/freekill.lua"); DoLuaScript(L, "lua/client/client.lua"); } diff --git a/src/server/roomthread.cpp b/src/server/roomthread.cpp index 91206caf..cbbff968 100644 --- a/src/server/roomthread.cpp +++ b/src/server/roomthread.cpp @@ -17,6 +17,12 @@ RoomThread::RoomThread(Server *m_server) { md5 = m_server->getMd5(); L = CreateLuaState(); + if (QFile::exists("packages/freekill-core") && + !GetDisabledPacks().contains("freekill-core")) { + // 危险的cd操作,记得在lua中切回游戏根目录 + QDir::setCurrent("packages/freekill-core"); + } + DoLuaScript(L, "lua/freekill.lua"); DoLuaScript(L, "lua/server/scheduler.lua"); start();