diff --git a/CAPI/cpp/API/include/API.h b/CAPI/cpp/API/include/API.h index 5c6c463a..9b2a41e9 100755 --- a/CAPI/cpp/API/include/API.h +++ b/CAPI/cpp/API/include/API.h @@ -45,7 +45,7 @@ class ILogic [[nodiscard]] virtual std::shared_ptr GetGameInfo() const = 0; [[nodiscard]] virtual std::vector GetPlayerGUIDs() const = 0; [[nodiscard]] virtual THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0; - [[nodiscard]] virtual std::pair GetConstructionState(int32_t cellX, int32_t cellY) const = 0; + [[nodiscard]] virtual std::optional GetConstructionState(int32_t cellX, int32_t cellY) const = 0; [[nodiscard]] virtual int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const = 0; [[nodiscard]] virtual int32_t GetResourceState(int32_t cellX, int32_t cellY) const = 0; [[nodiscard]] virtual int32_t GetHomeHp() const = 0; @@ -64,6 +64,8 @@ class ILogic virtual bool Move(int64_t time, double angle) = 0; virtual bool Recover(int64_t recover) = 0; virtual bool Produce() = 0; + virtual bool RepairWormhole() = 0; + virtual bool RepairHome() = 0; virtual bool Rebuild(THUAI7::ConstructionType constructionType) = 0; virtual bool Construct(THUAI7::ConstructionType constructionType) = 0; virtual bool Attack(double angle) = 0; @@ -97,7 +99,7 @@ class IAPI [[nodiscard]] virtual std::vector> GetFullMap() const = 0; [[nodiscard]] virtual std::shared_ptr GetGameInfo() const = 0; [[nodiscard]] virtual THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0; - [[nodiscard]] virtual std::pair GetConstructionState(int32_t cellX, int32_t cellY) const = 0; + [[nodiscard]] virtual std::optional GetConstructionState(int32_t cellX, int32_t cellY) const = 0; [[nodiscard]] virtual int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const = 0; [[nodiscard]] virtual int32_t GetResourceState(int32_t cellX, int32_t cellY) const = 0; [[nodiscard]] virtual int32_t GetHomeHp() const = 0; @@ -139,6 +141,8 @@ class IShipAPI : public IAPI virtual std::future Attack(double angleInRadian) = 0; virtual std::future Recover(int64_t recover) = 0; virtual std::future Produce() = 0; + virtual std::future RepairWormhole() = 0; + virtual std::future RepairHome() = 0; virtual std::future Rebuild(THUAI7::ConstructionType constructionType) = 0; virtual std::future Construct(THUAI7::ConstructionType constructionType) = 0; virtual std::shared_ptr GetSelfInfo() const = 0; @@ -195,6 +199,8 @@ class ShipAPI : public IShipAPI, public IGameTimer std::future Attack(double angleInRadian) override; std::future Recover(int64_t recover) override; std::future Produce() override; + std::future RepairWormhole() override; + std::future RepairHome() override; std::future Rebuild(THUAI7::ConstructionType constructionType) override; std::future Construct(THUAI7::ConstructionType constructionType) override; @@ -203,7 +209,7 @@ class ShipAPI : public IShipAPI, public IGameTimer [[nodiscard]] std::vector> GetBullets() const override; [[nodiscard]] std::vector> GetFullMap() const override; [[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override; - [[nodiscard]] std::pair GetConstructionState(int32_t cellX, int32_t cellY) const override; + [[nodiscard]] std::optional GetConstructionState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override; [[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] std::shared_ptr GetGameInfo() const override; @@ -259,7 +265,7 @@ class TeamAPI : public ITeamAPI, public IGameTimer [[nodiscard]] std::vector> GetBullets() const override; [[nodiscard]] std::vector> GetFullMap() const override; [[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override; - [[nodiscard]] std::pair GetConstructionState(int32_t cellX, int32_t cellY) const override; + [[nodiscard]] std::optional GetConstructionState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override; [[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] int32_t GetHomeHp() const override; @@ -312,6 +318,8 @@ class ShipDebugAPI : public IShipAPI, public IGameTimer std::future Attack(double angleInRadian) override; std::future Recover(int64_t recover) override; std::future Produce() override; + std::future RepairWormhole() override; + std::future RepairHome() override; std::future Rebuild(THUAI7::ConstructionType constructionType) override; std::future Construct(THUAI7::ConstructionType constructionType) override; @@ -320,7 +328,7 @@ class ShipDebugAPI : public IShipAPI, public IGameTimer [[nodiscard]] std::vector> GetBullets() const override; [[nodiscard]] std::vector> GetFullMap() const override; [[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override; - [[nodiscard]] std::pair GetConstructionState(int32_t cellX, int32_t cellY) const override; + [[nodiscard]] std::optional GetConstructionState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override; [[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] int32_t GetHomeHp() const override; @@ -366,7 +374,7 @@ class TeamDebugAPI : public ITeamAPI, public IGameTimer [[nodiscard]] std::vector> GetBullets() const override; [[nodiscard]] std::vector> GetFullMap() const override; [[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override; - [[nodiscard]] std::pair GetConstructionState(int32_t cellX, int32_t cellY) const override; + [[nodiscard]] std::optional GetConstructionState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override; [[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override; [[nodiscard]] int32_t GetHomeHp() const override; diff --git a/CAPI/cpp/API/include/Communication.h b/CAPI/cpp/API/include/Communication.h index 96a846b7..9b7a46f3 100755 --- a/CAPI/cpp/API/include/Communication.h +++ b/CAPI/cpp/API/include/Communication.h @@ -24,9 +24,7 @@ class Communication { public: Communication(std::string sIP, std::string sPort); - ~Communication() - { - } + ~Communication() = default; bool TryConnection(int32_t playerID, int32_t teamID); protobuf::MessageToClient GetMessage2Client(); void AddPlayer(int32_t playerID, int32_t teamID, THUAI7::ShipType ShipType); @@ -35,6 +33,8 @@ class Communication bool Move(int32_t playerID, int32_t teamID, int64_t time, double angle); bool Recover(int32_t playerID, int64_t recover, int32_t teamID); bool Produce(int32_t playerID, int32_t teamID); + bool RepairWormhole(int32_t playerID, int32_t teamID); + bool RepairHome(int32_t playerID, int32_t teamID); bool Rebuild(int32_t playerID, int32_t teamID, THUAI7::ConstructionType constructionType); bool Construct(int32_t playerID, int32_t teamID, THUAI7::ConstructionType constructionType); bool Attack(int32_t playerID, int32_t teamID, double angle); @@ -50,8 +50,8 @@ class Communication protobuf::MessageToClient message2Client; std::mutex mtxMessage; std::mutex mtxLimit; - int32_t counter; - int32_t counterMove; + int32_t counter{}; + int32_t counterMove{}; static constexpr const int32_t limit = 50; static constexpr const int32_t moveLimit = 10; std::condition_variable cvMessage; diff --git a/CAPI/cpp/API/include/constants.h b/CAPI/cpp/API/include/constants.h index a535aee9..fb7c4ffa 100755 --- a/CAPI/cpp/API/include/constants.h +++ b/CAPI/cpp/API/include/constants.h @@ -17,7 +17,7 @@ namespace Constants SCCI int32_t numOfGridPerCell = 1000; // 单位坐标数 SCCI int32_t rows = 50; // 地图行数 SCCI int32_t cols = 50; // 地图列数 - SCCI int32_t maxResourceProgress = 200; + SCCI int32_t maxResourceProgress = 32000; SCCI int32_t maxWormholeHp = 18000; SCCI double robPercent = 0.2; // 击杀获得经济比率 SCCI int32_t DestroyBuildingBonus = 200; @@ -25,23 +25,25 @@ namespace Constants SCCI double recycleMultiplier = 0.5; struct Home { - SCCI int32_t maxHp = 24000; + SCCI int32_t maxHp = 48000; SCCI int32_t energySpeed = 100; + SCCI int32_t attackRange = 8000; + SCCI int32_t damage = 300; }; struct Factory { - SCCI int32_t maxHp = 8000; - SCCI int32_t energySpeed = 300; + SCCI int32_t maxHp = 12000; + SCCI int32_t energySpeed = 200; }; struct Community { - SCCI int32_t maxHp = 6000; + SCCI int32_t maxHp = 10000; }; struct Fort { - SCCI int32_t maxHp = 12000; + SCCI int32_t maxHp = 16000; SCCI int32_t attackRange = 8000; - SCCI int32_t damage = 1200; + SCCI int32_t damage = 300; }; // 船 @@ -120,54 +122,55 @@ namespace Constants // 子弹 struct Laser { - SCCI int32_t Damage = 1200; + SCCI int32_t Damage = 800; SCCI int32_t AttackRange = 4000; SCCI double ArmorDamageMultiplier = 1.5; SCCI double ShieldDamageMultiplier = 0.6; SCCI int32_t Speed = 20000; - SCCI int32_t CastTime = 300; // ms - SCCI int32_t BackSwing = 300; + SCCI int32_t CastTime = 500; // ms + SCCI int32_t BackSwing = 1000; }; struct Plasma { - SCCI int32_t Damage = 1300; + SCCI int32_t Damage = 1000; SCCI int32_t AttackRange = 4000; SCCI double ArmorDamageMultiplier = 2.0; SCCI double ShieldDamageMultiplier = 0.4; SCCI int32_t Speed = 10000; - SCCI int32_t CastTime = 400; // ms - SCCI int32_t BackSwing = 400; + SCCI int32_t CastTime = 800; // ms + SCCI int32_t BackSwing = 1600; }; struct Shell { - SCCI int32_t Damage = 1800; + SCCI int32_t Damage = 1200; SCCI int32_t AttackRange = 4000; SCCI double ArmorDamageMultiplier = 0.4; SCCI double ShieldDamageMultiplier = 1.5; SCCI int32_t Speed = 8000; - SCCI int32_t CastTime = 200; // ms - SCCI int32_t BackSwing = 200; + SCCI int32_t CastTime = 500; // ms + SCCI int32_t BackSwing = 1000; }; struct Missile { SCCI int32_t Damage = 1600; - SCCI int32_t AttackRange = 8000; - SCCI int32_t ExplodeRange = 1600; + SCCI int32_t AttackRange = 6000; + SCCI int32_t ExplodeRange = 1100; SCCI double ArmorDamageMultiplier = 1.0; SCCI double ShieldDamageMultiplier = 0.4; SCCI int32_t Speed = 6000; - SCCI int32_t CastTime = 600; // ms - SCCI int32_t BackSwing = 600; + SCCI int32_t CastTime = 1200; // ms + SCCI int32_t BackSwing = 1800; }; struct Arc { - SCCI int32_t Damage = 3200; // 100-3200 - SCCI int32_t AttackRange = 8000; + SCCI int32_t MinDamage = 800; + SCCI int32_t MaxDamage = 1600; + SCCI int32_t AttackRange = 6000; SCCI double ArmorDamageMultiplier = 2.0; SCCI double ShieldDamageMultiplier = 2.0; SCCI int32_t Speed = 8000; - SCCI int32_t CastTime = 600; // ms - SCCI int32_t BackSwing = 600; + SCCI int32_t CastTime = 1200; // ms + SCCI int32_t BackSwing = 1800; }; } // namespace Constants #endif diff --git a/CAPI/cpp/API/include/logic.h b/CAPI/cpp/API/include/logic.h index cd1df973..3b41a065 100755 --- a/CAPI/cpp/API/include/logic.h +++ b/CAPI/cpp/API/include/logic.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -62,7 +63,7 @@ class Logic : public ILogic std::condition_variable cvAI; // 信息队列 - ConcurrentQueue> messageQueue; + ConcurrentQueue> messageQueue; // 存储状态,分别是现在的状态和缓冲区的状态。 State state[2]; @@ -98,7 +99,7 @@ class Logic : public ILogic [[nodiscard]] std::shared_ptr GetGameInfo() const; [[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const; [[nodiscard]] std::vector GetPlayerGUIDs() const; - [[nodiscard]] std::pair GetConstructionState(int32_t cellX, int32_t cellY) const; + [[nodiscard]] std::optional GetConstructionState(int32_t cellX, int32_t cellY) const; [[nodiscard]] int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const; [[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const; [[nodiscard]] int32_t GetHomeHp() const; @@ -117,6 +118,8 @@ class Logic : public ILogic bool Move(int64_t time, double angle); bool Recover(int64_t recover); bool Produce(); + bool RepairWormhole(); + bool RepairHome(); bool Rebuild(THUAI7::ConstructionType constructionType); bool Construct(THUAI7::ConstructionType constructionType); bool Attack(double angle); diff --git a/CAPI/cpp/API/include/structures.h b/CAPI/cpp/API/include/structures.h index 35bd5b4f..719fb31a 100755 --- a/CAPI/cpp/API/include/structures.h +++ b/CAPI/cpp/API/include/structures.h @@ -14,7 +14,6 @@ namespace THUAI7 { - // 游戏状态 enum class GameState : unsigned char { @@ -197,8 +196,8 @@ namespace THUAI7 int32_t hp; // 血量 int32_t armor; // 装甲 int32_t shield; // 护盾 - int32_t playerID; // 船的id - int32_t teamID; + int64_t playerID; // 船的id + int64_t teamID; int64_t guid; // 全局唯一ID ShipState shipState; // 船所处状态 ShipType shipType; @@ -213,10 +212,10 @@ namespace THUAI7 struct Team { - int32_t playerID; - int32_t teamID; - int32_t score; - int32_t energy; + int64_t playerID; + int64_t teamID; + int64_t score; + int64_t energy; }; struct Home @@ -224,7 +223,7 @@ namespace THUAI7 int32_t x; int32_t y; int32_t hp; - int32_t teamID; + int64_t teamID; int64_t guid; }; @@ -234,13 +233,25 @@ namespace THUAI7 int32_t y; // y坐标 double facingDirection; // 朝向 int64_t guid; // - int32_t teamID; // 子弹所属队伍 + int64_t teamID; // 子弹所属队伍 BulletType bulletType; // 子弹类型 int32_t damage; // 伤害值 int32_t attackRange; - int32_t bombRange; - double explodeRange; // 炸弹爆炸范围 - int32_t speed; // 子弹速度 + double bombRange; // 炸弹爆炸范围 + int32_t speed; // 子弹速度 + }; + + struct ConstructionState + { + int64_t teamID; + int32_t hp; + ConstructionType constructionType; + ConstructionState(std::pair teamHP, ConstructionType type) : + teamID(teamHP.first), + hp(teamHP.second), + constructionType(type) + { + } }; // struct BombedBullet @@ -253,15 +264,17 @@ namespace THUAI7 // double bombRange, // }; + using cellxy_t = std::pair; + struct GameMap { // x,y,id,hp - std::map, std::pair> factoryState; - std::map, std::pair> communityState; - std::map, std::pair> fortState; - std::map, std::pair> homeState; - std::map, int32_t> wormholeState; - std::map, int32_t> resourceState; + std::map> factoryState; + std::map> communityState; + std::map> fortState; + std::map> homeState; + std::map wormholeState; + std::map resourceState; }; struct GameInfo @@ -355,7 +368,8 @@ namespace THUAI7 {ModuleType::ModulePlasmaGun, "ModulePlasmaGun"}, {ModuleType::ModuleShellGun, "ModuleShellGun"}, {ModuleType::ModuleMissileGun, "ModuleMissileGun"}, - {ModuleType::ModuleArcGun, "ModuleArcGun"}}; + {ModuleType::ModuleArcGun, "ModuleArcGun"}, + }; inline std::map messageOfObjDict{ {MessageOfObj::NullMessageOfObj, "NullMessageOfObj"}, diff --git a/CAPI/cpp/API/include/utils.hpp b/CAPI/cpp/API/include/utils.hpp index b2046927..5a38ea56 100755 --- a/CAPI/cpp/API/include/utils.hpp +++ b/CAPI/cpp/API/include/utils.hpp @@ -17,9 +17,9 @@ #undef SendMessage #undef PeekMessage +// 用于将THUAI7的类转换为Protobuf的类 namespace AssistFunction { - constexpr int32_t numOfGridPerCell = 1000; [[nodiscard]] constexpr inline int32_t GridToCell(int32_t grid) noexcept @@ -29,21 +29,21 @@ namespace AssistFunction [[nodiscard]] constexpr inline int32_t GridToCell(double grid) noexcept { - return int(grid) / numOfGridPerCell; + return int32_t(grid) / numOfGridPerCell; } inline bool HaveView(int32_t x, int32_t y, int32_t newX, int32_t newY, int32_t viewRange, std::vector>& map) { - int32_t deltaX = newX - x; - int32_t deltaY = newY - y; - double distance = deltaX * deltaX + deltaY * deltaY; + double deltaX = newX - x; + double deltaY = newY - y; + double distance = std::pow(deltaX, 2) + std::pow(deltaY, 2); THUAI7::PlaceType myPlace = map[GridToCell(x)][GridToCell(y)]; THUAI7::PlaceType newPlace = map[GridToCell(newX)][GridToCell(newY)]; if (newPlace == THUAI7::PlaceType::Shadow && myPlace != THUAI7::PlaceType::Shadow) return false; - if (distance > viewRange * viewRange) + if (distance > std::pow(viewRange, 2)) return false; - int32_t divide = std::max(std::abs(deltaX), std::abs(deltaY)) / 100; + int32_t divide = int32_t(std::max(std::abs(deltaX), std::abs(deltaY)) / 100); if (divide == 0) return true; double dx = deltaX / divide; @@ -539,15 +539,14 @@ namespace THUAI72Proto playerMsg.set_ship_type(THUAI72Proto::shipTypeDict[ShipType]); return playerMsg; } - - // 用于将THUAI7的类转换为Protobuf的类 } // namespace THUAI72Proto + namespace Time { inline double TimeSinceStart(const std::chrono::system_clock::time_point& sp) { - std::chrono::system_clock::time_point tp = std::chrono::system_clock::now(); - std::chrono::duration time_span = std::chrono::duration_cast>(tp - sp); + auto tp = std::chrono::system_clock::now(); + auto time_span = std::chrono::duration_cast>(tp - sp); return time_span.count(); } } // namespace Time diff --git a/CAPI/cpp/API/src/API.cpp b/CAPI/cpp/API/src/API.cpp index 0059658d..9656d2ec 100755 --- a/CAPI/cpp/API/src/API.cpp +++ b/CAPI/cpp/API/src/API.cpp @@ -1,4 +1,3 @@ -#include #include "AI.h" #include "API.h" @@ -140,12 +139,12 @@ THUAI7::PlaceType TeamAPI::GetPlaceType(int32_t cellX, int32_t cellY) const return logic.GetPlaceType(cellX, cellY); } -std::pair ShipAPI::GetConstructionState(int32_t cellX, int32_t cellY) const +std::optional ShipAPI::GetConstructionState(int32_t cellX, int32_t cellY) const { return logic.GetConstructionState(cellX, cellY); } -std::pair TeamAPI::GetConstructionState(int32_t cellX, int32_t cellY) const +std::optional TeamAPI::GetConstructionState(int32_t cellX, int32_t cellY) const { return logic.GetConstructionState(cellX, cellY); } @@ -275,6 +274,18 @@ std::future ShipAPI::Produce() { return logic.Produce(); }); } +std::future ShipAPI::RepairWormhole() +{ + return std::async(std::launch::async, [=]() + { return logic.RepairWormhole(); }); +} + +std::future ShipAPI::RepairHome() +{ + return std::async(std::launch::async, [=]() + { return logic.RepairHome(); }); +} + std::future ShipAPI::Rebuild(THUAI7::ConstructionType constructionType) { return std::async(std::launch::async, [=]() diff --git a/CAPI/cpp/API/src/Communication.cpp b/CAPI/cpp/API/src/Communication.cpp index 6c86b7eb..1c68e8da 100755 --- a/CAPI/cpp/API/src/Communication.cpp +++ b/CAPI/cpp/API/src/Communication.cpp @@ -114,6 +114,44 @@ bool Communication::Produce(int32_t playerID, int32_t teamID) return false; } +bool Communication::RepairWormhole(int32_t playerID, int32_t teamID) +{ + { + std::lock_guard lock(mtxLimit); + if (counter >= limit || counterMove >= moveLimit) + return false; + counter++; + counterMove++; + } + protobuf::BoolRes repairWormholeResult; + ClientContext context; + auto request = THUAI72Proto::THUAI72ProtobufIDMsg(playerID, teamID); + auto status = THUAI7Stub->RepairWormhole(&context, request, &repairWormholeResult); + if (status.ok()) + return repairWormholeResult.act_success(); + else + return false; +} + +bool Communication::RepairHome(int32_t playerID, int32_t teamID) +{ + { + std::lock_guard lock(mtxLimit); + if (counter >= limit || counterMove >= moveLimit) + return false; + counter++; + counterMove++; + } + protobuf::BoolRes repairHomeResult; + ClientContext context; + auto request = THUAI72Proto::THUAI72ProtobufIDMsg(playerID, teamID); + auto status = THUAI7Stub->RepairHome(&context, request, &repairHomeResult); + if (status.ok()) + return repairHomeResult.act_success(); + else + return false; +} + bool Communication::Rebuild(int32_t playerID, int32_t teamID, THUAI7::ConstructionType constructionType) { { diff --git a/CAPI/cpp/API/src/DebugAPI.cpp b/CAPI/cpp/API/src/DebugAPI.cpp index c2641e32..4e24fd50 100755 --- a/CAPI/cpp/API/src/DebugAPI.cpp +++ b/CAPI/cpp/API/src/DebugAPI.cpp @@ -156,6 +156,27 @@ std::future ShipDebugAPI::Produce() logger->warn("Produce: failed at {}ms",Time::TimeSinceStart(startPoint)); return result; }); } + +std::future ShipDebugAPI::RepairWormhole() +{ + logger->info("RepairWormhole: called at {}ms", Time::TimeSinceStart(startPoint)); + return std::async(std::launch::async, [=]() + { auto result= logic.RepairWormhole(); + if(!result) + logger->warn("RepairWormhole: failed at {}ms",Time::TimeSinceStart(startPoint)); + return result; }); +} + +std::future ShipDebugAPI::RepairHome() +{ + logger->info("RepairHome: called at {}ms", Time::TimeSinceStart(startPoint)); + return std::async(std::launch::async, [=]() + { auto result= logic.RepairHome(); + if(!result) + logger->warn("RepairHome: failed at {}ms",Time::TimeSinceStart(startPoint)); + return result; }); +} + std::future ShipDebugAPI::Rebuild(THUAI7::ConstructionType constructionType) { logger->info("Rebuild: rebuilding {}, called at {}ms", THUAI7::constructionDict[constructionType], Time::TimeSinceStart(startPoint)); @@ -201,7 +222,7 @@ THUAI7::PlaceType ShipDebugAPI::GetPlaceType(int32_t cellX, int32_t cellY) const return logic.GetPlaceType(cellX, cellY); } -std::pair ShipDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const +std::optional ShipDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const { return logic.GetConstructionState(cellX, cellY); } @@ -395,7 +416,7 @@ THUAI7::PlaceType TeamDebugAPI::GetPlaceType(int32_t cellX, int32_t cellY) const return logic.GetPlaceType(cellX, cellY); } -std::pair TeamDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const +std::optional TeamDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const { return logic.GetConstructionState(cellX, cellY); } @@ -446,7 +467,7 @@ std::future TeamDebugAPI::InstallModule(int32_t playerID, THUAI7::ModuleTy return std::async(std::launch::async, [=]() { auto result= logic.InstallModule(playerID, moduleType); if(!result) - logger->info("InstallModule: failed at {}ms",Time::TimeSinceStart(startPoint)); + logger->warn("InstallModule: failed at {}ms",Time::TimeSinceStart(startPoint)); return result; }); } @@ -474,7 +495,7 @@ void TeamDebugAPI::PrintSelfInfo() const { auto Team = logic.TeamGetSelfInfo(); logger->info("******Self Info******"); - logger->info("playerID={}, teamID={}, score={}, energy={}", Team->playerID, Team->teamID, Team->score, Team->energy); + logger->info("teamID={}, playerID={}, score={}, energy={}", Team->teamID, Team->playerID, Team->score, Team->energy); logger->info("*********************\n"); } diff --git a/CAPI/cpp/API/src/logic.cpp b/CAPI/cpp/API/src/logic.cpp index 050b0325..56a18360 100755 --- a/CAPI/cpp/API/src/logic.cpp +++ b/CAPI/cpp/API/src/logic.cpp @@ -91,26 +91,26 @@ THUAI7::PlaceType Logic::GetPlaceType(int32_t cellX, int32_t cellY) const return currentState->gameMap[cellX][cellY]; } -std::pair Logic::GetConstructionState(int32_t cellX, int32_t cellY) const +std::optional Logic::GetConstructionState(int32_t cellX, int32_t cellY) const { std::unique_lock lock(mtxState); logger->debug("Called GetConstructionState"); - auto pos = std::make_pair(cellX, cellY); + auto pos = THUAI7::cellxy_t(cellX, cellY); auto it = currentState->mapInfo->factoryState.find(pos); auto it2 = currentState->mapInfo->communityState.find(pos); auto it3 = currentState->mapInfo->fortState.find(pos); if (it != currentState->mapInfo->factoryState.end()) { - return currentState->mapInfo->factoryState[pos]; + return std::make_optional(currentState->mapInfo->factoryState[pos], THUAI7::ConstructionType::Factory); } else if (it2 != currentState->mapInfo->communityState.end()) - return currentState->mapInfo->communityState[pos]; + return std::make_optional(currentState->mapInfo->communityState[pos], THUAI7::ConstructionType::Community); else if (it3 != currentState->mapInfo->fortState.end()) - return currentState->mapInfo->fortState[pos]; + return std::make_optional(currentState->mapInfo->fortState[pos], THUAI7::ConstructionType::Fort); else { logger->warn("Construction not found"); - return std::make_pair(-1, -1); + return std::nullopt; } } @@ -118,7 +118,7 @@ int32_t Logic::GetWormholeHp(int32_t cellX, int32_t cellY) const { std::unique_lock lock(mtxState); logger->debug("Called GetWormholeHp"); - auto pos = std::make_pair(cellX, cellY); + auto pos = THUAI7::cellxy_t(cellX, cellY); auto it = currentState->mapInfo->wormholeState.find(pos); if (it != currentState->mapInfo->wormholeState.end()) { @@ -144,7 +144,7 @@ int32_t Logic::GetResourceState(int32_t cellX, int32_t cellY) const { std::unique_lock lock(mtxState); logger->debug("Called GetResourceState"); - auto pos = std::make_pair(cellX, cellY); + auto pos = THUAI7::cellxy_t(cellX, cellY); auto it = currentState->mapInfo->resourceState.find(pos); if (it != currentState->mapInfo->resourceState.end()) { @@ -220,7 +220,7 @@ std::pair Logic::GetMessage() else { logger->warn("No message"); - return std::make_pair(-1, ""); + return std::pair(-1, std::string("")); } } @@ -261,6 +261,18 @@ bool Logic::Produce() return pComm->Produce(playerID, teamID); } +bool Logic::RepairWormhole() +{ + logger->debug("Called RepairWormhole"); + return pComm->RepairWormhole(playerID, teamID); +} + +bool Logic::RepairHome() +{ + logger->debug("Called RepairHome"); + return pComm->RepairHome(playerID, teamID); +} + bool Logic::Rebuild(THUAI7::ConstructionType constructionType) { logger->debug("Called Rebuild"); @@ -310,7 +322,7 @@ void Logic::ProcessMessage() if (Proto2THUAI7::messageOfObjDict[item.message_of_obj_case()] == THUAI7::MessageOfObj::MapMessage) { auto map = std::vector>(); - auto mapResult = item.map_message(); + auto& mapResult = item.map_message(); for (int32_t i = 0; i < item.map_message().rows_size(); i++) { std::vector row; @@ -439,10 +451,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::HomeMessage: if (item.home_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.home_message().x()), AssistFunction::GridToCell(item.home_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.home_message().x()), + AssistFunction::GridToCell(item.home_message().y()) + ); if (bufferState->mapInfo->homeState.count(pos) == 0) { - bufferState->mapInfo->homeState.emplace(pos, std::make_pair(item.home_message().team_id(), item.home_message().hp())); + bufferState->mapInfo->homeState.emplace(pos, std::pair(item.home_message().team_id(), item.home_message().hp())); logger->debug("Load Home!"); } else @@ -453,10 +468,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (AssistFunction::HaveView(x, y, item.home_message().x(), item.home_message().y(), viewRange, bufferState->gameMap)) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.home_message().x()), AssistFunction::GridToCell(item.home_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.home_message().x()), + AssistFunction::GridToCell(item.home_message().y()) + ); if (bufferState->mapInfo->homeState.count(pos) == 0) { - bufferState->mapInfo->homeState.emplace(pos, std::make_pair(item.home_message().team_id(), item.home_message().hp())); + bufferState->mapInfo->homeState.emplace(pos, std::pair(item.home_message().team_id(), item.home_message().hp())); logger->debug("Load Home!"); } else @@ -469,10 +487,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::FactoryMessage: if (item.factory_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.factory_message().x()), AssistFunction::GridToCell(item.factory_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.factory_message().x()), + AssistFunction::GridToCell(item.factory_message().y()) + ); if (bufferState->mapInfo->factoryState.count(pos) == 0) { - bufferState->mapInfo->factoryState.emplace(pos, std::make_pair(item.factory_message().team_id(), item.factory_message().hp())); + bufferState->mapInfo->factoryState.emplace(pos, std::pair(item.factory_message().team_id(), item.factory_message().hp())); logger->debug("Load Factory!"); } else @@ -484,10 +505,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (AssistFunction::HaveView(x, y, item.factory_message().x(), item.factory_message().y(), viewRange, bufferState->gameMap)) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.factory_message().x()), AssistFunction::GridToCell(item.factory_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.factory_message().x()), + AssistFunction::GridToCell(item.factory_message().y()) + ); if (bufferState->mapInfo->factoryState.count(pos) == 0) { - bufferState->mapInfo->factoryState.emplace(pos, std::make_pair(item.factory_message().team_id(), item.factory_message().hp())); + bufferState->mapInfo->factoryState.emplace(pos, std::pair(item.factory_message().team_id(), item.factory_message().hp())); logger->debug("Load Factory!"); } else @@ -501,10 +525,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::CommunityMessage: if (item.community_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.community_message().x()), AssistFunction::GridToCell(item.community_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.community_message().x()), + AssistFunction::GridToCell(item.community_message().y()) + ); if (bufferState->mapInfo->communityState.count(pos) == 0) { - bufferState->mapInfo->communityState.emplace(pos, std::make_pair(item.community_message().team_id(), item.community_message().hp())); + bufferState->mapInfo->communityState.emplace(pos, std::pair(item.community_message().team_id(), item.community_message().hp())); logger->debug("Load Community!"); } else @@ -516,10 +543,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (AssistFunction::HaveView(x, y, item.community_message().x(), item.community_message().y(), viewRange, bufferState->gameMap)) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.community_message().x()), AssistFunction::GridToCell(item.community_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.community_message().x()), + AssistFunction::GridToCell(item.community_message().y()) + ); if (bufferState->mapInfo->communityState.count(pos) == 0) { - bufferState->mapInfo->communityState.emplace(pos, std::make_pair(item.community_message().team_id(), item.community_message().hp())); + bufferState->mapInfo->communityState.emplace(pos, std::pair(item.community_message().team_id(), item.community_message().hp())); logger->debug("Load Community!"); } else @@ -533,10 +563,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::FortMessage: if (item.fort_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.fort_message().x()), AssistFunction::GridToCell(item.fort_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.fort_message().x()), + AssistFunction::GridToCell(item.fort_message().y()) + ); if (bufferState->mapInfo->fortState.count(pos) == 0) { - bufferState->mapInfo->fortState.emplace(pos, std::make_pair(item.fort_message().team_id(), item.fort_message().hp())); + bufferState->mapInfo->fortState.emplace(pos, std::pair(item.fort_message().team_id(), item.fort_message().hp())); logger->debug("Load Fort!"); } else @@ -548,10 +581,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (AssistFunction::HaveView(x, y, item.fort_message().x(), item.fort_message().y(), viewRange, bufferState->gameMap)) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.fort_message().x()), AssistFunction::GridToCell(item.fort_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.fort_message().x()), + AssistFunction::GridToCell(item.fort_message().y()) + ); if (bufferState->mapInfo->fortState.count(pos) == 0) { - bufferState->mapInfo->fortState.emplace(pos, std::make_pair(item.fort_message().team_id(), item.fort_message().hp())); + bufferState->mapInfo->fortState.emplace(pos, std::pair(item.fort_message().team_id(), item.fort_message().hp())); logger->debug("Load Fort!"); } else @@ -565,7 +601,10 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::WormholeMessage: if (AssistFunction::HaveView(x, y, item.wormhole_message().x(), item.wormhole_message().y(), viewRange, bufferState->gameMap)) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.wormhole_message().x()), AssistFunction::GridToCell(item.wormhole_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.wormhole_message().x()), + AssistFunction::GridToCell(item.wormhole_message().y()) + ); if (bufferState->mapInfo->wormholeState.count(pos) == 0) { bufferState->mapInfo->wormholeState.emplace(pos, item.wormhole_message().hp()); @@ -581,7 +620,10 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::ResourceMessage: if (AssistFunction::HaveView(x, y, item.resource_message().x(), item.resource_message().y(), viewRange, bufferState->gameMap)) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.resource_message().x()), AssistFunction::GridToCell(item.resource_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.resource_message().x()), + AssistFunction::GridToCell(item.resource_message().y()) + ); if (bufferState->mapInfo->resourceState.count(pos) == 0) { bufferState->mapInfo->resourceState.emplace(pos, item.resource_message().progress()); @@ -596,17 +638,17 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) break; case THUAI7::MessageOfObj::NewsMessage: { - auto news = item.news_message(); + auto& news = item.news_message(); if (news.to_id() == playerID && news.team_id() == teamID) { if (Proto2THUAI7::newsTypeDict[news.news_case()] == THUAI7::NewsType::TextMessage) { - messageQueue.emplace(std::make_pair(news.from_id(), news.text_message())); + messageQueue.emplace(std::pair(news.from_id(), news.text_message())); logger->debug("Load Text News!"); } else if (Proto2THUAI7::newsTypeDict[news.news_case()] == THUAI7::NewsType::BinaryMessage) { - messageQueue.emplace(std::make_pair(news.from_id(), news.binary_message())); + messageQueue.emplace(std::pair(news.from_id(), news.binary_message())); logger->debug("Load Binary News!"); } else @@ -643,10 +685,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::HomeMessage: if (item.home_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.home_message().x()), AssistFunction::GridToCell(item.home_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.home_message().x()), + AssistFunction::GridToCell(item.home_message().y()) + ); if (bufferState->mapInfo->homeState.count(pos) == 0) { - bufferState->mapInfo->homeState.emplace(pos, std::make_pair(item.home_message().team_id(), item.home_message().hp())); + bufferState->mapInfo->homeState.emplace(pos, std::pair(item.home_message().team_id(), item.home_message().hp())); logger->debug("Load Home!"); } else @@ -657,10 +702,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (HaveOverView(item.home_message().x(), item.home_message().y())) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.home_message().x()), AssistFunction::GridToCell(item.home_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.home_message().x()), + AssistFunction::GridToCell(item.home_message().y()) + ); if (bufferState->mapInfo->homeState.count(pos) == 0) { - bufferState->mapInfo->homeState.emplace(pos, std::make_pair(item.home_message().team_id(), item.home_message().hp())); + bufferState->mapInfo->homeState.emplace(pos, std::pair(item.home_message().team_id(), item.home_message().hp())); logger->debug("Load Home!"); } else @@ -673,10 +721,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::FactoryMessage: if (item.factory_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.factory_message().x()), AssistFunction::GridToCell(item.factory_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.factory_message().x()), + AssistFunction::GridToCell(item.factory_message().y()) + ); if (bufferState->mapInfo->factoryState.count(pos) == 0) { - bufferState->mapInfo->factoryState.emplace(pos, std::make_pair(item.factory_message().team_id(), item.factory_message().hp())); + bufferState->mapInfo->factoryState.emplace(pos, std::pair(item.factory_message().team_id(), item.factory_message().hp())); logger->debug("Load Factory!"); } else @@ -688,10 +739,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (HaveOverView(item.factory_message().x(), item.factory_message().y())) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.factory_message().x()), AssistFunction::GridToCell(item.factory_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.factory_message().x()), + AssistFunction::GridToCell(item.factory_message().y()) + ); if (bufferState->mapInfo->factoryState.count(pos) == 0) { - bufferState->mapInfo->factoryState.emplace(pos, std::make_pair(item.factory_message().team_id(), item.factory_message().hp())); + bufferState->mapInfo->factoryState.emplace(pos, std::pair(item.factory_message().team_id(), item.factory_message().hp())); logger->debug("Load Factory!"); } else @@ -705,10 +759,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::CommunityMessage: if (item.community_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.community_message().x()), AssistFunction::GridToCell(item.community_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.community_message().x()), + AssistFunction::GridToCell(item.community_message().y()) + ); if (bufferState->mapInfo->communityState.count(pos) == 0) { - bufferState->mapInfo->communityState.emplace(pos, std::make_pair(item.community_message().team_id(), item.community_message().hp())); + bufferState->mapInfo->communityState.emplace(pos, std::pair(item.community_message().team_id(), item.community_message().hp())); logger->debug("Load Community!"); } else @@ -720,10 +777,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (HaveOverView(item.community_message().x(), item.community_message().y())) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.community_message().x()), AssistFunction::GridToCell(item.community_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.community_message().x()), + AssistFunction::GridToCell(item.community_message().y()) + ); if (bufferState->mapInfo->communityState.count(pos) == 0) { - bufferState->mapInfo->communityState.emplace(pos, std::make_pair(item.community_message().team_id(), item.community_message().hp())); + bufferState->mapInfo->communityState.emplace(pos, std::pair(item.community_message().team_id(), item.community_message().hp())); logger->debug("Load Community!"); } else @@ -737,10 +797,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::FortMessage: if (item.fort_message().team_id() == teamID) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.fort_message().x()), AssistFunction::GridToCell(item.fort_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.fort_message().x()), + AssistFunction::GridToCell(item.fort_message().y()) + ); if (bufferState->mapInfo->fortState.count(pos) == 0) { - bufferState->mapInfo->fortState.emplace(pos, std::make_pair(item.fort_message().team_id(), item.fort_message().hp())); + bufferState->mapInfo->fortState.emplace(pos, std::pair(item.fort_message().team_id(), item.fort_message().hp())); logger->debug("Load Fort!"); } else @@ -752,10 +815,13 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) } else if (HaveOverView(item.fort_message().x(), item.fort_message().y())) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.fort_message().x()), AssistFunction::GridToCell(item.fort_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.fort_message().x()), + AssistFunction::GridToCell(item.fort_message().y()) + ); if (bufferState->mapInfo->fortState.count(pos) == 0) { - bufferState->mapInfo->fortState.emplace(pos, std::make_pair(item.fort_message().team_id(), item.fort_message().hp())); + bufferState->mapInfo->fortState.emplace(pos, std::pair(item.fort_message().team_id(), item.fort_message().hp())); logger->debug("Load Fort!"); } else @@ -769,7 +835,10 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::WormholeMessage: if (HaveOverView(item.wormhole_message().x(), item.wormhole_message().y())) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.wormhole_message().x()), AssistFunction::GridToCell(item.wormhole_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.wormhole_message().x()), + AssistFunction::GridToCell(item.wormhole_message().y()) + ); if (bufferState->mapInfo->wormholeState.count(pos) == 0) { bufferState->mapInfo->wormholeState.emplace(pos, item.wormhole_message().hp()); @@ -785,7 +854,10 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::ResourceMessage: if (HaveOverView(item.resource_message().x(), item.resource_message().y())) { - auto pos = std::make_pair(AssistFunction::GridToCell(item.resource_message().x()), AssistFunction::GridToCell(item.resource_message().y())); + auto pos = THUAI7::cellxy_t( + AssistFunction::GridToCell(item.resource_message().x()), + AssistFunction::GridToCell(item.resource_message().y()) + ); if (bufferState->mapInfo->resourceState.count(pos) == 0) { bufferState->mapInfo->resourceState.emplace(pos, item.resource_message().progress()); @@ -801,15 +873,15 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) case THUAI7::MessageOfObj::NewsMessage: if (item.news_message().team_id() == teamID && item.news_message().to_id() == playerID) { - auto news = item.news_message(); + auto& news = item.news_message(); if (Proto2THUAI7::newsTypeDict[news.news_case()] == THUAI7::NewsType::TextMessage) { - messageQueue.emplace(std::make_pair(news.from_id(), news.text_message())); + messageQueue.emplace(std::pair(news.from_id(), news.text_message())); logger->debug("Load Text News!"); } else if (Proto2THUAI7::newsTypeDict[news.news_case()] == THUAI7::NewsType::BinaryMessage) { - messageQueue.emplace(std::make_pair(news.from_id(), news.binary_message())); + messageQueue.emplace(std::pair(news.from_id(), news.binary_message())); logger->debug("Load Binary News!"); } else diff --git a/CAPI/cpp/proto/Message2Clients.pb.cc b/CAPI/cpp/proto/Message2Clients.pb.cc index 80594d18..3e1fedbb 100644 --- a/CAPI/cpp/proto/Message2Clients.pb.cc +++ b/CAPI/cpp/proto/Message2Clients.pb.cc @@ -158,7 +158,7 @@ namespace protobuf ::_pbi::ConstantInitialized ) : _impl_{ - /*decltype(_impl_.x_)*/ 0, /*decltype(_impl_.y_)*/ 0, /*decltype(_impl_.hp_)*/ 0, /*decltype(_impl_._cached_size_)*/ {}} + /*decltype(_impl_.x_)*/ 0, /*decltype(_impl_.y_)*/ 0, /*decltype(_impl_.hp_)*/ 0, /*decltype(_impl_.id_)*/ 0, /*decltype(_impl_._cached_size_)*/ {}} { } struct MessageOfWormholeDefaultTypeInternal @@ -374,6 +374,28 @@ namespace protobuf }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MoveResDefaultTypeInternal _MoveRes_default_instance_; + PROTOBUF_CONSTEXPR BuildShipRes::BuildShipRes( + ::_pbi::ConstantInitialized + ) : + _impl_{ + /*decltype(_impl_.player_id_)*/ int64_t{0}, /*decltype(_impl_.act_success_)*/ false, /*decltype(_impl_._cached_size_)*/ {}} + { + } + struct BuildShipResDefaultTypeInternal + { + PROTOBUF_CONSTEXPR BuildShipResDefaultTypeInternal() : + _instance(::_pbi::ConstantInitialized{}) + { + } + ~BuildShipResDefaultTypeInternal() + { + } + union + { + BuildShipRes _instance; + }; + }; + PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BuildShipResDefaultTypeInternal _BuildShipRes_default_instance_; PROTOBUF_CONSTEXPR BoolRes::BoolRes( ::_pbi::ConstantInitialized ) : @@ -463,7 +485,7 @@ namespace protobuf }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MessageOfNewsDefaultTypeInternal _MessageOfNews_default_instance_; } // namespace protobuf -static ::_pb::Metadata file_level_metadata_Message2Clients_2eproto[20]; +static ::_pb::Metadata file_level_metadata_Message2Clients_2eproto[21]; static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_Message2Clients_2eproto = nullptr; static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_Message2Clients_2eproto = nullptr; @@ -558,6 +580,7 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfWormhole, _impl_.x_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfWormhole, _impl_.y_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfWormhole, _impl_.hp_), + PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfWormhole, _impl_.id_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfResource, _internal_metadata_), ~0u, // no _extensions_ @@ -654,6 +677,14 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V PROTOBUF_FIELD_OFFSET(::protobuf::MoveRes, _impl_.actual_angle_), PROTOBUF_FIELD_OFFSET(::protobuf::MoveRes, _impl_.act_success_), ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::protobuf::BuildShipRes, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::protobuf::BuildShipRes, _impl_.act_success_), + PROTOBUF_FIELD_OFFSET(::protobuf::BuildShipRes, _impl_.player_id_), + ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::protobuf::BoolRes, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -695,19 +726,20 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode {61, -1, -1, sizeof(::protobuf::MessageOfCommunity)}, {71, -1, -1, sizeof(::protobuf::MessageOfFort)}, {81, -1, -1, sizeof(::protobuf::MessageOfWormhole)}, - {90, -1, -1, sizeof(::protobuf::MessageOfResource)}, - {99, -1, -1, sizeof(::protobuf::MessageOfHome)}, - {109, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, - {116, -1, -1, sizeof(::protobuf::MessageOfMap)}, - {125, -1, -1, sizeof(::protobuf::MessageOfTeam)}, - {135, -1, -1, sizeof(::protobuf::MessageOfObj)}, - {154, -1, -1, sizeof(::protobuf::MessageOfAll)}, - {167, -1, -1, sizeof(::protobuf::MessageToClient)}, - {176, -1, -1, sizeof(::protobuf::MoveRes)}, - {185, -1, -1, sizeof(::protobuf::BoolRes)}, - {192, -1, -1, sizeof(::protobuf::ShipInfoRes)}, - {199, -1, -1, sizeof(::protobuf::EcoRes)}, - {206, -1, -1, sizeof(::protobuf::MessageOfNews)}, + {91, -1, -1, sizeof(::protobuf::MessageOfResource)}, + {100, -1, -1, sizeof(::protobuf::MessageOfHome)}, + {110, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, + {117, -1, -1, sizeof(::protobuf::MessageOfMap)}, + {126, -1, -1, sizeof(::protobuf::MessageOfTeam)}, + {136, -1, -1, sizeof(::protobuf::MessageOfObj)}, + {155, -1, -1, sizeof(::protobuf::MessageOfAll)}, + {168, -1, -1, sizeof(::protobuf::MessageToClient)}, + {177, -1, -1, sizeof(::protobuf::MoveRes)}, + {186, -1, -1, sizeof(::protobuf::BuildShipRes)}, + {194, -1, -1, sizeof(::protobuf::BoolRes)}, + {201, -1, -1, sizeof(::protobuf::ShipInfoRes)}, + {208, -1, -1, sizeof(::protobuf::EcoRes)}, + {215, -1, -1, sizeof(::protobuf::MessageOfNews)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -727,6 +759,7 @@ static const ::_pb::Message* const file_default_instances[] = { &::protobuf::_MessageOfAll_default_instance_._instance, &::protobuf::_MessageToClient_default_instance_._instance, &::protobuf::_MoveRes_default_instance_._instance, + &::protobuf::_BuildShipRes_default_instance_._instance, &::protobuf::_BoolRes_default_instance_._instance, &::protobuf::_ShipInfoRes_default_instance_._instance, &::protobuf::_EcoRes_default_instance_._instance, @@ -761,50 +794,52 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ "\"G\n\022MessageOfCommunity\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002" " \001(\005\022\n\n\002hp\030\003 \001(\005\022\017\n\007team_id\030\004 \001(\003\"B\n\rMes" "sageOfFort\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022\n\n\002hp\030\003" - " \001(\005\022\017\n\007team_id\030\004 \001(\003\"5\n\021MessageOfWormho" - "le\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022\n\n\002hp\030\003 \001(\005\";\n\021" - "MessageOfResource\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022" - "\020\n\010progress\030\003 \001(\005\"B\n\rMessageOfHome\022\t\n\001x\030" - "\001 \001(\005\022\t\n\001y\030\002 \001(\005\022\n\n\002hp\030\003 \001(\005\022\017\n\007team_id\030" - "\004 \001(\003\"\201\001\n\014MessageOfMap\022\016\n\006height\030\001 \001(\r\022\r" - "\n\005width\030\002 \001(\r\022(\n\004rows\030\003 \003(\0132\032.protobuf.M" - "essageOfMap.Row\032(\n\003Row\022!\n\004cols\030\001 \003(\0162\023.p" - "rotobuf.PlaceType\"R\n\rMessageOfTeam\022\017\n\007te" - "am_id\030\001 \001(\003\022\021\n\tplayer_id\030\002 \001(\003\022\r\n\005score\030" - "\003 \001(\003\022\016\n\006energy\030\004 \001(\003\"\237\005\n\014MessageOfObj\022/" - "\n\014ship_message\030\001 \001(\0132\027.protobuf.MessageO" - "fShipH\000\0223\n\016bullet_message\030\002 \001(\0132\031.protob" - "uf.MessageOfBulletH\000\0225\n\017factory_message\030" - "\003 \001(\0132\032.protobuf.MessageOfFactoryH\000\0229\n\021c" - "ommunity_message\030\004 \001(\0132\034.protobuf.Messag" - "eOfCommunityH\000\022/\n\014fort_message\030\005 \001(\0132\027.p" - "rotobuf.MessageOfFortH\000\0227\n\020wormhole_mess" - "age\030\006 \001(\0132\033.protobuf.MessageOfWormholeH\000" - "\022/\n\014home_message\030\007 \001(\0132\027.protobuf.Messag" - "eOfHomeH\000\0227\n\020resource_message\030\010 \001(\0132\033.pr" - "otobuf.MessageOfResourceH\000\022-\n\013map_messag" - "e\030\t \001(\0132\026.protobuf.MessageOfMapH\000\022/\n\014new" - "s_message\030\n \001(\0132\027.protobuf.MessageOfNews" - "H\000\022@\n\025bombed_bullet_message\030\013 \001(\0132\037.prot" - "obuf.MessageOfBombedBulletH\000\022/\n\014team_mes" - "sage\030\014 \001(\0132\027.protobuf.MessageOfTeamH\000B\020\n" - "\016message_of_obj\"\260\001\n\014MessageOfAll\022\021\n\tgame" - "_time\030\001 \001(\005\022\026\n\016red_team_score\030\002 \001(\005\022\027\n\017b" - "lue_team_score\030\003 \001(\005\022\027\n\017red_team_energy\030" - "\004 \001(\005\022\030\n\020blue_team_energy\030\005 \001(\005\022\023\n\013red_h" - "ome_hp\030\006 \001(\005\022\024\n\014blue_home_hp\030\007 \001(\005\"\224\001\n\017M" - "essageToClient\022+\n\013obj_message\030\001 \003(\0132\026.pr" - "otobuf.MessageOfObj\022\'\n\ngame_state\030\002 \001(\0162" - "\023.protobuf.GameState\022+\n\013all_message\030\003 \001(" - "\0132\026.protobuf.MessageOfAll\"J\n\007MoveRes\022\024\n\014" - "actual_speed\030\001 \001(\003\022\024\n\014actual_angle\030\002 \001(\001" - "\022\023\n\013act_success\030\003 \001(\010\"\036\n\007BoolRes\022\023\n\013act_" - "success\030\001 \001(\010\"9\n\013ShipInfoRes\022*\n\tship_inf" - "o\030\001 \003(\0132\027.protobuf.MessageOfShip\"\031\n\006EcoR" - "es\022\017\n\007economy\030\001 \001(\003\"z\n\rMessageOfNews\022\026\n\014" - "text_message\030\001 \001(\tH\000\022\030\n\016binary_message\030\002" - " \001(\014H\000\022\017\n\007from_id\030\003 \001(\003\022\r\n\005to_id\030\004 \001(\003\022\017" - "\n\007team_id\030\005 \001(\003B\006\n\004newsb\006proto3"; + " \001(\005\022\017\n\007team_id\030\004 \001(\003\"A\n\021MessageOfWormho" + "le\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022\n\n\002hp\030\003 \001(\005\022\n\n\002" + "id\030\004 \001(\005\";\n\021MessageOfResource\022\t\n\001x\030\001 \001(\005" + "\022\t\n\001y\030\002 \001(\005\022\020\n\010progress\030\003 \001(\005\"B\n\rMessage" + "OfHome\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022\n\n\002hp\030\003 \001(\005" + "\022\017\n\007team_id\030\004 \001(\003\"\201\001\n\014MessageOfMap\022\016\n\006he" + "ight\030\001 \001(\r\022\r\n\005width\030\002 \001(\r\022(\n\004rows\030\003 \003(\0132" + "\032.protobuf.MessageOfMap.Row\032(\n\003Row\022!\n\004co" + "ls\030\001 \003(\0162\023.protobuf.PlaceType\"R\n\rMessage" + "OfTeam\022\017\n\007team_id\030\001 \001(\003\022\021\n\tplayer_id\030\002 \001" + "(\003\022\r\n\005score\030\003 \001(\003\022\016\n\006energy\030\004 \001(\003\"\237\005\n\014Me" + "ssageOfObj\022/\n\014ship_message\030\001 \001(\0132\027.proto" + "buf.MessageOfShipH\000\0223\n\016bullet_message\030\002 " + "\001(\0132\031.protobuf.MessageOfBulletH\000\0225\n\017fact" + "ory_message\030\003 \001(\0132\032.protobuf.MessageOfFa" + "ctoryH\000\0229\n\021community_message\030\004 \001(\0132\034.pro" + "tobuf.MessageOfCommunityH\000\022/\n\014fort_messa" + "ge\030\005 \001(\0132\027.protobuf.MessageOfFortH\000\0227\n\020w" + "ormhole_message\030\006 \001(\0132\033.protobuf.Message" + "OfWormholeH\000\022/\n\014home_message\030\007 \001(\0132\027.pro" + "tobuf.MessageOfHomeH\000\0227\n\020resource_messag" + "e\030\010 \001(\0132\033.protobuf.MessageOfResourceH\000\022-" + "\n\013map_message\030\t \001(\0132\026.protobuf.MessageOf" + "MapH\000\022/\n\014news_message\030\n \001(\0132\027.protobuf.M" + "essageOfNewsH\000\022@\n\025bombed_bullet_message\030" + "\013 \001(\0132\037.protobuf.MessageOfBombedBulletH\000" + "\022/\n\014team_message\030\014 \001(\0132\027.protobuf.Messag" + "eOfTeamH\000B\020\n\016message_of_obj\"\260\001\n\014MessageO" + "fAll\022\021\n\tgame_time\030\001 \001(\005\022\026\n\016red_team_scor" + "e\030\002 \001(\005\022\027\n\017blue_team_score\030\003 \001(\005\022\027\n\017red_" + "team_energy\030\004 \001(\005\022\030\n\020blue_team_energy\030\005 " + "\001(\005\022\023\n\013red_home_hp\030\006 \001(\005\022\024\n\014blue_home_hp" + "\030\007 \001(\005\"\224\001\n\017MessageToClient\022+\n\013obj_messag" + "e\030\001 \003(\0132\026.protobuf.MessageOfObj\022\'\n\ngame_" + "state\030\002 \001(\0162\023.protobuf.GameState\022+\n\013all_" + "message\030\003 \001(\0132\026.protobuf.MessageOfAll\"J\n" + "\007MoveRes\022\024\n\014actual_speed\030\001 \001(\003\022\024\n\014actual" + "_angle\030\002 \001(\001\022\023\n\013act_success\030\003 \001(\010\"6\n\014Bui" + "ldShipRes\022\023\n\013act_success\030\001 \001(\010\022\021\n\tplayer" + "_id\030\002 \001(\003\"\036\n\007BoolRes\022\023\n\013act_success\030\001 \001(" + "\010\"9\n\013ShipInfoRes\022*\n\tship_info\030\001 \003(\0132\027.pr" + "otobuf.MessageOfShip\"\031\n\006EcoRes\022\017\n\007econom" + "y\030\001 \001(\003\"z\n\rMessageOfNews\022\026\n\014text_message" + "\030\001 \001(\tH\000\022\030\n\016binary_message\030\002 \001(\014H\000\022\017\n\007fr" + "om_id\030\003 \001(\003\022\r\n\005to_id\030\004 \001(\003\022\017\n\007team_id\030\005 " + "\001(\003B\006\n\004newsb\006proto3"; static const ::_pbi::DescriptorTable* const descriptor_table_Message2Clients_2eproto_deps[1] = { &::descriptor_table_MessageType_2eproto, }; @@ -812,13 +847,13 @@ static ::_pbi::once_flag descriptor_table_Message2Clients_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_Message2Clients_2eproto = { false, false, - 2831, + 2899, descriptor_table_protodef_Message2Clients_2eproto, "Message2Clients.proto", &descriptor_table_Message2Clients_2eproto_once, descriptor_table_Message2Clients_2eproto_deps, 1, - 20, + 21, schemas, file_default_instances, TableStruct_Message2Clients_2eproto::offsets, @@ -3288,10 +3323,10 @@ namespace protobuf MessageOfWormhole* const _this = this; (void)_this; new (&_impl_) Impl_{ - decltype(_impl_.x_){}, decltype(_impl_.y_){}, decltype(_impl_.hp_){}, /*decltype(_impl_._cached_size_)*/ {}}; + decltype(_impl_.x_){}, decltype(_impl_.y_){}, decltype(_impl_.hp_){}, decltype(_impl_.id_){}, /*decltype(_impl_._cached_size_)*/ {}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - ::memcpy(&_impl_.x_, &from._impl_.x_, static_cast(reinterpret_cast(&_impl_.hp_) - reinterpret_cast(&_impl_.x_)) + sizeof(_impl_.hp_)); + ::memcpy(&_impl_.x_, &from._impl_.x_, static_cast(reinterpret_cast(&_impl_.id_) - reinterpret_cast(&_impl_.x_)) + sizeof(_impl_.id_)); // @@protoc_insertion_point(copy_constructor:protobuf.MessageOfWormhole) } @@ -3302,7 +3337,7 @@ namespace protobuf (void)arena; (void)is_message_owned; new (&_impl_) Impl_{ - decltype(_impl_.x_){0}, decltype(_impl_.y_){0}, decltype(_impl_.hp_){0}, /*decltype(_impl_._cached_size_)*/ {}}; + decltype(_impl_.x_){0}, decltype(_impl_.y_){0}, decltype(_impl_.hp_){0}, decltype(_impl_.id_){0}, /*decltype(_impl_._cached_size_)*/ {}}; } MessageOfWormhole::~MessageOfWormhole() @@ -3333,7 +3368,7 @@ namespace protobuf // Prevent compiler warnings about cached_has_bits being unused (void)cached_has_bits; - ::memset(&_impl_.x_, 0, static_cast(reinterpret_cast(&_impl_.hp_) - reinterpret_cast(&_impl_.x_)) + sizeof(_impl_.hp_)); + ::memset(&_impl_.x_, 0, static_cast(reinterpret_cast(&_impl_.id_) - reinterpret_cast(&_impl_.x_)) + sizeof(_impl_.id_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -3378,6 +3413,16 @@ namespace protobuf else goto handle_unusual; continue; + // int32 id = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) + { + _impl_.id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -3433,6 +3478,13 @@ namespace protobuf target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_hp(), target); } + // int32 id = 4; + if (this->_internal_id() != 0) + { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray(4, this->_internal_id(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -3470,6 +3522,12 @@ namespace protobuf total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_hp()); } + // int32 id = 4; + if (this->_internal_id() != 0) + { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_id()); + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -3502,6 +3560,10 @@ namespace protobuf { _this->_internal_set_hp(from._internal_hp()); } + if (from._internal_id() != 0) + { + _this->_internal_set_id(from._internal_id()); + } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -3524,7 +3586,7 @@ namespace protobuf using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(MessageOfWormhole, _impl_.hp_) + sizeof(MessageOfWormhole::_impl_.hp_) - PROTOBUF_FIELD_OFFSET(MessageOfWormhole, _impl_.x_)>( + PROTOBUF_FIELD_OFFSET(MessageOfWormhole, _impl_.id_) + sizeof(MessageOfWormhole::_impl_.id_) - PROTOBUF_FIELD_OFFSET(MessageOfWormhole, _impl_.x_)>( reinterpret_cast(&_impl_.x_), reinterpret_cast(&other->_impl_.x_) ); @@ -6971,6 +7033,247 @@ namespace protobuf // =================================================================== + class BuildShipRes::_Internal + { + public: + }; + + BuildShipRes::BuildShipRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : + ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) + { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:protobuf.BuildShipRes) + } + BuildShipRes::BuildShipRes(const BuildShipRes& from) : + ::PROTOBUF_NAMESPACE_ID::Message() + { + BuildShipRes* const _this = this; + (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.player_id_){}, decltype(_impl_.act_success_){}, /*decltype(_impl_._cached_size_)*/ {}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&_impl_.player_id_, &from._impl_.player_id_, static_cast(reinterpret_cast(&_impl_.act_success_) - reinterpret_cast(&_impl_.player_id_)) + sizeof(_impl_.act_success_)); + // @@protoc_insertion_point(copy_constructor:protobuf.BuildShipRes) + } + + inline void BuildShipRes::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned + ) + { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.player_id_){int64_t{0}}, decltype(_impl_.act_success_){false}, /*decltype(_impl_._cached_size_)*/ {}}; + } + + BuildShipRes::~BuildShipRes() + { + // @@protoc_insertion_point(destructor:protobuf.BuildShipRes) + if (auto* arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) + { + (void)arena; + return; + } + SharedDtor(); + } + + inline void BuildShipRes::SharedDtor() + { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + } + + void BuildShipRes::SetCachedSize(int size) const + { + _impl_._cached_size_.Set(size); + } + + void BuildShipRes::Clear() + { + // @@protoc_insertion_point(message_clear_start:protobuf.BuildShipRes) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + ::memset(&_impl_.player_id_, 0, static_cast(reinterpret_cast(&_impl_.act_success_) - reinterpret_cast(&_impl_.player_id_)) + sizeof(_impl_.act_success_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + const char* BuildShipRes::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) + { +#define CHK_(x) \ + if (PROTOBUF_PREDICT_FALSE(!(x))) \ + goto failure + while (!ctx->Done(&ptr)) + { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) + { + // bool act_success = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) + { + _impl_.act_success_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + // int64 player_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) + { + _impl_.player_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) + { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, + ctx + ); + CHK_(ptr != nullptr); + } // while + message_done: + return ptr; + failure: + ptr = nullptr; + goto message_done; +#undef CHK_ + } + + uint8_t* BuildShipRes::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream + ) const + { + // @@protoc_insertion_point(serialize_to_array_start:protobuf.BuildShipRes) + uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // bool act_success = 1; + if (this->_internal_act_success() != 0) + { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray(1, this->_internal_act_success(), target); + } + + // int64 player_id = 2; + if (this->_internal_player_id() != 0) + { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(2, this->_internal_player_id(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) + { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream + ); + } + // @@protoc_insertion_point(serialize_to_array_end:protobuf.BuildShipRes) + return target; + } + + size_t BuildShipRes::ByteSizeLong() const + { + // @@protoc_insertion_point(message_byte_size_start:protobuf.BuildShipRes) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + // int64 player_id = 2; + if (this->_internal_player_id() != 0) + { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_player_id()); + } + + // bool act_success = 1; + if (this->_internal_act_success() != 0) + { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); + } + + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BuildShipRes::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + BuildShipRes::MergeImpl}; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData* BuildShipRes::GetClassData() const + { + return &_class_data_; + } + + void BuildShipRes::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) + { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:protobuf.BuildShipRes) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + if (from._internal_player_id() != 0) + { + _this->_internal_set_player_id(from._internal_player_id()); + } + if (from._internal_act_success() != 0) + { + _this->_internal_set_act_success(from._internal_act_success()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + } + + void BuildShipRes::CopyFrom(const BuildShipRes& from) + { + // @@protoc_insertion_point(class_specific_copy_from_start:protobuf.BuildShipRes) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool BuildShipRes::IsInitialized() const + { + return true; + } + + void BuildShipRes::InternalSwap(BuildShipRes* other) + { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(BuildShipRes, _impl_.act_success_) + sizeof(BuildShipRes::_impl_.act_success_) - PROTOBUF_FIELD_OFFSET(BuildShipRes, _impl_.player_id_)>( + reinterpret_cast(&_impl_.player_id_), + reinterpret_cast(&other->_impl_.player_id_) + ); + } + + ::PROTOBUF_NAMESPACE_ID::Metadata BuildShipRes::GetMetadata() const + { + return ::_pbi::AssignDescriptors( + &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[16] + ); + } + + // =================================================================== + class BoolRes::_Internal { public: @@ -7175,7 +7478,7 @@ namespace protobuf ::PROTOBUF_NAMESPACE_ID::Metadata BoolRes::GetMetadata() const { return ::_pbi::AssignDescriptors( - &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[16] + &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[17] ); } @@ -7395,7 +7698,7 @@ namespace protobuf ::PROTOBUF_NAMESPACE_ID::Metadata ShipInfoRes::GetMetadata() const { return ::_pbi::AssignDescriptors( - &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[17] + &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[18] ); } @@ -7605,7 +7908,7 @@ namespace protobuf ::PROTOBUF_NAMESPACE_ID::Metadata EcoRes::GetMetadata() const { return ::_pbi::AssignDescriptors( - &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[18] + &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[19] ); } @@ -8006,7 +8309,7 @@ namespace protobuf ::PROTOBUF_NAMESPACE_ID::Metadata MessageOfNews::GetMetadata() const { return ::_pbi::AssignDescriptors( - &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[19] + &descriptor_table_Message2Clients_2eproto_getter, &descriptor_table_Message2Clients_2eproto_once, file_level_metadata_Message2Clients_2eproto[20] ); } @@ -8110,6 +8413,12 @@ PROTOBUF_NOINLINE ::protobuf::MoveRes* return Arena::CreateMessageInternal<::protobuf::MoveRes>(arena); } template<> +PROTOBUF_NOINLINE ::protobuf::BuildShipRes* + Arena::CreateMaybeMessage<::protobuf::BuildShipRes>(Arena* arena) +{ + return Arena::CreateMessageInternal<::protobuf::BuildShipRes>(arena); +} +template<> PROTOBUF_NOINLINE ::protobuf::BoolRes* Arena::CreateMaybeMessage<::protobuf::BoolRes>(Arena* arena) { diff --git a/CAPI/cpp/proto/Message2Clients.pb.h b/CAPI/cpp/proto/Message2Clients.pb.h index 9215fb35..85b7ee72 100644 --- a/CAPI/cpp/proto/Message2Clients.pb.h +++ b/CAPI/cpp/proto/Message2Clients.pb.h @@ -52,6 +52,9 @@ namespace protobuf class BoolRes; struct BoolResDefaultTypeInternal; extern BoolResDefaultTypeInternal _BoolRes_default_instance_; + class BuildShipRes; + struct BuildShipResDefaultTypeInternal; + extern BuildShipResDefaultTypeInternal _BuildShipRes_default_instance_; class EcoRes; struct EcoResDefaultTypeInternal; extern EcoResDefaultTypeInternal _EcoRes_default_instance_; @@ -114,6 +117,8 @@ PROTOBUF_NAMESPACE_OPEN template<> ::protobuf::BoolRes* Arena::CreateMaybeMessage<::protobuf::BoolRes>(Arena*); template<> +::protobuf::BuildShipRes* Arena::CreateMaybeMessage<::protobuf::BuildShipRes>(Arena*); +template<> ::protobuf::EcoRes* Arena::CreateMaybeMessage<::protobuf::EcoRes>(Arena*); template<> ::protobuf::MessageOfAll* Arena::CreateMaybeMessage<::protobuf::MessageOfAll>(Arena*); @@ -1938,6 +1943,7 @@ namespace protobuf kXFieldNumber = 1, kYFieldNumber = 2, kHpFieldNumber = 3, + kIdFieldNumber = 4, }; // int32 x = 1; void clear_x(); @@ -1968,6 +1974,16 @@ namespace protobuf int32_t _internal_hp() const; void _internal_set_hp(int32_t value); + public: + // int32 id = 4; + void clear_id(); + int32_t id() const; + void set_id(int32_t value); + + private: + int32_t _internal_id() const; + void _internal_set_id(int32_t value); + public: // @@protoc_insertion_point(class_scope:protobuf.MessageOfWormhole) @@ -1983,6 +1999,7 @@ namespace protobuf int32_t x_; int32_t y_; int32_t hp_; + int32_t id_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union @@ -4343,6 +4360,210 @@ namespace protobuf }; // ------------------------------------------------------------------- + class BuildShipRes final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protobuf.BuildShipRes) */ + { + public: + inline BuildShipRes() : + BuildShipRes(nullptr) + { + } + ~BuildShipRes() override; + explicit PROTOBUF_CONSTEXPR BuildShipRes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + BuildShipRes(const BuildShipRes& from); + BuildShipRes(BuildShipRes&& from) noexcept + : + BuildShipRes() + { + *this = ::std::move(from); + } + + inline BuildShipRes& operator=(const BuildShipRes& from) + { + CopyFrom(from); + return *this; + } + inline BuildShipRes& operator=(BuildShipRes&& from) noexcept + { + if (this == &from) + return *this; + if (GetOwningArena() == from.GetOwningArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) + { + InternalSwap(&from); + } + else + { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() + { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() + { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() + { + return default_instance().GetMetadata().reflection; + } + static const BuildShipRes& default_instance() + { + return *internal_default_instance(); + } + static inline const BuildShipRes* internal_default_instance() + { + return reinterpret_cast( + &_BuildShipRes_default_instance_ + ); + } + static constexpr int kIndexInFileMessages = + 16; + + friend void swap(BuildShipRes& a, BuildShipRes& b) + { + a.Swap(&b); + } + inline void Swap(BuildShipRes* other) + { + if (other == this) + return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) + { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) + { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } + else + { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BuildShipRes* other) + { + if (other == this) + return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + BuildShipRes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final + { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const BuildShipRes& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const BuildShipRes& from) + { + BuildShipRes::MergeImpl(*this, from); + } + + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream + ) const final; + int GetCachedSize() const final + { + return _impl_._cached_size_.Get(); + } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(BuildShipRes* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() + { + return "protobuf.BuildShipRes"; + } + + protected: + explicit BuildShipRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); + + public: + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData* GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int + { + kPlayerIdFieldNumber = 2, + kActSuccessFieldNumber = 1, + }; + // int64 player_id = 2; + void clear_player_id(); + int64_t player_id() const; + void set_player_id(int64_t value); + + private: + int64_t _internal_player_id() const; + void _internal_set_player_id(int64_t value); + + public: + // bool act_success = 1; + void clear_act_success(); + bool act_success() const; + void set_act_success(bool value); + + private: + bool _internal_act_success() const; + void _internal_set_act_success(bool value); + + public: + // @@protoc_insertion_point(class_scope:protobuf.BuildShipRes) + + private: + class _Internal; + + template + friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ + { + int64_t player_id_; + bool act_success_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union + { + Impl_ _impl_; + }; + friend struct ::TableStruct_Message2Clients_2eproto; + }; + // ------------------------------------------------------------------- + class BoolRes final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protobuf.BoolRes) */ { @@ -4409,7 +4630,7 @@ namespace protobuf ); } static constexpr int kIndexInFileMessages = - 16; + 17; friend void swap(BoolRes& a, BoolRes& b) { @@ -4601,7 +4822,7 @@ namespace protobuf ); } static constexpr int kIndexInFileMessages = - 17; + 18; friend void swap(ShipInfoRes& a, ShipInfoRes& b) { @@ -4805,7 +5026,7 @@ namespace protobuf ); } static constexpr int kIndexInFileMessages = - 18; + 19; friend void swap(EcoRes& a, EcoRes& b) { @@ -5004,7 +5225,7 @@ namespace protobuf ); } static constexpr int kIndexInFileMessages = - 19; + 20; friend void swap(MessageOfNews& a, MessageOfNews& b) { @@ -6400,6 +6621,30 @@ namespace protobuf // @@protoc_insertion_point(field_set:protobuf.MessageOfWormhole.hp) } + // int32 id = 4; + inline void MessageOfWormhole::clear_id() + { + _impl_.id_ = 0; + } + inline int32_t MessageOfWormhole::_internal_id() const + { + return _impl_.id_; + } + inline int32_t MessageOfWormhole::id() const + { + // @@protoc_insertion_point(field_get:protobuf.MessageOfWormhole.id) + return _internal_id(); + } + inline void MessageOfWormhole::_internal_set_id(int32_t value) + { + _impl_.id_ = value; + } + inline void MessageOfWormhole::set_id(int32_t value) + { + _internal_set_id(value); + // @@protoc_insertion_point(field_set:protobuf.MessageOfWormhole.id) + } + // ------------------------------------------------------------------- // MessageOfResource @@ -8419,6 +8664,58 @@ namespace protobuf // ------------------------------------------------------------------- + // BuildShipRes + + // bool act_success = 1; + inline void BuildShipRes::clear_act_success() + { + _impl_.act_success_ = false; + } + inline bool BuildShipRes::_internal_act_success() const + { + return _impl_.act_success_; + } + inline bool BuildShipRes::act_success() const + { + // @@protoc_insertion_point(field_get:protobuf.BuildShipRes.act_success) + return _internal_act_success(); + } + inline void BuildShipRes::_internal_set_act_success(bool value) + { + _impl_.act_success_ = value; + } + inline void BuildShipRes::set_act_success(bool value) + { + _internal_set_act_success(value); + // @@protoc_insertion_point(field_set:protobuf.BuildShipRes.act_success) + } + + // int64 player_id = 2; + inline void BuildShipRes::clear_player_id() + { + _impl_.player_id_ = int64_t{0}; + } + inline int64_t BuildShipRes::_internal_player_id() const + { + return _impl_.player_id_; + } + inline int64_t BuildShipRes::player_id() const + { + // @@protoc_insertion_point(field_get:protobuf.BuildShipRes.player_id) + return _internal_player_id(); + } + inline void BuildShipRes::_internal_set_player_id(int64_t value) + { + _impl_.player_id_ = value; + } + inline void BuildShipRes::set_player_id(int64_t value) + { + _internal_set_player_id(value); + // @@protoc_insertion_point(field_set:protobuf.BuildShipRes.player_id) + } + + // ------------------------------------------------------------------- + // BoolRes // bool act_success = 1; @@ -8854,6 +9151,8 @@ namespace protobuf // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) } // namespace protobuf diff --git a/CAPI/cpp/proto/Message2Server.pb.cc b/CAPI/cpp/proto/Message2Server.pb.cc index 2c69a5e9..121cb4a5 100644 --- a/CAPI/cpp/proto/Message2Server.pb.cc +++ b/CAPI/cpp/proto/Message2Server.pb.cc @@ -222,7 +222,7 @@ namespace protobuf ::_pbi::ConstantInitialized ) : _impl_{ - /*decltype(_impl_.team_id_)*/ int64_t{0}, /*decltype(_impl_.ship_type_)*/ 0, /*decltype(_impl_.birthpoint_index_)*/ 0, /*decltype(_impl_.player_id_)*/ int64_t{0}, /*decltype(_impl_._cached_size_)*/ {}} + /*decltype(_impl_.team_id_)*/ int64_t{0}, /*decltype(_impl_.ship_type_)*/ 0, /*decltype(_impl_.birthpoint_index_)*/ 0, /*decltype(_impl_._cached_size_)*/ {}} { } struct BuildShipMsgDefaultTypeInternal @@ -335,7 +335,6 @@ const uint32_t TableStruct_Message2Server_2eproto::offsets[] PROTOBUF_SECTION_VA ~0u, // no _inlined_string_donated_ PROTOBUF_FIELD_OFFSET(::protobuf::BuildShipMsg, _impl_.ship_type_), PROTOBUF_FIELD_OFFSET(::protobuf::BuildShipMsg, _impl_.team_id_), - PROTOBUF_FIELD_OFFSET(::protobuf::BuildShipMsg, _impl_.player_id_), PROTOBUF_FIELD_OFFSET(::protobuf::BuildShipMsg, _impl_.birthpoint_index_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { @@ -383,10 +382,10 @@ const char descriptor_table_protodef_Message2Server_2eproto[] PROTOBUF_SECTION_V "overMsg\022\021\n\tplayer_id\030\001 \001(\003\022\017\n\007recover\030\002 " "\001(\003\022\017\n\007team_id\030\003 \001(\003\"[\n\nInstallMsg\022)\n\013mo" "dule_type\030\001 \001(\0162\024.protobuf.ModuleType\022\021\n" - "\tplayer_id\030\002 \001(\003\022\017\n\007team_id\030\003 \001(\003\"s\n\014Bui" + "\tplayer_id\030\002 \001(\003\022\017\n\007team_id\030\003 \001(\003\"`\n\014Bui" "ldShipMsg\022%\n\tship_type\030\001 \001(\0162\022.protobuf." - "ShipType\022\017\n\007team_id\030\002 \001(\003\022\021\n\tplayer_id\030\003" - " \001(\003\022\030\n\020birthpoint_index\030\004 \001(\005b\006proto3"; + "ShipType\022\017\n\007team_id\030\002 \001(\003\022\030\n\020birthpoint_" + "index\030\003 \001(\005b\006proto3"; static const ::_pbi::DescriptorTable* const descriptor_table_Message2Server_2eproto_deps[1] = { &::descriptor_table_MessageType_2eproto, }; @@ -394,7 +393,7 @@ static ::_pbi::once_flag descriptor_table_Message2Server_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_Message2Server_2eproto = { false, false, - 878, + 859, descriptor_table_protodef_Message2Server_2eproto, "Message2Server.proto", &descriptor_table_Message2Server_2eproto_once, @@ -2787,10 +2786,10 @@ namespace protobuf BuildShipMsg* const _this = this; (void)_this; new (&_impl_) Impl_{ - decltype(_impl_.team_id_){}, decltype(_impl_.ship_type_){}, decltype(_impl_.birthpoint_index_){}, decltype(_impl_.player_id_){}, /*decltype(_impl_._cached_size_)*/ {}}; + decltype(_impl_.team_id_){}, decltype(_impl_.ship_type_){}, decltype(_impl_.birthpoint_index_){}, /*decltype(_impl_._cached_size_)*/ {}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - ::memcpy(&_impl_.team_id_, &from._impl_.team_id_, static_cast(reinterpret_cast(&_impl_.player_id_) - reinterpret_cast(&_impl_.team_id_)) + sizeof(_impl_.player_id_)); + ::memcpy(&_impl_.team_id_, &from._impl_.team_id_, static_cast(reinterpret_cast(&_impl_.birthpoint_index_) - reinterpret_cast(&_impl_.team_id_)) + sizeof(_impl_.birthpoint_index_)); // @@protoc_insertion_point(copy_constructor:protobuf.BuildShipMsg) } @@ -2801,7 +2800,7 @@ namespace protobuf (void)arena; (void)is_message_owned; new (&_impl_) Impl_{ - decltype(_impl_.team_id_){int64_t{0}}, decltype(_impl_.ship_type_){0}, decltype(_impl_.birthpoint_index_){0}, decltype(_impl_.player_id_){int64_t{0}}, /*decltype(_impl_._cached_size_)*/ {}}; + decltype(_impl_.team_id_){int64_t{0}}, decltype(_impl_.ship_type_){0}, decltype(_impl_.birthpoint_index_){0}, /*decltype(_impl_._cached_size_)*/ {}}; } BuildShipMsg::~BuildShipMsg() @@ -2832,7 +2831,7 @@ namespace protobuf // Prevent compiler warnings about cached_has_bits being unused (void)cached_has_bits; - ::memset(&_impl_.team_id_, 0, static_cast(reinterpret_cast(&_impl_.player_id_) - reinterpret_cast(&_impl_.team_id_)) + sizeof(_impl_.player_id_)); + ::memset(&_impl_.team_id_, 0, static_cast(reinterpret_cast(&_impl_.birthpoint_index_) - reinterpret_cast(&_impl_.team_id_)) + sizeof(_impl_.birthpoint_index_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -2868,19 +2867,9 @@ namespace protobuf else goto handle_unusual; continue; - // int64 player_id = 3; + // int32 birthpoint_index = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) - { - _impl_.player_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); - CHK_(ptr); - } - else - goto handle_unusual; - continue; - // int32 birthpoint_index = 4; - case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { _impl_.birthpoint_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); @@ -2938,18 +2927,11 @@ namespace protobuf target = ::_pbi::WireFormatLite::WriteInt64ToArray(2, this->_internal_team_id(), target); } - // int64 player_id = 3; - if (this->_internal_player_id() != 0) - { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt64ToArray(3, this->_internal_player_id(), target); - } - - // int32 birthpoint_index = 4; + // int32 birthpoint_index = 3; if (this->_internal_birthpoint_index() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray(4, this->_internal_birthpoint_index(), target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_birthpoint_index(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) @@ -2984,18 +2966,12 @@ namespace protobuf ::_pbi::WireFormatLite::EnumSize(this->_internal_ship_type()); } - // int32 birthpoint_index = 4; + // int32 birthpoint_index = 3; if (this->_internal_birthpoint_index() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_birthpoint_index()); } - // int64 player_id = 3; - if (this->_internal_player_id() != 0) - { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_player_id()); - } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -3028,10 +3004,6 @@ namespace protobuf { _this->_internal_set_birthpoint_index(from._internal_birthpoint_index()); } - if (from._internal_player_id() != 0) - { - _this->_internal_set_player_id(from._internal_player_id()); - } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -3054,7 +3026,7 @@ namespace protobuf using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(BuildShipMsg, _impl_.player_id_) + sizeof(BuildShipMsg::_impl_.player_id_) - PROTOBUF_FIELD_OFFSET(BuildShipMsg, _impl_.team_id_)>( + PROTOBUF_FIELD_OFFSET(BuildShipMsg, _impl_.birthpoint_index_) + sizeof(BuildShipMsg::_impl_.birthpoint_index_) - PROTOBUF_FIELD_OFFSET(BuildShipMsg, _impl_.team_id_)>( reinterpret_cast(&_impl_.team_id_), reinterpret_cast(&other->_impl_.team_id_) ); diff --git a/CAPI/cpp/proto/Message2Server.pb.h b/CAPI/cpp/proto/Message2Server.pb.h index fc227615..706b406f 100644 --- a/CAPI/cpp/proto/Message2Server.pb.h +++ b/CAPI/cpp/proto/Message2Server.pb.h @@ -2218,8 +2218,7 @@ namespace protobuf { kTeamIdFieldNumber = 2, kShipTypeFieldNumber = 1, - kBirthpointIndexFieldNumber = 4, - kPlayerIdFieldNumber = 3, + kBirthpointIndexFieldNumber = 3, }; // int64 team_id = 2; void clear_team_id(); @@ -2241,7 +2240,7 @@ namespace protobuf void _internal_set_ship_type(::protobuf::ShipType value); public: - // int32 birthpoint_index = 4; + // int32 birthpoint_index = 3; void clear_birthpoint_index(); int32_t birthpoint_index() const; void set_birthpoint_index(int32_t value); @@ -2250,16 +2249,6 @@ namespace protobuf int32_t _internal_birthpoint_index() const; void _internal_set_birthpoint_index(int32_t value); - public: - // int64 player_id = 3; - void clear_player_id(); - int64_t player_id() const; - void set_player_id(int64_t value); - - private: - int64_t _internal_player_id() const; - void _internal_set_player_id(int64_t value); - public: // @@protoc_insertion_point(class_scope:protobuf.BuildShipMsg) @@ -2275,7 +2264,6 @@ namespace protobuf int64_t team_id_; int ship_type_; int32_t birthpoint_index_; - int64_t player_id_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union @@ -3164,31 +3152,7 @@ namespace protobuf // @@protoc_insertion_point(field_set:protobuf.BuildShipMsg.team_id) } - // int64 player_id = 3; - inline void BuildShipMsg::clear_player_id() - { - _impl_.player_id_ = int64_t{0}; - } - inline int64_t BuildShipMsg::_internal_player_id() const - { - return _impl_.player_id_; - } - inline int64_t BuildShipMsg::player_id() const - { - // @@protoc_insertion_point(field_get:protobuf.BuildShipMsg.player_id) - return _internal_player_id(); - } - inline void BuildShipMsg::_internal_set_player_id(int64_t value) - { - _impl_.player_id_ = value; - } - inline void BuildShipMsg::set_player_id(int64_t value) - { - _internal_set_player_id(value); - // @@protoc_insertion_point(field_set:protobuf.BuildShipMsg.player_id) - } - - // int32 birthpoint_index = 4; + // int32 birthpoint_index = 3; inline void BuildShipMsg::clear_birthpoint_index() { _impl_.birthpoint_index_ = 0; diff --git a/CAPI/cpp/proto/Services.grpc.pb.cc b/CAPI/cpp/proto/Services.grpc.pb.cc index c1cbfd8b..e79f2928 100644 --- a/CAPI/cpp/proto/Services.grpc.pb.cc +++ b/CAPI/cpp/proto/Services.grpc.pb.cc @@ -31,11 +31,14 @@ namespace protobuf "/protobuf.AvailableService/Produce", "/protobuf.AvailableService/Rebuild", "/protobuf.AvailableService/Construct", + "/protobuf.AvailableService/RepairHome", + "/protobuf.AvailableService/RepairWormhole", "/protobuf.AvailableService/Attack", "/protobuf.AvailableService/Send", "/protobuf.AvailableService/InstallModule", "/protobuf.AvailableService/Recycle", "/protobuf.AvailableService/BuildShip", + "/protobuf.AvailableService/BuildShipRID", "/protobuf.AvailableService/EndAllAction", }; @@ -56,12 +59,15 @@ namespace protobuf rpcmethod_Produce_(AvailableService_method_names[5], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_Rebuild_(AvailableService_method_names[6], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_Construct_(AvailableService_method_names[7], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_Attack_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_Send_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_InstallModule_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_Recycle_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_BuildShip_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_EndAllAction_(AvailableService_method_names[13], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) + rpcmethod_RepairHome_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_RepairWormhole_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_Attack_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_Send_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_InstallModule_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_Recycle_(AvailableService_method_names[13], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_BuildShip_(AvailableService_method_names[14], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_BuildShipRID_(AvailableService_method_names[15], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_EndAllAction_(AvailableService_method_names[16], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) { } @@ -281,6 +287,62 @@ namespace protobuf return result; } + ::grpc::Status AvailableService::Stub::RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) + { + return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_RepairHome_, context, request, response); + } + + void AvailableService::Stub::async::RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function f) + { + ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RepairHome_, context, request, response, std::move(f)); + } + + void AvailableService::Stub::async::RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) + { + ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RepairHome_, context, request, response, reactor); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncRepairHomeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_RepairHome_, context, request); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncRepairHomeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + auto* result = + this->PrepareAsyncRepairHomeRaw(context, request, cq); + result->StartCall(); + return result; + } + + ::grpc::Status AvailableService::Stub::RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) + { + return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_RepairWormhole_, context, request, response); + } + + void AvailableService::Stub::async::RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function f) + { + ::grpc::internal::CallbackUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RepairWormhole_, context, request, response, std::move(f)); + } + + void AvailableService::Stub::async::RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) + { + ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RepairWormhole_, context, request, response, reactor); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncRepairWormholeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BoolRes, ::protobuf::IDMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_RepairWormhole_, context, request); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncRepairWormholeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + auto* result = + this->PrepareAsyncRepairWormholeRaw(context, request, cq); + result->StartCall(); + return result; + } + ::grpc::Status AvailableService::Stub::Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::protobuf::BoolRes* response) { return ::grpc::internal::BlockingUnaryCall<::protobuf::AttackMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Attack_, context, request, response); @@ -421,6 +483,34 @@ namespace protobuf return result; } + ::grpc::Status AvailableService::Stub::BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::protobuf::BuildShipRes* response) + { + return ::grpc::internal::BlockingUnaryCall<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_BuildShipRID_, context, request, response); + } + + void AvailableService::Stub::async::BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response, std::function f) + { + ::grpc::internal::CallbackUnaryCall<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_BuildShipRID_, context, request, response, std::move(f)); + } + + void AvailableService::Stub::async::BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response, ::grpc::ClientUnaryReactor* reactor) + { + ::grpc::internal::ClientCallbackUnaryFactory::Create<::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_BuildShipRID_, context, request, response, reactor); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>* AvailableService::Stub::PrepareAsyncBuildShipRIDRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) + { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create<::protobuf::BuildShipRes, ::protobuf::BuildShipMsg, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_BuildShipRID_, context, request); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>* AvailableService::Stub::AsyncBuildShipRIDRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) + { + auto* result = + this->PrepareAsyncBuildShipRIDRaw(context, request, cq); + result->StartCall(); + return result; + } + ::grpc::Status AvailableService::Stub::EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) { return ::grpc::internal::BlockingUnaryCall<::protobuf::IDMsg, ::protobuf::BoolRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_EndAllAction_, context, request, response); @@ -566,6 +656,34 @@ namespace protobuf AddMethod(new ::grpc::internal::RpcServiceMethod( AvailableService_method_names[8], ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler( + [](AvailableService::Service* service, + ::grpc::ServerContext* ctx, + const ::protobuf::IDMsg* req, + ::protobuf::BoolRes* resp) + { + return service->RepairHome(ctx, req, resp); + }, + this + ) + )); + AddMethod(new ::grpc::internal::RpcServiceMethod( + AvailableService_method_names[9], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler( + [](AvailableService::Service* service, + ::grpc::ServerContext* ctx, + const ::protobuf::IDMsg* req, + ::protobuf::BoolRes* resp) + { + return service->RepairWormhole(ctx, req, resp); + }, + this + ) + )); + AddMethod(new ::grpc::internal::RpcServiceMethod( + AvailableService_method_names[10], + ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, ::grpc::ServerContext* ctx, @@ -578,7 +696,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[9], + AvailableService_method_names[11], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -592,7 +710,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[10], + AvailableService_method_names[12], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -606,7 +724,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[11], + AvailableService_method_names[13], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -620,7 +738,7 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[12], + AvailableService_method_names[14], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -634,7 +752,21 @@ namespace protobuf ) )); AddMethod(new ::grpc::internal::RpcServiceMethod( - AvailableService_method_names[13], + AvailableService_method_names[15], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler( + [](AvailableService::Service* service, + ::grpc::ServerContext* ctx, + const ::protobuf::BuildShipMsg* req, + ::protobuf::BuildShipRes* resp) + { + return service->BuildShipRID(ctx, req, resp); + }, + this + ) + )); + AddMethod(new ::grpc::internal::RpcServiceMethod( + AvailableService_method_names[16], ::grpc::internal::RpcMethod::NORMAL_RPC, new ::grpc::internal::RpcMethodHandler( [](AvailableService::Service* service, @@ -717,6 +849,22 @@ namespace protobuf return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } + ::grpc::Status AvailableService::Service::RepairHome(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + + ::grpc::Status AvailableService::Service::RepairWormhole(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + ::grpc::Status AvailableService::Service::Attack(::grpc::ServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response) { (void)context; @@ -757,6 +905,14 @@ namespace protobuf return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } + ::grpc::Status AvailableService::Service::BuildShipRID(::grpc::ServerContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response) + { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + ::grpc::Status AvailableService::Service::EndAllAction(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) { (void)context; diff --git a/CAPI/cpp/proto/Services.grpc.pb.h b/CAPI/cpp/proto/Services.grpc.pb.h index 3fdff8d0..eee58909 100644 --- a/CAPI/cpp/proto/Services.grpc.pb.h +++ b/CAPI/cpp/proto/Services.grpc.pb.h @@ -125,6 +125,26 @@ namespace protobuf return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncConstructRaw(context, request, cq)); } // 修建建筑 + virtual ::grpc::Status RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncRepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncRepairHomeRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncRepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncRepairHomeRaw(context, request, cq)); + } + // 修理大本营 + virtual ::grpc::Status RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncRepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncRepairWormholeRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncRepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncRepairWormholeRaw(context, request, cq)); + } + // 修理虫洞 virtual ::grpc::Status Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::protobuf::BoolRes* response) = 0; std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncAttack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) { @@ -173,6 +193,15 @@ namespace protobuf { return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncBuildShipRaw(context, request, cq)); } + virtual ::grpc::Status BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::protobuf::BuildShipRes* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BuildShipRes>> AsyncBuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BuildShipRes>>(AsyncBuildShipRIDRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BuildShipRes>> PrepareAsyncBuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BuildShipRes>>(PrepareAsyncBuildShipRIDRaw(context, request, cq)); + } virtual ::grpc::Status EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0; std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncEndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) { @@ -213,6 +242,12 @@ namespace protobuf virtual void Construct(::grpc::ClientContext* context, const ::protobuf::ConstructMsg* request, ::protobuf::BoolRes* response, std::function) = 0; virtual void Construct(::grpc::ClientContext* context, const ::protobuf::ConstructMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; // 修建建筑 + virtual void RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0; + virtual void RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + // 修理大本营 + virtual void RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0; + virtual void RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + // 修理虫洞 virtual void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, std::function) = 0; virtual void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; // 攻击 @@ -226,6 +261,8 @@ namespace protobuf virtual void Recycle(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; virtual void BuildShip(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BoolRes* response, std::function) = 0; virtual void BuildShip(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response, std::function) = 0; + virtual void BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; virtual void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0; virtual void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; // 结束所有动作 @@ -258,6 +295,10 @@ namespace protobuf virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncRebuildRaw(::grpc::ClientContext* context, const ::protobuf::ConstructMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncConstructRaw(::grpc::ClientContext* context, const ::protobuf::ConstructMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncConstructRaw(::grpc::ClientContext* context, const ::protobuf::ConstructMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncRepairHomeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncRepairHomeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncRepairWormholeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncRepairWormholeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncSendRaw(::grpc::ClientContext* context, const ::protobuf::SendMsg& request, ::grpc::CompletionQueue* cq) = 0; @@ -268,6 +309,8 @@ namespace protobuf virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncRecycleRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncBuildShipRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncBuildShipRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BuildShipRes>* AsyncBuildShipRIDRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BuildShipRes>* PrepareAsyncBuildShipRIDRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; }; @@ -350,6 +393,24 @@ namespace protobuf { return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncConstructRaw(context, request, cq)); } + ::grpc::Status RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override; + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncRepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncRepairHomeRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncRepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncRepairHomeRaw(context, request, cq)); + } + ::grpc::Status RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override; + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncRepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncRepairWormholeRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncRepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncRepairWormholeRaw(context, request, cq)); + } ::grpc::Status Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::protobuf::BoolRes* response) override; std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncAttack(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) { @@ -395,6 +456,15 @@ namespace protobuf { return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncBuildShipRaw(context, request, cq)); } + ::grpc::Status BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::protobuf::BuildShipRes* response) override; + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>> AsyncBuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>>(AsyncBuildShipRIDRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>> PrepareAsyncBuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>>(PrepareAsyncBuildShipRIDRaw(context, request, cq)); + } ::grpc::Status EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override; std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncEndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) { @@ -423,6 +493,10 @@ namespace protobuf void Rebuild(::grpc::ClientContext* context, const ::protobuf::ConstructMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void Construct(::grpc::ClientContext* context, const ::protobuf::ConstructMsg* request, ::protobuf::BoolRes* response, std::function) override; void Construct(::grpc::ClientContext* context, const ::protobuf::ConstructMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override; + void RepairHome(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override; + void RepairWormhole(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, std::function) override; void Attack(::grpc::ClientContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void Send(::grpc::ClientContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response, std::function) override; @@ -433,6 +507,8 @@ namespace protobuf void Recycle(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void BuildShip(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BoolRes* response, std::function) override; void BuildShip(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response, std::function) override; + void BuildShipRID(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response, ::grpc::ClientUnaryReactor* reactor) override; void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override; void EndAllAction(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; @@ -476,6 +552,10 @@ namespace protobuf ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncRebuildRaw(::grpc::ClientContext* context, const ::protobuf::ConstructMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncConstructRaw(::grpc::ClientContext* context, const ::protobuf::ConstructMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncConstructRaw(::grpc::ClientContext* context, const ::protobuf::ConstructMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncRepairHomeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncRepairHomeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncRepairWormholeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncRepairWormholeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncAttackRaw(::grpc::ClientContext* context, const ::protobuf::AttackMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncSendRaw(::grpc::ClientContext* context, const ::protobuf::SendMsg& request, ::grpc::CompletionQueue* cq) override; @@ -486,6 +566,8 @@ namespace protobuf ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncRecycleRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncBuildShipRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncBuildShipRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>* AsyncBuildShipRIDRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BuildShipRes>* PrepareAsyncBuildShipRIDRaw(::grpc::ClientContext* context, const ::protobuf::BuildShipMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncEndAllActionRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; const ::grpc::internal::RpcMethod rpcmethod_TryConnection_; @@ -496,11 +578,14 @@ namespace protobuf const ::grpc::internal::RpcMethod rpcmethod_Produce_; const ::grpc::internal::RpcMethod rpcmethod_Rebuild_; const ::grpc::internal::RpcMethod rpcmethod_Construct_; + const ::grpc::internal::RpcMethod rpcmethod_RepairHome_; + const ::grpc::internal::RpcMethod rpcmethod_RepairWormhole_; const ::grpc::internal::RpcMethod rpcmethod_Attack_; const ::grpc::internal::RpcMethod rpcmethod_Send_; const ::grpc::internal::RpcMethod rpcmethod_InstallModule_; const ::grpc::internal::RpcMethod rpcmethod_Recycle_; const ::grpc::internal::RpcMethod rpcmethod_BuildShip_; + const ::grpc::internal::RpcMethod rpcmethod_BuildShipRID_; const ::grpc::internal::RpcMethod rpcmethod_EndAllAction_; }; static std::unique_ptr NewStub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); @@ -527,6 +612,10 @@ namespace protobuf // 给建筑回血 virtual ::grpc::Status Construct(::grpc::ServerContext* context, const ::protobuf::ConstructMsg* request, ::protobuf::BoolRes* response); // 修建建筑 + virtual ::grpc::Status RepairHome(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); + // 修理大本营 + virtual ::grpc::Status RepairWormhole(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); + // 修理虫洞 virtual ::grpc::Status Attack(::grpc::ServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response); // 攻击 virtual ::grpc::Status Send(::grpc::ServerContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response); @@ -535,6 +624,7 @@ namespace protobuf virtual ::grpc::Status InstallModule(::grpc::ServerContext* context, const ::protobuf::InstallMsg* request, ::protobuf::BoolRes* response); virtual ::grpc::Status Recycle(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); virtual ::grpc::Status BuildShip(::grpc::ServerContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BoolRes* response); + virtual ::grpc::Status BuildShipRID(::grpc::ServerContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response); virtual ::grpc::Status EndAllAction(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); // 结束所有动作 }; @@ -763,6 +853,62 @@ namespace protobuf } }; template + class WithAsyncMethod_RepairHome : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithAsyncMethod_RepairHome() + { + ::grpc::Service::MarkMethodAsync(8); + } + ~WithAsyncMethod_RepairHome() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairHome(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRepairHome(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) + { + ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_RepairWormhole : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithAsyncMethod_RepairWormhole() + { + ::grpc::Service::MarkMethodAsync(9); + } + ~WithAsyncMethod_RepairWormhole() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairWormhole(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRepairWormhole(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) + { + ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template class WithAsyncMethod_Attack : public BaseClass { private: @@ -773,7 +919,7 @@ namespace protobuf public: WithAsyncMethod_Attack() { - ::grpc::Service::MarkMethodAsync(8); + ::grpc::Service::MarkMethodAsync(10); } ~WithAsyncMethod_Attack() override { @@ -787,7 +933,7 @@ namespace protobuf } void RequestAttack(::grpc::ServerContext* context, ::protobuf::AttackMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -801,7 +947,7 @@ namespace protobuf public: WithAsyncMethod_Send() { - ::grpc::Service::MarkMethodAsync(9); + ::grpc::Service::MarkMethodAsync(11); } ~WithAsyncMethod_Send() override { @@ -815,7 +961,7 @@ namespace protobuf } void RequestSend(::grpc::ServerContext* context, ::protobuf::SendMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -829,7 +975,7 @@ namespace protobuf public: WithAsyncMethod_InstallModule() { - ::grpc::Service::MarkMethodAsync(10); + ::grpc::Service::MarkMethodAsync(12); } ~WithAsyncMethod_InstallModule() override { @@ -843,7 +989,7 @@ namespace protobuf } void RequestInstallModule(::grpc::ServerContext* context, ::protobuf::InstallMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -857,7 +1003,7 @@ namespace protobuf public: WithAsyncMethod_Recycle() { - ::grpc::Service::MarkMethodAsync(11); + ::grpc::Service::MarkMethodAsync(13); } ~WithAsyncMethod_Recycle() override { @@ -871,7 +1017,7 @@ namespace protobuf } void RequestRecycle(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -885,7 +1031,7 @@ namespace protobuf public: WithAsyncMethod_BuildShip() { - ::grpc::Service::MarkMethodAsync(12); + ::grpc::Service::MarkMethodAsync(14); } ~WithAsyncMethod_BuildShip() override { @@ -899,7 +1045,35 @@ namespace protobuf } void RequestBuildShip(::grpc::ServerContext* context, ::protobuf::BuildShipMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_BuildShipRID : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithAsyncMethod_BuildShipRID() + { + ::grpc::Service::MarkMethodAsync(15); + } + ~WithAsyncMethod_BuildShipRID() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status BuildShipRID(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BuildShipRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestBuildShipRID(::grpc::ServerContext* context, ::protobuf::BuildShipMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BuildShipRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) + { + ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -913,7 +1087,7 @@ namespace protobuf public: WithAsyncMethod_EndAllAction() { - ::grpc::Service::MarkMethodAsync(13); + ::grpc::Service::MarkMethodAsync(16); } ~WithAsyncMethod_EndAllAction() override { @@ -927,10 +1101,10 @@ namespace protobuf } void RequestEndAllAction(::grpc::ServerContext* context, ::protobuf::IDMsg* request, ::grpc::ServerAsyncResponseWriter<::protobuf::BoolRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag); } }; - typedef WithAsyncMethod_TryConnection>>>>>>>>>>>>> AsyncService; + typedef WithAsyncMethod_TryConnection>>>>>>>>>>>>>>>> AsyncService; template class WithCallbackMethod_TryConnection : public BaseClass { @@ -1236,6 +1410,84 @@ namespace protobuf } }; template + class WithCallbackMethod_RepairHome : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithCallbackMethod_RepairHome() + { + ::grpc::Service::MarkMethodCallback(8, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { return this->RepairHome(context, request, response); })); + } + void SetMessageAllocatorFor_RepairHome( + ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator + ) + { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(8); + static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_RepairHome() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairHome(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RepairHome( + ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/ + ) + { + return nullptr; + } + }; + template + class WithCallbackMethod_RepairWormhole : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithCallbackMethod_RepairWormhole() + { + ::grpc::Service::MarkMethodCallback(9, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { return this->RepairWormhole(context, request, response); })); + } + void SetMessageAllocatorFor_RepairWormhole( + ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator + ) + { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(9); + static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_RepairWormhole() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairWormhole(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RepairWormhole( + ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/ + ) + { + return nullptr; + } + }; + template class WithCallbackMethod_Attack : public BaseClass { private: @@ -1246,14 +1498,14 @@ namespace protobuf public: WithCallbackMethod_Attack() { - ::grpc::Service::MarkMethodCallback(8, new ::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response) - { return this->Attack(context, request, response); })); + ::grpc::Service::MarkMethodCallback(10, new ::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::AttackMsg* request, ::protobuf::BoolRes* response) + { return this->Attack(context, request, response); })); } void SetMessageAllocatorFor_Attack( ::grpc::MessageAllocator<::protobuf::AttackMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(8); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(10); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1285,14 +1537,14 @@ namespace protobuf public: WithCallbackMethod_Send() { - ::grpc::Service::MarkMethodCallback(9, new ::grpc::internal::CallbackUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response) - { return this->Send(context, request, response); })); + ::grpc::Service::MarkMethodCallback(11, new ::grpc::internal::CallbackUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::SendMsg* request, ::protobuf::BoolRes* response) + { return this->Send(context, request, response); })); } void SetMessageAllocatorFor_Send( ::grpc::MessageAllocator<::protobuf::SendMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(9); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1324,14 +1576,14 @@ namespace protobuf public: WithCallbackMethod_InstallModule() { - ::grpc::Service::MarkMethodCallback(10, new ::grpc::internal::CallbackUnaryHandler<::protobuf::InstallMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::InstallMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(12, new ::grpc::internal::CallbackUnaryHandler<::protobuf::InstallMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::InstallMsg* request, ::protobuf::BoolRes* response) { return this->InstallModule(context, request, response); })); } void SetMessageAllocatorFor_InstallModule( ::grpc::MessageAllocator<::protobuf::InstallMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(10); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::InstallMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1363,14 +1615,14 @@ namespace protobuf public: WithCallbackMethod_Recycle() { - ::grpc::Service::MarkMethodCallback(11, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(13, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) { return this->Recycle(context, request, response); })); } void SetMessageAllocatorFor_Recycle( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(13); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1402,14 +1654,14 @@ namespace protobuf public: WithCallbackMethod_BuildShip() { - ::grpc::Service::MarkMethodCallback(12, new ::grpc::internal::CallbackUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(14, new ::grpc::internal::CallbackUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BoolRes* response) { return this->BuildShip(context, request, response); })); } void SetMessageAllocatorFor_BuildShip( ::grpc::MessageAllocator<::protobuf::BuildShipMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(14); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1431,6 +1683,45 @@ namespace protobuf } }; template + class WithCallbackMethod_BuildShipRID : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithCallbackMethod_BuildShipRID() + { + ::grpc::Service::MarkMethodCallback(15, new ::grpc::internal::CallbackUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::BuildShipMsg* request, ::protobuf::BuildShipRes* response) + { return this->BuildShipRID(context, request, response); })); + } + void SetMessageAllocatorFor_BuildShipRID( + ::grpc::MessageAllocator<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes>* allocator + ) + { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(15); + static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_BuildShipRID() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status BuildShipRID(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BuildShipRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* BuildShipRID( + ::grpc::CallbackServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BuildShipRes* /*response*/ + ) + { + return nullptr; + } + }; + template class WithCallbackMethod_EndAllAction : public BaseClass { private: @@ -1441,14 +1732,14 @@ namespace protobuf public: WithCallbackMethod_EndAllAction() { - ::grpc::Service::MarkMethodCallback(13, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + ::grpc::Service::MarkMethodCallback(16, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) { return this->EndAllAction(context, request, response); })); } void SetMessageAllocatorFor_EndAllAction( ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator ) { - ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(13); + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(16); static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) ->SetMessageAllocator(allocator); } @@ -1469,7 +1760,7 @@ namespace protobuf return nullptr; } }; - typedef WithCallbackMethod_TryConnection>>>>>>>>>>>>> CallbackService; + typedef WithCallbackMethod_TryConnection>>>>>>>>>>>>>>>> CallbackService; typedef CallbackService ExperimentalCallbackService; template class WithGenericMethod_TryConnection : public BaseClass @@ -1664,7 +1955,7 @@ namespace protobuf } }; template - class WithGenericMethod_Attack : public BaseClass + class WithGenericMethod_RepairHome : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service* /*service*/) @@ -1672,23 +1963,23 @@ namespace protobuf } public: - WithGenericMethod_Attack() + WithGenericMethod_RepairHome() { ::grpc::Service::MarkMethodGeneric(8); } - ~WithGenericMethod_Attack() override + ~WithGenericMethod_RepairHome() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Attack(::grpc::ServerContext* /*context*/, const ::protobuf::AttackMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + ::grpc::Status RepairHome(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } }; template - class WithGenericMethod_Send : public BaseClass + class WithGenericMethod_RepairWormhole : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service* /*service*/) @@ -1696,23 +1987,23 @@ namespace protobuf } public: - WithGenericMethod_Send() + WithGenericMethod_RepairWormhole() { ::grpc::Service::MarkMethodGeneric(9); } - ~WithGenericMethod_Send() override + ~WithGenericMethod_RepairWormhole() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Send(::grpc::ServerContext* /*context*/, const ::protobuf::SendMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + ::grpc::Status RepairWormhole(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } }; template - class WithGenericMethod_InstallModule : public BaseClass + class WithGenericMethod_Attack : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service* /*service*/) @@ -1720,23 +2011,23 @@ namespace protobuf } public: - WithGenericMethod_InstallModule() + WithGenericMethod_Attack() { ::grpc::Service::MarkMethodGeneric(10); } - ~WithGenericMethod_InstallModule() override + ~WithGenericMethod_Attack() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status InstallModule(::grpc::ServerContext* /*context*/, const ::protobuf::InstallMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + ::grpc::Status Attack(::grpc::ServerContext* /*context*/, const ::protobuf::AttackMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } }; template - class WithGenericMethod_Recycle : public BaseClass + class WithGenericMethod_Send : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service* /*service*/) @@ -1744,23 +2035,23 @@ namespace protobuf } public: - WithGenericMethod_Recycle() + WithGenericMethod_Send() { ::grpc::Service::MarkMethodGeneric(11); } - ~WithGenericMethod_Recycle() override + ~WithGenericMethod_Send() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status Recycle(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + ::grpc::Status Send(::grpc::ServerContext* /*context*/, const ::protobuf::SendMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } }; template - class WithGenericMethod_BuildShip : public BaseClass + class WithGenericMethod_InstallModule : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service* /*service*/) @@ -1768,23 +2059,23 @@ namespace protobuf } public: - WithGenericMethod_BuildShip() + WithGenericMethod_InstallModule() { ::grpc::Service::MarkMethodGeneric(12); } - ~WithGenericMethod_BuildShip() override + ~WithGenericMethod_InstallModule() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status BuildShip(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + ::grpc::Status InstallModule(::grpc::ServerContext* /*context*/, const ::protobuf::InstallMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } }; template - class WithGenericMethod_EndAllAction : public BaseClass + class WithGenericMethod_Recycle : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service* /*service*/) @@ -1792,23 +2083,95 @@ namespace protobuf } public: - WithGenericMethod_EndAllAction() + WithGenericMethod_Recycle() { ::grpc::Service::MarkMethodGeneric(13); } - ~WithGenericMethod_EndAllAction() override + ~WithGenericMethod_Recycle() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status EndAllAction(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + ::grpc::Status Recycle(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } }; template - class WithRawMethod_TryConnection : public BaseClass + class WithGenericMethod_BuildShip : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithGenericMethod_BuildShip() + { + ::grpc::Service::MarkMethodGeneric(14); + } + ~WithGenericMethod_BuildShip() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status BuildShip(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_BuildShipRID : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithGenericMethod_BuildShipRID() + { + ::grpc::Service::MarkMethodGeneric(15); + } + ~WithGenericMethod_BuildShipRID() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status BuildShipRID(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BuildShipRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_EndAllAction : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithGenericMethod_EndAllAction() + { + ::grpc::Service::MarkMethodGeneric(16); + } + ~WithGenericMethod_EndAllAction() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status EndAllAction(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithRawMethod_TryConnection : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service* /*service*/) @@ -2032,6 +2395,62 @@ namespace protobuf } }; template + class WithRawMethod_RepairHome : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawMethod_RepairHome() + { + ::grpc::Service::MarkMethodRaw(8); + } + ~WithRawMethod_RepairHome() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairHome(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRepairHome(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) + { + ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_RepairWormhole : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawMethod_RepairWormhole() + { + ::grpc::Service::MarkMethodRaw(9); + } + ~WithRawMethod_RepairWormhole() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairWormhole(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRepairWormhole(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) + { + ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template class WithRawMethod_Attack : public BaseClass { private: @@ -2042,7 +2461,7 @@ namespace protobuf public: WithRawMethod_Attack() { - ::grpc::Service::MarkMethodRaw(8); + ::grpc::Service::MarkMethodRaw(10); } ~WithRawMethod_Attack() override { @@ -2056,7 +2475,7 @@ namespace protobuf } void RequestAttack(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2070,7 +2489,7 @@ namespace protobuf public: WithRawMethod_Send() { - ::grpc::Service::MarkMethodRaw(9); + ::grpc::Service::MarkMethodRaw(11); } ~WithRawMethod_Send() override { @@ -2084,7 +2503,7 @@ namespace protobuf } void RequestSend(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2098,7 +2517,7 @@ namespace protobuf public: WithRawMethod_InstallModule() { - ::grpc::Service::MarkMethodRaw(10); + ::grpc::Service::MarkMethodRaw(12); } ~WithRawMethod_InstallModule() override { @@ -2112,7 +2531,7 @@ namespace protobuf } void RequestInstallModule(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2126,7 +2545,7 @@ namespace protobuf public: WithRawMethod_Recycle() { - ::grpc::Service::MarkMethodRaw(11); + ::grpc::Service::MarkMethodRaw(13); } ~WithRawMethod_Recycle() override { @@ -2140,7 +2559,7 @@ namespace protobuf } void RequestRecycle(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2154,7 +2573,7 @@ namespace protobuf public: WithRawMethod_BuildShip() { - ::grpc::Service::MarkMethodRaw(12); + ::grpc::Service::MarkMethodRaw(14); } ~WithRawMethod_BuildShip() override { @@ -2168,7 +2587,35 @@ namespace protobuf } void RequestBuildShip(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_BuildShipRID : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawMethod_BuildShipRID() + { + ::grpc::Service::MarkMethodRaw(15); + } + ~WithRawMethod_BuildShipRID() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status BuildShipRID(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BuildShipRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestBuildShipRID(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) + { + ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2182,7 +2629,7 @@ namespace protobuf public: WithRawMethod_EndAllAction() { - ::grpc::Service::MarkMethodRaw(13); + ::grpc::Service::MarkMethodRaw(16); } ~WithRawMethod_EndAllAction() override { @@ -2196,7 +2643,7 @@ namespace protobuf } void RequestEndAllAction(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); + ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag); } }; template @@ -2448,6 +2895,68 @@ namespace protobuf } }; template + class WithRawCallbackMethod_RepairHome : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawCallbackMethod_RepairHome() + { + ::grpc::Service::MarkMethodRawCallback(8, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->RepairHome(context, request, response); })); + } + ~WithRawCallbackMethod_RepairHome() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairHome(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RepairHome( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/ + ) + { + return nullptr; + } + }; + template + class WithRawCallbackMethod_RepairWormhole : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawCallbackMethod_RepairWormhole() + { + ::grpc::Service::MarkMethodRawCallback(9, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->RepairWormhole(context, request, response); })); + } + ~WithRawCallbackMethod_RepairWormhole() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RepairWormhole(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RepairWormhole( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/ + ) + { + return nullptr; + } + }; + template class WithRawCallbackMethod_Attack : public BaseClass { private: @@ -2458,8 +2967,8 @@ namespace protobuf public: WithRawCallbackMethod_Attack() { - ::grpc::Service::MarkMethodRawCallback(8, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) - { return this->Attack(context, request, response); })); + ::grpc::Service::MarkMethodRawCallback(10, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->Attack(context, request, response); })); } ~WithRawCallbackMethod_Attack() override { @@ -2489,8 +2998,8 @@ namespace protobuf public: WithRawCallbackMethod_Send() { - ::grpc::Service::MarkMethodRawCallback(9, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) - { return this->Send(context, request, response); })); + ::grpc::Service::MarkMethodRawCallback(11, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->Send(context, request, response); })); } ~WithRawCallbackMethod_Send() override { @@ -2520,7 +3029,7 @@ namespace protobuf public: WithRawCallbackMethod_InstallModule() { - ::grpc::Service::MarkMethodRawCallback(10, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(12, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->InstallModule(context, request, response); })); } ~WithRawCallbackMethod_InstallModule() override @@ -2551,7 +3060,7 @@ namespace protobuf public: WithRawCallbackMethod_Recycle() { - ::grpc::Service::MarkMethodRawCallback(11, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(13, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Recycle(context, request, response); })); } ~WithRawCallbackMethod_Recycle() override @@ -2582,7 +3091,7 @@ namespace protobuf public: WithRawCallbackMethod_BuildShip() { - ::grpc::Service::MarkMethodRawCallback(12, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(14, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->BuildShip(context, request, response); })); } ~WithRawCallbackMethod_BuildShip() override @@ -2603,6 +3112,37 @@ namespace protobuf } }; template + class WithRawCallbackMethod_BuildShipRID : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawCallbackMethod_BuildShipRID() + { + ::grpc::Service::MarkMethodRawCallback(15, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + { return this->BuildShipRID(context, request, response); })); + } + ~WithRawCallbackMethod_BuildShipRID() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status BuildShipRID(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BuildShipRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* BuildShipRID( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/ + ) + { + return nullptr; + } + }; + template class WithRawCallbackMethod_EndAllAction : public BaseClass { private: @@ -2613,7 +3153,7 @@ namespace protobuf public: WithRawCallbackMethod_EndAllAction() { - ::grpc::Service::MarkMethodRawCallback(13, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) + ::grpc::Service::MarkMethodRawCallback(16, new ::grpc::internal::CallbackUnaryHandler<::grpc::ByteBuffer, ::grpc::ByteBuffer>([this](::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->EndAllAction(context, request, response); })); } ~WithRawCallbackMethod_EndAllAction() override @@ -2823,6 +3363,60 @@ namespace protobuf virtual ::grpc::Status StreamedConstruct(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::ConstructMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; }; template + class WithStreamedUnaryMethod_RepairHome : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithStreamedUnaryMethod_RepairHome() + { + ::grpc::Service::MarkMethodStreamed(8, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + { return this->StreamedRepairHome(context, streamer); })); + } + ~WithStreamedUnaryMethod_RepairHome() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status RepairHome(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedRepairHome(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_RepairWormhole : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithStreamedUnaryMethod_RepairWormhole() + { + ::grpc::Service::MarkMethodStreamed(9, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + { return this->StreamedRepairWormhole(context, streamer); })); + } + ~WithStreamedUnaryMethod_RepairWormhole() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status RepairWormhole(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedRepairWormhole(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; + }; + template class WithStreamedUnaryMethod_Attack : public BaseClass { private: @@ -2833,8 +3427,8 @@ namespace protobuf public: WithStreamedUnaryMethod_Attack() { - ::grpc::Service::MarkMethodStreamed(8, new ::grpc::internal::StreamedUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::AttackMsg, ::protobuf::BoolRes>* streamer) - { return this->StreamedAttack(context, streamer); })); + ::grpc::Service::MarkMethodStreamed(10, new ::grpc::internal::StreamedUnaryHandler<::protobuf::AttackMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::AttackMsg, ::protobuf::BoolRes>* streamer) + { return this->StreamedAttack(context, streamer); })); } ~WithStreamedUnaryMethod_Attack() override { @@ -2860,8 +3454,8 @@ namespace protobuf public: WithStreamedUnaryMethod_Send() { - ::grpc::Service::MarkMethodStreamed(9, new ::grpc::internal::StreamedUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::SendMsg, ::protobuf::BoolRes>* streamer) - { return this->StreamedSend(context, streamer); })); + ::grpc::Service::MarkMethodStreamed(11, new ::grpc::internal::StreamedUnaryHandler<::protobuf::SendMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::SendMsg, ::protobuf::BoolRes>* streamer) + { return this->StreamedSend(context, streamer); })); } ~WithStreamedUnaryMethod_Send() override { @@ -2887,7 +3481,7 @@ namespace protobuf public: WithStreamedUnaryMethod_InstallModule() { - ::grpc::Service::MarkMethodStreamed(10, new ::grpc::internal::StreamedUnaryHandler<::protobuf::InstallMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::InstallMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(12, new ::grpc::internal::StreamedUnaryHandler<::protobuf::InstallMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::InstallMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedInstallModule(context, streamer); })); } ~WithStreamedUnaryMethod_InstallModule() override @@ -2914,7 +3508,7 @@ namespace protobuf public: WithStreamedUnaryMethod_Recycle() { - ::grpc::Service::MarkMethodStreamed(11, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(13, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedRecycle(context, streamer); })); } ~WithStreamedUnaryMethod_Recycle() override @@ -2941,7 +3535,7 @@ namespace protobuf public: WithStreamedUnaryMethod_BuildShip() { - ::grpc::Service::MarkMethodStreamed(12, new ::grpc::internal::StreamedUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::BuildShipMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(14, new ::grpc::internal::StreamedUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::BuildShipMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedBuildShip(context, streamer); })); } ~WithStreamedUnaryMethod_BuildShip() override @@ -2958,6 +3552,33 @@ namespace protobuf virtual ::grpc::Status StreamedBuildShip(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::BuildShipMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; }; template + class WithStreamedUnaryMethod_BuildShipRID : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithStreamedUnaryMethod_BuildShipRID() + { + ::grpc::Service::MarkMethodStreamed(15, new ::grpc::internal::StreamedUnaryHandler<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes>* streamer) + { return this->StreamedBuildShipRID(context, streamer); })); + } + ~WithStreamedUnaryMethod_BuildShipRID() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status BuildShipRID(::grpc::ServerContext* /*context*/, const ::protobuf::BuildShipMsg* /*request*/, ::protobuf::BuildShipRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedBuildShipRID(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::BuildShipMsg, ::protobuf::BuildShipRes>* server_unary_streamer) = 0; + }; + template class WithStreamedUnaryMethod_EndAllAction : public BaseClass { private: @@ -2968,7 +3589,7 @@ namespace protobuf public: WithStreamedUnaryMethod_EndAllAction() { - ::grpc::Service::MarkMethodStreamed(13, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + ::grpc::Service::MarkMethodStreamed(16, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) { return this->StreamedEndAllAction(context, streamer); })); } ~WithStreamedUnaryMethod_EndAllAction() override @@ -2984,7 +3605,7 @@ namespace protobuf // replace default version of method with streamed unary virtual ::grpc::Status StreamedEndAllAction(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; }; - typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>> StreamedUnaryService; + typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>>>>> StreamedUnaryService; template class WithSplitStreamingMethod_AddPlayer : public BaseClass { @@ -3013,7 +3634,7 @@ namespace protobuf virtual ::grpc::Status StreamedAddPlayer(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer<::protobuf::PlayerMsg, ::protobuf::MessageToClient>* server_split_streamer) = 0; }; typedef WithSplitStreamingMethod_AddPlayer SplitStreamedService; - typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>>> StreamedService; + typedef WithStreamedUnaryMethod_TryConnection>>>>>>>>>>>>>>>> StreamedService; }; } // namespace protobuf diff --git a/CAPI/cpp/proto/Services.pb.cc b/CAPI/cpp/proto/Services.pb.cc index 54eabe0f..3b842203 100644 --- a/CAPI/cpp/proto/Services.pb.cc +++ b/CAPI/cpp/proto/Services.pb.cc @@ -31,7 +31,7 @@ static constexpr ::_pb::Message* const* file_default_instances = nullptr; const char descriptor_table_protodef_Services_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\016Services.proto\022\010protobuf\032\025Message2Clie" - "nts.proto\032\024Message2Server.proto2\363\005\n\020Avai" + "nts.proto\032\024Message2Server.proto2\233\007\n\020Avai" "lableService\0223\n\rTryConnection\022\017.protobuf" ".IDMsg\032\021.protobuf.BoolRes\022=\n\tAddPlayer\022\023" ".protobuf.PlayerMsg\032\031.protobuf.MessageTo" @@ -43,14 +43,19 @@ const char descriptor_table_protodef_Services_2eproto[] PROTOBUF_SECTION_VARIABL "uf.BoolRes\0224\n\007Rebuild\022\026.protobuf.Constru" "ctMsg\032\021.protobuf.BoolRes\0226\n\tConstruct\022\026." "protobuf.ConstructMsg\032\021.protobuf.BoolRes" - "\0220\n\006Attack\022\023.protobuf.AttackMsg\032\021.protob" - "uf.BoolRes\022,\n\004Send\022\021.protobuf.SendMsg\032\021." - "protobuf.BoolRes\0228\n\rInstallModule\022\024.prot" - "obuf.InstallMsg\032\021.protobuf.BoolRes\022-\n\007Re" - "cycle\022\017.protobuf.IDMsg\032\021.protobuf.BoolRe" - "s\0226\n\tBuildShip\022\026.protobuf.BuildShipMsg\032\021" - ".protobuf.BoolRes\0222\n\014EndAllAction\022\017.prot" - "obuf.IDMsg\032\021.protobuf.BoolResb\006proto3"; + "\0220\n\nRepairHome\022\017.protobuf.IDMsg\032\021.protob" + "uf.BoolRes\0224\n\016RepairWormhole\022\017.protobuf." + "IDMsg\032\021.protobuf.BoolRes\0220\n\006Attack\022\023.pro" + "tobuf.AttackMsg\032\021.protobuf.BoolRes\022,\n\004Se" + "nd\022\021.protobuf.SendMsg\032\021.protobuf.BoolRes" + "\0228\n\rInstallModule\022\024.protobuf.InstallMsg\032" + "\021.protobuf.BoolRes\022-\n\007Recycle\022\017.protobuf" + ".IDMsg\032\021.protobuf.BoolRes\0226\n\tBuildShip\022\026" + ".protobuf.BuildShipMsg\032\021.protobuf.BoolRe" + "s\022>\n\014BuildShipRID\022\026.protobuf.BuildShipMs" + "g\032\026.protobuf.BuildShipRes\0222\n\014EndAllActio" + "n\022\017.protobuf.IDMsg\032\021.protobuf.BoolResb\006p" + "roto3"; static const ::_pbi::DescriptorTable* const descriptor_table_Services_2eproto_deps[2] = { &::descriptor_table_Message2Clients_2eproto, &::descriptor_table_Message2Server_2eproto, @@ -59,7 +64,7 @@ static ::_pbi::once_flag descriptor_table_Services_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_Services_2eproto = { false, false, - 837, + 1005, descriptor_table_protodef_Services_2eproto, "Services.proto", &descriptor_table_Services_2eproto_once, diff --git a/CAPI/python/PyAPI/API.py b/CAPI/python/PyAPI/API.py index 2a2a2375..70eb0950 100644 --- a/CAPI/python/PyAPI/API.py +++ b/CAPI/python/PyAPI/API.py @@ -34,6 +34,12 @@ def Recover(self, recover: int) -> Future[bool]: def Produce(self) -> Future[bool]: return self.__pool.submit(self.__logic.Produce) + def RepairWormhole(self) -> Future[bool]: + return self.__pool.submit(self.__logic.RepairWormhole) + + def RepairHome(self) -> Future[bool]: + return self.__pool.submit(self.__logic.RepairHome) + def Rebuild(self, constructionType: THUAI7.ConstructionType) -> Future[bool]: return self.__pool.submit(self.__logic.Rebuild, constructionType) @@ -76,7 +82,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]: def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType: return self.__logic.GetPlaceType(cellX, cellY) - def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]: + def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None: return self.__logic.GetConstructionState(cellX, cellY) def GetWormholeHp(self, cellX: int, cellY: int) -> int: @@ -184,7 +190,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]: def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType: return self.__logic.GetPlaceType(cellX, cellY) - def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]: + def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None: return self.__logic.GetConstructionState(cellX, cellY) def GetWormholeHp(self, cellX: int, cellY: int) -> int: diff --git a/CAPI/python/PyAPI/Communication.py b/CAPI/python/PyAPI/Communication.py index 8f49aa39..13311490 100644 --- a/CAPI/python/PyAPI/Communication.py +++ b/CAPI/python/PyAPI/Communication.py @@ -112,6 +112,34 @@ def Produce(self, playerID: int, teamID: int) -> bool: else: return produceResult.act_success + def RepairWormhole(self, playerID: int, teamID: int) -> bool: + try: + with self.__mtxLimit: + if self.__counter >= self.__limit: + return False + self.__counter += 1 + produceResult: Message2Clients.BoolRes = self.__THUAI7Stub.RepairWormhole( + THUAI72Proto.THUAI72ProtobufIDMsg(playerID, teamID) + ) + except grpc.RpcError: + return False + else: + return produceResult.act_success + + def RepairHome(self, playerID: int, teamID: int) -> bool: + try: + with self.__mtxLimit: + if self.__counter >= self.__limit: + return False + self.__counter += 1 + produceResult: Message2Clients.BoolRes = self.__THUAI7Stub.RepairHome( + THUAI72Proto.THUAI72ProtobufIDMsg(playerID, teamID) + ) + except grpc.RpcError: + return False + else: + return produceResult.act_success + def Rebuild( self, constructionType: THUAI7.ConstructionType, playerID: int, teamID: int ) -> bool: diff --git a/CAPI/python/PyAPI/DebugAPI.py b/CAPI/python/PyAPI/DebugAPI.py index 820f0daf..25f6f66c 100644 --- a/CAPI/python/PyAPI/DebugAPI.py +++ b/CAPI/python/PyAPI/DebugAPI.py @@ -10,7 +10,13 @@ class ShipDebugAPI(IShipAPI, IGameTimer): def __init__( - self, logic: ILogic, file: bool, screen: bool, warnOnly: bool, playerID: int, teamID: int + self, + logic: ILogic, + file: bool, + screen: bool, + warnOnly: bool, + playerID: int, + teamID: int, ) -> None: self.__logic = logic self.__pool = ThreadPoolExecutor(20) @@ -106,6 +112,28 @@ def logProduce() -> bool: return self.__pool.submit(logProduce) + def RepairWormhole(self) -> Future[bool]: + self.__logger.info(f"RepairWormhole: called at {self.__GetTime()}ms") + + def logRepairWormhole() -> bool: + result = self.__logic.RepairWormhole() + if not result: + self.__logger.warning(f"RepairWormhole failed at {self.__GetTime()}ms") + return result + + return self.__pool.submit(logRepairWormhole) + + def RepairHome(self) -> Future[bool]: + self.__logger.info(f"RepairHome: called at {self.__GetTime()}ms") + + def logRepairHome() -> bool: + result = self.__logic.RepairHome() + if not result: + self.__logger.warning(f"RepairHome failed at {self.__GetTime()}ms") + return result + + return self.__pool.submit(logRepairHome) + def Rebuild(self, constructionType: THUAI7.ConstructionType) -> Future[bool]: self.__logger.info( f"Rebuild: called at {self.__GetTime()}ms construction type {constructionType}" @@ -199,7 +227,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]: def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType: return self.__logic.GetPlaceType(cellX, cellY) - def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]: + def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None: return self.__logic.GetConstructionState(cellX, cellY) def GetWormholeHp(self, cellX: int, cellY: int) -> int: @@ -263,23 +291,14 @@ def PrintTeam(self) -> None: def PrintSelfInfo(self) -> None: ship = self.__logic.GetSelfInfo() - self.__logger.info("******ship Info******") + self.__logger.info("******Self Info******") self.__logger.info( - f"teamID={ship.teamID} playerID={ship.playerID}, GUID={ship.guid} shipType:{ship.shipType}" + f"type={THUAI7.shipTypeDict[ship.shipType]}, playerID={ship.playerID}, GUID={ship.guid}, x={ship.x}, y={ship.y}" ) self.__logger.info( - f"x={ship.x}, y={ship.y} hp={ship.hp} armor={ship.armor} shield={ship.shield} state:{ship.shipState}" + f"state={THUAI7.shipStateDict[ship.shipState]}, speed={ship.speed}, view range={ship.viewRange}, facing direction={ship.facingDirection}" ) - self.__logger.info( - f"speed={ship.speed}, view range={ship.viewRange}, facingDirection={ship.facingDirection}" - ) - self.__logger.info( - f"producerType:{ship.producerType} constructorType:{ship.constructorType}" - ) - self.__logger.info( - f"armorType:{ship.armorType} shieldType:{ship.shieldType} weaponType:{ship.weaponType}" - ) - self.__logger.info("************************\n") + self.__logger.info("*********************\n") def __GetTime(self) -> float: return (datetime.datetime.now() - self.__startPoint) / datetime.timedelta( @@ -300,7 +319,13 @@ def Play(self, ai: IAI) -> None: class TeamDebugAPI(ITeamAPI, IGameTimer): def __init__( - self, logic: ILogic, file: bool, screen: bool, warnOnly: bool, playerID: int, teamID: int + self, + logic: ILogic, + file: bool, + screen: bool, + warnOnly: bool, + playerID: int, + teamID: int, ) -> None: self.__logic = logic self.__pool = ThreadPoolExecutor(20) @@ -440,7 +465,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]: def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType: return self.__logic.GetPlaceType(cellX, cellY) - def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]: + def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None: return self.__logic.GetConstructionState(cellX, cellY) def GetWormholeHp(self, cellX: int, cellY: int) -> int: @@ -496,8 +521,9 @@ def PrintTeam(self) -> None: def PrintSelfInfo(self) -> None: selfInfo = self.__logic.GetSelfInfo() self.__logger.info("******self team info******") - self.__logger.info(f"teamID:{selfInfo.teamID} playerID:{selfInfo.playerID}") - self.__logger.info(f"score:{selfInfo.score} energy:{selfInfo.energy}") + self.__logger.info( + f"teamID:{selfInfo.teamID} playerID:{selfInfo.playerID} score:{selfInfo.score} energy:{selfInfo.energy}" + ) self.__logger.info("************************\n") def __GetTime(self) -> float: diff --git a/CAPI/python/PyAPI/Interface.py b/CAPI/python/PyAPI/Interface.py index ca381a70..94e73478 100644 --- a/CAPI/python/PyAPI/Interface.py +++ b/CAPI/python/PyAPI/Interface.py @@ -43,7 +43,7 @@ def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType: pass @abstractmethod - def GetConstructionState(self, cellX: int, cellY: int) -> tuple: + def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None: pass @abstractmethod @@ -110,6 +110,14 @@ def Rebuild(self, constructionType: THUAI7.ConstructionType) -> bool: def Construct(self, constructionType: THUAI7.ConstructionType) -> bool: pass + @abstractmethod + def RepairHome(self) -> bool: + pass + + @abstractmethod + def RepairWormhole(self) -> bool: + pass + @abstractmethod def Attack(self, angle: float) -> bool: pass @@ -239,12 +247,12 @@ def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType: pass @abstractmethod - def GetConstructionState(self, cellX: int, cellY: int) -> Tuple[int, int]: + def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None: """获取当前建筑状态 :param cellX: X坐标, 单位Cell :param cellY: Y坐标, 单位Cell - :return: 该建筑当前的所属队伍编号与血量 + :return: 该建筑信息 """ pass @@ -407,7 +415,7 @@ def Produce(self) -> Future[bool]: pass @abstractmethod - def Rebuild(self, constructionType: THUAI7.ConstructionType) -> Future[bool]: + def Rebuild(self, constructionType: THUAI7.ConstructionState) -> Future[bool]: """发出重建指令 - 需要接近待重建 `Construction` @@ -416,6 +424,24 @@ def Rebuild(self, constructionType: THUAI7.ConstructionType) -> Future[bool]: """ pass + @abstractmethod + def RepairWormhole(self) -> Future[bool]: + """发出修复虫洞指令 + - 需要接近待建造的 `Wormhole` + + :return: 是否成功进入修复虫洞状态,通过`.result()`方法等待获取`bool` + """ + pass + + @abstractmethod + def RepairHome(self) -> Future[bool]: + """发出修复大本营指令 + - 需要接近待建造的 `Home` + + :return: 是否成功进入修复大本营状态,通过`.result()`方法等待获取`bool` + """ + pass + @abstractmethod def Construct(self, constructionType: THUAI7.ConstructionType) -> Future[bool]: """发出建造指令 @@ -455,7 +481,9 @@ def GetSelfInfo(self) -> THUAI7.Team: pass @abstractmethod - def InstallModule(self, playerID: int, moduleType: THUAI7.ModuleType) -> Future[bool]: + def InstallModule( + self, playerID: int, moduleType: THUAI7.ModuleType + ) -> Future[bool]: """安装模块 :param playerID: 待安装模块的舰船编号 diff --git a/CAPI/python/PyAPI/constants.py b/CAPI/python/PyAPI/constants.py index ed893f48..95522da9 100644 --- a/CAPI/python/PyAPI/constants.py +++ b/CAPI/python/PyAPI/constants.py @@ -3,7 +3,7 @@ class Constants: numofGridPerCell = 1000 rows = 50 cols = 50 - maxResourceProgress = 200 + maxResourceProgress = 32000 maxWormholeHp = 18000 robPercent = 0.2 destroyBuildingBonus = 200 @@ -13,23 +13,25 @@ class Constants: class Home: - maxHp = 24000 + maxHp = 48000 energySpeed = 100 + damage = 300 + attackRange = 8000 class Factory: - maxHp = 8000 - energySpeed = 300 + maxHp = 12000 + energySpeed = 200 class Community: - maxHp = 6000 + maxHp = 10000 class Fort: - maxHp = 12000 + maxHp = 16000 attackRange = 8000 - damage = 1200 + damage = 300 class CivilianShip: @@ -101,51 +103,52 @@ class Weapon: class Laser: - Damage = 1200 + Damage = 800 AttackRange = 4000 ArmorDamageMultiplier = 1.5 ShieldDamageMultiplier = 0.6 Speed = 20000 - CastTime = 300 - BackSwing = 300 + CastTime = 500 + BackSwing = 1000 class Plasma: - Damage = 1300 + Damage = 1000 AttackRange = 4000 ArmorDamageMultiplier = 2.0 ShieldDamageMultiplier = 0.4 Speed = 10000 - CastTime = 400 - BackSwing = 400 + CastTime = 800 + BackSwing = 1600 class Shell: - Damage = 1800 + Damage = 1200 AttackRange = 4000 ArmorDamageMultiplier = 0.4 ShieldDamageMultiplier = 1.5 Speed = 8000 - CastTime = 200 - BackSwing = 200 + CastTime = 500 + BackSwing = 1000 class Missle: Damage = 1600 - AttackRange = 8000 - ExplodeRange = 1600 + AttackRange = 6000 + ExplodeRange = 1100 ArmorDamageMultiplier = 1.0 ShieldDamageMultiplier = 0.4 Speed = 6000 - CastTime = 600 - BackSwing = 600 + CastTime = 1200 + BackSwing = 1800 class Arc: - Damage = 3200 - AttackRange = 8000 + MinDamage = 800 + MaxDamage = 1600 + AttackRange = 6000 ArmorDamageMultiplier = 2.0 ShieldDamageMultiplier = 2.0 Speed = 8000 - CastTime = 600 - BackSwing = 600 + CastTime = 1200 + BackSwing = 1800 diff --git a/CAPI/python/PyAPI/logic.py b/CAPI/python/PyAPI/logic.py index 4fbb56ad..bb4e1dae 100644 --- a/CAPI/python/PyAPI/logic.py +++ b/CAPI/python/PyAPI/logic.py @@ -138,24 +138,27 @@ def GetPlayerGUIDs(self) -> List[int]: with self.__mtxState: return copy.deepcopy(self.__currentState.guids) - def GetConstructionState(self, cellX: int, cellY: int) -> tuple: + def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None: with self.__mtxState: self.__logger.debug("Called GetConstructionState") if (cellX, cellY) in self.__currentState.mapInfo.factoryState: - return copy.deepcopy( - self.__currentState.mapInfo.factoryState[(cellX, cellY)] + return THUAI7.ConstructionState( + self.__currentState.mapInfo.factoryState[(cellX, cellY)], + THUAI7.ConstructionType.Factory, ) elif (cellX, cellY) in self.__currentState.mapInfo.communityState: - return copy.deepcopy( - self.__currentState.mapInfo.communityState[(cellX, cellY)] + return THUAI7.ConstructionState( + self.__currentState.mapInfo.communityState[(cellX, cellY)], + THUAI7.ConstructionType.Community, ) elif (cellX, cellY) in self.__currentState.mapInfo.fortState: - return copy.deepcopy( - self.__currentState.mapInfo.fortState[(cellX, cellY)] + return THUAI7.ConstructionState( + self.__currentState.mapInfo.fortState[(cellX, cellY)], + THUAI7.ConstructionType.Fort, ) else: self.__logger.warning("GetConstructionState: Out of range") - return (-1, -1) + return None def GetWormholeHp(self, cellX: int, cellY: int) -> int: with self.__mtxState: @@ -235,6 +238,14 @@ def Produce(self) -> bool: self.__logger.debug("Called Produce") return self.__comm.Produce(self.__playerID, self.__teamID) + def RepairWormhole(self) -> bool: + self.__logger.debug("Called RepairWormhole") + return self.__comm.RepairWormhole(self.__playerID, self.__teamID) + + def RepairHome(self) -> bool: + self.__logger.debug("Called RepairHome") + return self.__comm.RepairHome(self.__playerID, self.__teamID) + def Rebuild(self, constructionType: THUAI7.ConstructionType) -> bool: self.__logger.debug("Called Rebuild") return self.__comm.Rebuild(constructionType, self.__playerID, self.__teamID) diff --git a/CAPI/python/PyAPI/structures.py b/CAPI/python/PyAPI/structures.py index 7e261c05..59b02fd8 100644 --- a/CAPI/python/PyAPI/structures.py +++ b/CAPI/python/PyAPI/structures.py @@ -227,6 +227,11 @@ def __init__(self): self.teamID: int = 0 self.guid: int = 0 +class ConstructionState: + def __init__(self,teamID,HP,type:ConstructionType): + self.teamID=teamID + self.hp=HP + self.constructionType=type class Bullet: """ diff --git a/dependency/Dockerfile/Dockerfile_run_client b/dependency/Dockerfile/Dockerfile_run_client index 28e9cea2..947ee16b 100644 --- a/dependency/Dockerfile/Dockerfile_run_client +++ b/dependency/Dockerfile/Dockerfile_run_client @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0.204-jammy-amd64 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0.300-jammy-amd64 AS build LABEL maintainer="eesast" WORKDIR /usr/local COPY . . diff --git a/dependency/Dockerfile/Dockerfile_run_server b/dependency/Dockerfile/Dockerfile_run_server index 62249679..4a2f1c5d 100644 --- a/dependency/Dockerfile/Dockerfile_run_server +++ b/dependency/Dockerfile/Dockerfile_run_server @@ -1,10 +1,10 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0.204-jammy-amd64 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0.300-jammy-amd64 AS build LABEL maintainer="eesast" WORKDIR /usr/local COPY . . RUN dotnet publish logic/Server/Server.csproj -c Release -o /usr/local/Server --self-contained true -r linux-x64 -FROM mcr.microsoft.com/dotnet/sdk:8.0.204-jammy-amd64 +FROM mcr.microsoft.com/dotnet/sdk:8.0.300-jammy-amd64 LABEL maintainer="eesast" WORKDIR /usr/local COPY --from=build /usr/local/Server . diff --git a/dependency/deploy/Program.cs b/dependency/deploy/Program.cs index 56392ca0..9785c674 100644 --- a/dependency/deploy/Program.cs +++ b/dependency/deploy/Program.cs @@ -77,15 +77,8 @@ break; case "upload": d.UpdateMD5(); - if (d.Data.FileHashData.TVersion.InstallerVersion < d.CurrentVersion.InstallerVersion) - { - Cloud.DownloadFile(@"D:\a\publish\Secret.csv", "Secret.csv"); - ZipFile.CreateFromDirectory(@"D:\a\publish", @$"D:\a\Installer_v{d.CurrentVersion.InstallerVersion}.zip", CompressionLevel.SmallestSize, false); - Cloud.UploadFile(@$"D:\a\Installer_v{d.CurrentVersion.InstallerVersion}.zip", $"Setup/Installer_v{d.CurrentVersion.InstallerVersion}.zip"); - } - else - { - Log.LogInfo("No installer version update found."); - } + Cloud.DownloadFile(@"D:\a\publish\Secret.csv", "Secret.csv"); + ZipFile.CreateFromDirectory(@"D:\a\publish", @$"D:\a\Installer_v{d.CurrentVersion.InstallerVersion}.zip", CompressionLevel.SmallestSize, false); + Cloud.UploadFile(@$"D:\a\Installer_v{d.CurrentVersion.InstallerVersion}.zip", $"Setup/Installer_v{d.CurrentVersion.InstallerVersion}.zip"); break; } \ No newline at end of file diff --git a/dependency/deploy/deploy.csproj b/dependency/deploy/deploy.csproj index 6dbb2996..56c26e02 100644 --- a/dependency/deploy/deploy.csproj +++ b/dependency/deploy/deploy.csproj @@ -25,7 +25,7 @@ - + diff --git a/dependency/proto/Services.proto b/dependency/proto/Services.proto index dbc18505..794af9f4 100755 --- a/dependency/proto/Services.proto +++ b/dependency/proto/Services.proto @@ -17,8 +17,11 @@ service AvailableService rpc Produce(IDMsg) returns (BoolRes); // 开采 rpc Rebuild(ConstructMsg) returns (BoolRes); // 给建筑回血 rpc Construct(ConstructMsg) returns (BoolRes); // 修建建筑 + rpc RepairHome(IDMsg) returns (BoolRes); // 修理大本营 + rpc RepairWormhole(IDMsg) returns (BoolRes); // 修理虫洞 rpc Attack(AttackMsg) returns (BoolRes); // 攻击 rpc Send(SendMsg) returns (BoolRes); // 传递信息 + // 大本营 rpc InstallModule(InstallMsg) returns (BoolRes); rpc Recycle(IDMsg) returns (BoolRes); diff --git a/installer/ViewModel/DebugViewModel.cs b/installer/ViewModel/DebugViewModel.cs index fe04591b..c789a3d5 100644 --- a/installer/ViewModel/DebugViewModel.cs +++ b/installer/ViewModel/DebugViewModel.cs @@ -280,7 +280,8 @@ public bool LaunchServer() { FileName = Downloader.Data.Config.DevServerPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "logic", "Server", "Server.exe"), Arguments = $"--ip 0.0.0.0 --port {Port} --teamCount {TeamCount} --shipNum {ShipCount}", - WorkingDirectory = Downloader.Data.Config.InstallPath + WorkingDirectory = Downloader.Data.Config.InstallPath, + RedirectStandardError = true, }); if (server is null) { @@ -293,6 +294,7 @@ public bool LaunchServer() OnServerExited?.Invoke(this, EventArgs.Empty); Log.LogWarning("Server已退出。"); }; + server.ErrorDataReceived += ProgramErrorReceived; Log.LogWarning("Server成功启动,请保持网络稳定。"); OnServerLaunched?.Invoke(this, EventArgs.Empty); return true; @@ -314,7 +316,8 @@ public bool LaunchClient(int team, int player, int ship) var client = Process.Start(new ProcessStartInfo() { FileName = Downloader.Data.Config.DevClientPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "logic", "Client", "Client.exe"), - WorkingDirectory = Downloader.Data.Config.InstallPath + WorkingDirectory = Downloader.Data.Config.InstallPath, + RedirectStandardError = true, }); if (client is null) { @@ -329,6 +332,14 @@ public bool LaunchClient(int team, int player, int ship) File.Delete(Path.Combine(Downloader.Data.LogPath, $"lock.{team}.{player}.log")); Downloader.Data.Config.Commands.PlaybackFile = p; Log.LogInfo($"Client({team}: {player})成功启动。"); + client.EnableRaisingEvents = true; + client.ErrorDataReceived += ProgramErrorReceived; + client.BeginErrorReadLine(); + client.Exited += (_, _) => + { + Log.LogWarning($"client({team}:{player})已退出({client.ExitCode})。"); + }; + client.ErrorDataReceived += ProgramErrorReceived; children.Add(client); return true; } @@ -338,13 +349,17 @@ public bool LaunchClient(int team, int player, int ship) public bool LaunchCppAPI(int team, int player) { var exe = Downloader.Data.Config.DevCppPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "CAPI", "cpp", "x64", "Debug", "API.exe"); + var logDir = Path.Combine(Downloader.Data.LogPath, $"Team{team}"); + if (!Directory.Exists(logDir)) + Directory.CreateDirectory(logDir); if (File.Exists(exe)) { var cpp = Process.Start(new ProcessStartInfo() { FileName = Downloader.Data.Config.DevCppPath ?? exe, Arguments = $"-I {IP} -P {Port} -t {team} -p {player} -o -d", - WorkingDirectory = Downloader.Data.Config.InstallPath + WorkingDirectory = logDir, + RedirectStandardError = true, }); if (cpp is null) { @@ -352,6 +367,13 @@ public bool LaunchCppAPI(int team, int player) return false; } Log.LogInfo($"API.exe启动成功, team:{team}, player: {player}!"); + cpp.EnableRaisingEvents = true; + cpp.ErrorDataReceived += ProgramErrorReceived; + cpp.BeginErrorReadLine(); + cpp.Exited += (_, _) => + { + Log.LogWarning($"API.exe({team}:{player})已退出({cpp.ExitCode})。"); + }; children.Add(cpp); return true; } @@ -374,16 +396,18 @@ public bool LaunchCppAPI(int team, int player) public bool LaunchPyAPI(int team, int player) { var p = Path.Combine(Downloader.Data.Config.InstallPath, "CAPI", "python"); + var logDir = Path.Combine(Downloader.Data.LogPath, $"Team{team}"); + if (!Directory.Exists(logDir)) + Directory.CreateDirectory(logDir); if (Directory.Exists(Path.Combine(p, "proto"))) { - var py = Process.Start(new ProcessStartInfo() { - FileName = "cmd.exe", - Arguments = "/c python " - + (Downloader.Data.Config.DevPyPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "CAPI", "python", "PyAPI", "main.py")) + FileName = "python.exe", + Arguments = (Downloader.Data.Config.DevPyPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "CAPI", "python", "PyAPI", "main.py")) + $" -I {IP} -P {Port} -t {team} -p {player} -o -d", - WorkingDirectory = Downloader.Data.Config.InstallPath + WorkingDirectory = logDir, + RedirectStandardError = true, }); if (py is null) { @@ -391,6 +415,13 @@ public bool LaunchPyAPI(int team, int player) return false; } Log.LogInfo($"main.py启动成功, team:{team}, player: {player}!"); + py.EnableRaisingEvents = true; + py.ErrorDataReceived += ProgramErrorReceived; + py.BeginErrorReadLine(); + py.Exited += (_, _) => + { + Log.LogWarning($"main.py({team}:{player})已退出({py.ExitCode})。"); + }; children.Add(py); return true; } @@ -409,6 +440,15 @@ public bool LaunchPyAPI(int team, int player) return false; } } + + protected virtual void ProgramErrorReceived(object sender, DataReceivedEventArgs e) + { + var program = sender as Process; + Log.LogError(string.Format("error occurs in {0}:\n {1}", + program is null ? "(anonymous)" : + (program.StartInfo.FileName + ' ' + program.StartInfo.Arguments), + e.Data ?? "Unhandled error.")); + } #endregion } } \ No newline at end of file diff --git a/installer/installer.csproj b/installer/installer.csproj index e82f1be8..f545a591 100755 --- a/installer/installer.csproj +++ b/installer/installer.csproj @@ -100,7 +100,7 @@ - + diff --git a/logic/Client/Client.csproj b/logic/Client/Client.csproj index 0d7c909a..20beb817 100755 --- a/logic/Client/Client.csproj +++ b/logic/Client/Client.csproj @@ -79,7 +79,7 @@ - + diff --git a/logic/GameClass/GameObj/Areas/Asteroid.cs b/logic/GameClass/GameObj/Areas/Asteroid.cs index 8dca4053..8bbb622c 100755 --- a/logic/GameClass/GameObj/Areas/Asteroid.cs +++ b/logic/GameClass/GameObj/Areas/Asteroid.cs @@ -6,6 +6,6 @@ namespace GameClass.GameObj.Areas; public class Asteroid(XY initPos) : Immovable(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Asteroid) { - public override bool IsRigid => true; + public override bool IsRigid(bool args = false) => true; public override ShapeType Shape => ShapeType.Square; } diff --git a/logic/GameClass/GameObj/Areas/Construction.cs b/logic/GameClass/GameObj/Areas/Construction.cs index 1161c235..56bf2a48 100755 --- a/logic/GameClass/GameObj/Areas/Construction.cs +++ b/logic/GameClass/GameObj/Areas/Construction.cs @@ -10,7 +10,7 @@ public class Construction(XY initPos) { public AtomicLong TeamID { get; } = new(long.MaxValue); public InVariableRange HP { get; } = new(0, GameData.CommunityHP); - public override bool IsRigid => true; + public override bool IsRigid(bool args = false) => true; public override ShapeType Shape => ShapeType.Square; private readonly object lockOfConstructionType = new(); @@ -63,17 +63,17 @@ public bool Construct(int constructSpeed, ConstructionType constructionType, Shi } public bool BeAttacked(Bullet bullet) { + var previousActivated = IsActivated.Get(); if (bullet!.Parent!.TeamID != TeamID) { long subHP = bullet.AP; HP.SubPositiveV(subHP); } - if (HP == 0) + if (HP.IsBelowMaxTimes(0.5)) { - lock (lockOfConstructionType) - constructionType = ConstructionType.Null; + IsActivated.Set(false); } - return HP.IsBelowMaxTimes(0.5); + return HP.IsBelowMaxTimes(0.5) && previousActivated; } public void AddConstructNum(int add = 1) { diff --git a/logic/GameClass/GameObj/Areas/Home.cs b/logic/GameClass/GameObj/Areas/Home.cs index 3746ca96..65752411 100755 --- a/logic/GameClass/GameObj/Areas/Home.cs +++ b/logic/GameClass/GameObj/Areas/Home.cs @@ -1,6 +1,7 @@ using Preparation.Interface; using Preparation.Utility; using Preparation.Utility.Value; +using Preparation.Utility.Value.SafeValue.Atomic; using Preparation.Utility.Value.SafeValue.LockedValue; namespace GameClass.GameObj.Areas; @@ -10,12 +11,24 @@ public class Home(XY initPos, long id) { public long TeamID { get; } = id; public InVariableRange HP { get; } = new(GameData.HomeHP); - public override bool IsRigid => true; + public override bool IsRigid(bool args = false) => true; public override ShapeType Shape => ShapeType.Square; - + public AtomicInt RepairNum { get; } = new AtomicInt(0); + public bool Repair(int constructSpeed, Ship ship) + { + return HP.AddVUseOtherRChange(constructSpeed, ship.MoneyPool.Money, 1) > 0; + } public void BeAttacked(Bullet bullet) { if (bullet!.Parent!.TeamID != TeamID) HP.SubPositiveV(bullet.AP); } + public void AddRepairNum(int add = 1) + { + RepairNum.Add(add); + } + public void SubRepairNum(int sub = 1) + { + RepairNum.Sub(sub); + } } diff --git a/logic/GameClass/GameObj/Areas/NullArea.cs b/logic/GameClass/GameObj/Areas/NullArea.cs index 3baeea51..bcfa3b4c 100755 --- a/logic/GameClass/GameObj/Areas/NullArea.cs +++ b/logic/GameClass/GameObj/Areas/NullArea.cs @@ -6,6 +6,6 @@ namespace GameClass.GameObj.Areas; public class NullArea(XY initPos) : Immovable(initPos, int.MaxValue, GameObjType.Null) { - public override bool IsRigid => false; + public override bool IsRigid(bool args = false) => false; public override ShapeType Shape => ShapeType.Null; } diff --git a/logic/GameClass/GameObj/Areas/OutOfBoundBlock.cs b/logic/GameClass/GameObj/Areas/OutOfBoundBlock.cs index c5f600a4..7fd1df30 100755 --- a/logic/GameClass/GameObj/Areas/OutOfBoundBlock.cs +++ b/logic/GameClass/GameObj/Areas/OutOfBoundBlock.cs @@ -10,6 +10,6 @@ namespace GameClass.GameObj.Areas; public class OutOfBoundBlock(XY initPos) : Immovable(initPos, int.MaxValue, GameObjType.OutOfBoundBlock), IOutOfBound { - public override bool IsRigid => true; + public override bool IsRigid(bool args = false) => true; public override ShapeType Shape => ShapeType.Square; } diff --git a/logic/GameClass/GameObj/Areas/Resource.cs b/logic/GameClass/GameObj/Areas/Resource.cs index 9f8b151c..a7223575 100755 --- a/logic/GameClass/GameObj/Areas/Resource.cs +++ b/logic/GameClass/GameObj/Areas/Resource.cs @@ -9,7 +9,7 @@ public class Resource(XY initPos) : Immovable(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Resource) { public InVariableRange HP { get; } = new(GameData.ResourceHP); - public override bool IsRigid => true; + public override bool IsRigid(bool args = false) => true; public override ShapeType Shape => ShapeType.Square; public AtomicInt ProduceNum { get; } = new AtomicInt(0); public bool Produce(int produceSpeed, Ship ship) diff --git a/logic/GameClass/GameObj/Areas/Ruin.cs b/logic/GameClass/GameObj/Areas/Ruin.cs index c4a96790..04d4a24a 100755 --- a/logic/GameClass/GameObj/Areas/Ruin.cs +++ b/logic/GameClass/GameObj/Areas/Ruin.cs @@ -6,6 +6,6 @@ namespace GameClass.GameObj.Areas; public class Ruin(XY initPos) : Immovable(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Ruin) { - public override bool IsRigid => true; + public override bool IsRigid(bool args = false) => true; public override ShapeType Shape => ShapeType.Square; } diff --git a/logic/GameClass/GameObj/Areas/Shadow.cs b/logic/GameClass/GameObj/Areas/Shadow.cs index 3d35a9b3..52071d47 100755 --- a/logic/GameClass/GameObj/Areas/Shadow.cs +++ b/logic/GameClass/GameObj/Areas/Shadow.cs @@ -6,6 +6,6 @@ namespace GameClass.GameObj.Areas; public class Shadow(XY initPos) : Immovable(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Shadow) { - public override bool IsRigid => false; + public override bool IsRigid(bool args = false) => false; public override ShapeType Shape => ShapeType.Square; } \ No newline at end of file diff --git a/logic/GameClass/GameObj/Areas/WormholeCell.cs b/logic/GameClass/GameObj/Areas/WormholeCell.cs index 0f1726ed..609773cd 100644 --- a/logic/GameClass/GameObj/Areas/WormholeCell.cs +++ b/logic/GameClass/GameObj/Areas/WormholeCell.cs @@ -6,7 +6,7 @@ namespace GameClass.GameObj.Areas; public class WormholeCell(XY initPos, Wormhole wormhole) : Immovable(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Wormhole) { - public override bool IsRigid => Wormhole.HP < GameData.WormholeHP / 2; + public override bool IsRigid(bool args = false) => args || Wormhole.HP < GameData.WormholeHP / 2; public override ShapeType Shape => ShapeType.Square; public readonly Wormhole Wormhole = wormhole; } diff --git a/logic/GameClass/GameObj/BombedBullet.cs b/logic/GameClass/GameObj/BombedBullet.cs index 0d89bc29..f5b3dcdf 100755 --- a/logic/GameClass/GameObj/BombedBullet.cs +++ b/logic/GameClass/GameObj/BombedBullet.cs @@ -8,7 +8,7 @@ public sealed class BombedBullet(Bullet bullet) : Immovable(bullet.Position, bullet.Radius, GameObjType.BombedBullet) { public override ShapeType Shape => ShapeType.Circle; - public override bool IsRigid => false; + public override bool IsRigid(bool args = false) => false; public long MappingID { get; } = bullet.ID; public readonly Bullet bulletHasBombed = bullet; public readonly XY facingDirection = bullet.FacingDirection; diff --git a/logic/GameClass/GameObj/Bullet.cs b/logic/GameClass/GameObj/Bullet.cs index b2d9bd60..b84eacec 100755 --- a/logic/GameClass/GameObj/Bullet.cs +++ b/logic/GameClass/GameObj/Bullet.cs @@ -15,7 +15,7 @@ public abstract class Bullet : ObjOfShip public abstract int SwingTime { get; } public abstract double ArmorModifier { get; } public abstract double ShieldModifier { get; } - public override bool IsRigid => true; // 默认为true + public override bool IsRigid(bool args = false) => true; // 默认为true public override ShapeType Shape => ShapeType.Circle; // 默认为圆形 public abstract BulletType TypeOfBullet { get; } public abstract bool CanAttack(GameObj target); diff --git a/logic/GameClass/GameObj/GameObj.cs b/logic/GameClass/GameObj/GameObj.cs index ca9aa34f..aabd09e1 100755 --- a/logic/GameClass/GameObj/GameObj.cs +++ b/logic/GameClass/GameObj/GameObj.cs @@ -25,7 +25,7 @@ public abstract class GameObj(XY initPos, int initRadius, GameObjType initType) protected XY position = initPos; public abstract XY Position { get; } - public abstract bool IsRigid { get; } + public abstract bool IsRigid(bool args = false); public abstract ShapeType Shape { get; } private readonly AtomicBool isRemoved = new(false); diff --git a/logic/GameClass/GameObj/Map/Map.cs b/logic/GameClass/GameObj/Map/Map.cs index 93cda5f2..f61ef210 100755 --- a/logic/GameClass/GameObj/Map/Map.cs +++ b/logic/GameClass/GameObj/Map/Map.cs @@ -81,22 +81,9 @@ public IOutOfBound GetOutOfBound(XY pos) { return (Ship?)GameObjDict[GameObjType.Ship].Find(gameObj => (teamID == ((Ship)gameObj).TeamID) && playerID == ((Ship)gameObj).PlayerID); } - - public static bool WormholeInteract(Wormhole gameObj, XY Pos) - { - foreach (WormholeCell cell in gameObj.Cells) - { - if (GameData.ApproachToInteract(cell.Position, Pos)) - return true; - } - return false; - } public GameObj? OneForInteract(XY Pos, GameObjType gameObjType) { - return (GameObj?)GameObjDict[gameObjType].Find(gameObj => - ((GameData.ApproachToInteract(gameObj.Position, Pos)) || - (gameObjType == GameObjType.Wormhole && WormholeInteract((Wormhole)gameObj, Pos))) - ); + return (GameObj?)GameObjDict[gameObjType].Find(gameObj => GameData.ApproachToInteract(gameObj.Position, Pos)); } public GameObj? OneInTheSameCell(XY Pos, GameObjType gameObjType) { diff --git a/logic/GameClass/GameObj/Ship.cs b/logic/GameClass/GameObj/Ship.cs index c6073182..34ac4eeb 100755 --- a/logic/GameClass/GameObj/Ship.cs +++ b/logic/GameClass/GameObj/Ship.cs @@ -14,7 +14,7 @@ public class Ship : Movable, IShip { public AtomicLong TeamID { get; } = new(long.MaxValue); public AtomicLong PlayerID { get; } = new(long.MaxValue); - public override bool IsRigid => true; + public override bool IsRigid(bool args = false) => true; public override ShapeType Shape => ShapeType.Circle; public int ViewRange { get; } public override bool IgnoreCollideExecutor(IGameObj targetObj) diff --git a/logic/GameEngine/CollisionChecker.cs b/logic/GameEngine/CollisionChecker.cs index eb079554..9296d9eb 100755 --- a/logic/GameEngine/CollisionChecker.cs +++ b/logic/GameEngine/CollisionChecker.cs @@ -8,12 +8,12 @@ namespace GameEngine { internal class CollisionChecker(IMap gameMap) { - public IGameObj? CheckCollision(IMovable obj, XY Pos) + public IGameObj? CheckCollision(IMovable obj, XY Pos, bool collideWithWormhole = false) { // 在列表中检查碰撞 IGameObj? CheckCollisionInList(LockedClassList lst) { - return lst.Find(listObj => obj.WillCollideWith(listObj, Pos)); + return lst.Find(listObj => obj.WillCollideWith(listObj, Pos, collideWithWormhole)); } IGameObj? collisionObj; @@ -33,16 +33,16 @@ internal class CollisionChecker(IMap gameMap) /// 移动的物体 /// 移动的位移向量 /// 和它碰撞的物体 - public IGameObj? CheckCollisionWhenMoving(IMovable obj, XY moveVec) + public IGameObj? CheckCollisionWhenMoving(IMovable obj, XY moveVec, bool collideWithWormhole = false) { XY nextPos = obj.Position + moveVec; - if (!obj.IsRigid) + if (!obj.IsRigid()) { if (gameMap.IsOutOfBound(obj)) return gameMap.GetOutOfBound(nextPos); return null; } - return CheckCollision(obj, nextPos); + return CheckCollision(obj, nextPos, collideWithWormhole); } /// /// /// 可移动物体(圆)向矩形物体移动时,可移动且不会碰撞的最大距离。直接用double计算,防止误差 diff --git a/logic/GameEngine/MoveEngine.cs b/logic/GameEngine/MoveEngine.cs index 86e8b02c..76843fa6 100755 --- a/logic/GameEngine/MoveEngine.cs +++ b/logic/GameEngine/MoveEngine.cs @@ -23,7 +23,8 @@ namespace GameEngine public class MoveEngine( IMap gameMap, Func OnCollision, - Action EndMove + Action EndMove, + bool collideWithWormhole = false ) { /// @@ -46,6 +47,7 @@ public enum AfterCollision private readonly CollisionChecker collisionChecker = new(gameMap); private readonly Func OnCollision = OnCollision; + private bool collideWithWormhole = collideWithWormhole; /// /// 在无碰撞的前提下行走最远的距离 @@ -102,7 +104,7 @@ private bool LoopDo(IMovable obj, double direction, ref double deltaLen, long st do { flag = false; - IGameObj? collisionObj = collisionChecker.CheckCollisionWhenMoving(obj, res); + IGameObj? collisionObj = collisionChecker.CheckCollisionWhenMoving(obj, res, collideWithWormhole); if (collisionObj == null) break; diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index 8c7cf996..9812b56a 100755 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -240,7 +240,62 @@ public bool Construct(Ship ship, ConstructionType constructionType) { IsBackground = true }.Start(); return false; } - public bool Repair(Ship ship) + public bool RepairHome(Ship ship) + { + Home? home = ((Home?)gameMap.OneForInteract(ship.Position, GameObjType.Home)); + if (home == null) + { + return false; + } + if (home.HP.IsMaxV()) + { + return false; + } + long stateNum = ship.SetShipState(RunningStateType.Waiting, ShipStateType.Constructing); + if (stateNum == -1) + { + return false; + } + new Thread + ( + () => + { + ship.ThreadNum.WaitOne(); + if (!ship.StartThread(stateNum, RunningStateType.RunningActively)) + { + ship.ThreadNum.Release(); + return; + } + home.AddRepairNum(); + Thread.Sleep(GameData.CheckInterval); + new FrameRateTaskExecutor + ( + loopCondition: () => stateNum == ship.StateNum && gameMap.Timer.IsGaming, + loopToDo: () => + { + if (!home.Repair(ship.ConstructSpeed / GameData.NumOfStepPerSecond, ship)) + { + ship.ResetShipState(stateNum); + return false; + } + if (home.HP == home.HP.GetMaxV()) + { + ship.ResetShipState(stateNum); + return false; + } + return true; + }, + timeInterval: GameData.CheckInterval, + finallyReturn: () => 0 + ).Start(); + ship.ThreadNum.Release(); + home.SubRepairNum(); + } + ) + { IsBackground = true }.Start(); + return false; + } + public bool RepairWormhole(Ship ship) { Wormhole? wormhole = ((WormholeCell?)gameMap.OneForInteract(ship.Position, GameObjType.Wormhole))?.Wormhole; if (wormhole == null) @@ -295,8 +350,9 @@ public bool Repair(Ship ship) { IsBackground = true }.Start(); return false; } - public bool AddMoneyNaturally(Base team) + public bool TeamTask(Base team) { + Home home = team.Home; new Thread ( () => @@ -311,6 +367,18 @@ public bool AddMoneyNaturally(Base team) loopToDo: () => { team.AddMoney(team.MoneyAddPerSecond / GameData.NumOfStepPerSecond); + if (!home.HP.IsBelowMaxTimes(0.4)) + { + var ships = gameMap.ShipInTheRangeNotTeamID( + home.Position, GameData.FortRange, home.TeamID); + if (ships == null || ships.Count == 0) + { + return true; + } + var ship = ships[random.Next(ships.Count)]; + shipManager.BeAttacked(ship, + GameData.FortDamage / GameData.NumOfStepPerSecond, home.TeamID); + } return true; }, timeInterval: GameData.CheckInterval, diff --git a/logic/Gaming/AttackManager.cs b/logic/Gaming/AttackManager.cs index b6b79d62..23cdab9e 100755 --- a/logic/Gaming/AttackManager.cs +++ b/logic/Gaming/AttackManager.cs @@ -46,7 +46,8 @@ public AttackManager(Game game, Map gameMap, ShipManager shipManager) BulletBomb((Bullet)obj, null); } obj.CanMove.SetROri(false); - } + }, + collideWithWormhole: true ); this.game = game; } @@ -89,16 +90,25 @@ private void BombObj(Bullet bullet, GameObj objBeingShot) case GameObjType.Construction: var constructionType = ((Construction)objBeingShot).ConstructionType; var flag = ((Construction)objBeingShot).BeAttacked(bullet); - if (constructionType == ConstructionType.Community && flag) - game.RemoveBirthPoint( - ((Construction)objBeingShot).TeamID, - ((Construction)objBeingShot).Position); - else if (constructionType == ConstructionType.Factory && flag) - game.RemoveFactory(((Construction)objBeingShot).TeamID); + if (flag) + { + ((Construction)objBeingShot).IsActivated.SetROri(false); + if (constructionType == ConstructionType.Community) + { + game.RemoveBirthPoint( + ((Construction)objBeingShot).TeamID, + ((Construction)objBeingShot).Position); + } + else if (constructionType == ConstructionType.Factory) + { + game.RemoveFactory(((Construction)objBeingShot).TeamID); + } + } break; case GameObjType.Wormhole: + var previousHP = ((WormholeCell)objBeingShot).Wormhole.HP.GetValue(); ((WormholeCell)objBeingShot).Wormhole.BeAttacked(bullet); - if (((WormholeCell)objBeingShot).Wormhole.HP < GameData.WormholeHP / 2) + if (previousHP >= GameData.WormholeHP / 2 && ((WormholeCell)objBeingShot).Wormhole.HP < GameData.WormholeHP / 2) { var shipList = gameMap.ShipInTheList(((WormholeCell)objBeingShot).Wormhole.Cells); if (shipList != null) diff --git a/logic/Gaming/Game.cs b/logic/Gaming/Game.cs index 7d9f26ca..10a14aa4 100755 --- a/logic/Gaming/Game.cs +++ b/logic/Gaming/Game.cs @@ -114,7 +114,7 @@ public bool StartGame(int milliSeconds) // 开始游戏 foreach (var team in TeamList) { - actionManager.AddMoneyNaturally(team); + actionManager.TeamTask(team); ActivateShip(team.TeamID, ShipType.CivilShip); } gameMap.Timer.Start(() => { }, () => EndGame(), milliSeconds); @@ -220,13 +220,22 @@ public bool Recycle(long teamID, long shipID) } return false; } - public bool Repair(long teamID, long shipID) + public bool RepairHome(long teamID, long shipID) { if (!gameMap.Timer.IsGaming) return false; Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID); if (ship != null) - return actionManager.Repair(ship); + return actionManager.RepairHome(ship); + return false; + } + public bool RepairWormhole(long teamID, long shipID) + { + if (!gameMap.Timer.IsGaming) + return false; + Ship? ship = gameMap.FindShipInPlayerID(teamID, shipID); + if (ship != null) + return actionManager.RepairWormhole(ship); return false; } public bool Stop(long teamID, long shipID) diff --git a/logic/Preparation/Interface/IGameObj.cs b/logic/Preparation/Interface/IGameObj.cs index 427dcc0f..c97d456d 100755 --- a/logic/Preparation/Interface/IGameObj.cs +++ b/logic/Preparation/Interface/IGameObj.cs @@ -9,7 +9,7 @@ public interface IGameObj public GameObjType Type { get; } public long ID { get; } public XY Position { get; } // if Square, Pos equals the center - public bool IsRigid { get; } + public bool IsRigid(bool args = false); public AtomicBool IsRemoved { get; } public ShapeType Shape { get; } public int Radius { get; } // if Square, Radius equals half length of one side diff --git a/logic/Preparation/Interface/IMovable.cs b/logic/Preparation/Interface/IMovable.cs index 0392235d..cf97dd9d 100755 --- a/logic/Preparation/Interface/IMovable.cs +++ b/logic/Preparation/Interface/IMovable.cs @@ -17,12 +17,12 @@ public interface IMovable : IGameObj public long StateNum { get; } public Semaphore ThreadNum { get; } public long MovingSetPos(XY moveVec, long stateNum); - public bool WillCollideWith(IGameObj? targetObj, XY nextPos) // 检查下一位置是否会和目标物碰撞 + public bool WillCollideWith(IGameObj? targetObj, XY nextPos, bool collideWithWormhole = false) // 检查下一位置是否会和目标物碰撞 { if (targetObj == null) return false; // 会移动的只有子弹和人物,都是Circle - if (!targetObj.IsRigid || targetObj.ID == ID) + if (!targetObj.IsRigid(collideWithWormhole) || targetObj.ID == ID) return false; if (IgnoreCollideExecutor(targetObj) || targetObj.IgnoreCollideExecutor(this)) diff --git a/logic/Preparation/Utility/GameData.cs b/logic/Preparation/Utility/GameData.cs index b031f553..c124ab57 100755 --- a/logic/Preparation/Utility/GameData.cs +++ b/logic/Preparation/Utility/GameData.cs @@ -74,41 +74,41 @@ public static bool IsInTheRange(XY pos1, XY pos2, int range) public const int BulletRadius = 200; // 子弹半径 public const int LaserRange = 4000; // 激光射程 - public const int LaserDamage = 1200; // 激光伤害 + public const int LaserDamage = 800; // 激光伤害 public const double LaserArmorModifier = 1.5; // 激光装甲修正 public const double LaserShieldModifier = 0.6; // 激光护盾修正 public const int LaserSpeed = 20000; // 激光速度 - public const int LaserCastTime = 300; // 激光前摇时间 - public const int LaserSwingTime = 300; // 激光后摇时间 + public const int LaserCastTime = 500; // 激光前摇时间 + public const int LaserSwingTime = 1000; // 激光后摇时间 public const int PlasmaRange = 4000; // 等离子射程 - public const int PlasmaDamage = 1300; // 等离子伤害 + public const int PlasmaDamage = 1000; // 等离子伤害 public const double PlasmaArmorModifier = 2.0; // 等离子装甲修正 public const double PlasmaShieldModifier = 0.4; // 等离子护盾修正 public const int PlasmaSpeed = 10000; // 等离子速度 - public const int PlasmaCastTime = 400; // 等离子前摇时间 - public const int PlasmaSwingTime = 400; // 等离子后摇时间 + public const int PlasmaCastTime = 800; // 等离子前摇时间 + public const int PlasmaSwingTime = 1600; // 等离子后摇时间 public const int ShellRange = 4000; // 炮弹射程 - public const int ShellDamage = 1800; // 炮弹伤害 + public const int ShellDamage = 1200; // 炮弹伤害 public const double ShellArmorModifier = 0.4; // 炮弹装甲修正 public const double ShellShieldModifier = 1.5; // 炮弹护盾修正 public const int ShellSpeed = 8000; // 炮弹速度 - public const int ShellCastTime = 200; // 炮弹前摇时间 - public const int ShellSwingTime = 200; // 炮弹后摇时间 - public const int MissileRange = 8000; // 导弹射程 + public const int ShellCastTime = 500; // 炮弹前摇时间 + public const int ShellSwingTime = 1000; // 炮弹后摇时间 + public const int MissileRange = 6000; // 导弹射程 public const int MissileBombRange = 1600; // 导弹爆炸范围 - public const int MissileDamage = 1600; // 导弹伤害 + public const int MissileDamage = 1100; // 导弹伤害 public const double MissileArmorModifier = 1.0; // 导弹装甲修正 public const int MissileSpeed = 6000; // 导弹速度 - public const int MissileCastTime = 600; // 导弹前摇时间 - public const int MissileSwingTime = 600; // 导弹后摇时间 - public const int ArcRange = 8000; // 电弧射程 - public const int ArcDamageMin = 100; // 电弧伤害 - public const int ArcDamageMax = 3200; // 电弧伤害 + public const int MissileCastTime = 1200; // 导弹前摇时间 + public const int MissileSwingTime = 1800; // 导弹后摇时间 + public const int ArcRange = 6000; // 电弧射程 + public const int ArcDamageMin = 800; // 电弧伤害 + public const int ArcDamageMax = 1600; // 电弧伤害 public const double ArcArmorModifier = 2.0; // 电弧装甲修正 public const double ArcShieldModifier = 2.0; // 电弧护盾修正 public const int ArcSpeed = 8000; // 电弧速度 - public const int ArcCastTime = 600; // 电弧前摇时间 - public const int ArcSwingTime = 600; // 电弧后摇时间 + public const int ArcCastTime = 1200; // 电弧前摇时间 + public const int ArcSwingTime = 1800; // 电弧后摇时间 public const int CivilShipCost = 4000; public const int CivilShipMaxHP = 3000; @@ -165,7 +165,7 @@ public static bool IsInTheRange(XY pos1, XY pos2, int range) public const int FlagShipArcGunCost = 24000; public const int ScoreHomePerSecond = 100; - public const int ScoreFactoryPerSecond = 300; + public const int ScoreFactoryPerSecond = 200; public const int ScoreProducer1PerSecond = 100; public const int ScoreProducer2PerSecond = 200; public const int ScoreProducer3PerSecond = 300; @@ -184,14 +184,14 @@ public static bool IsInTheRange(XY pos1, XY pos2, int range) public const int Shield2 = 3000; public const int Shield3 = 4000; - public const int ResourceHP = 16000; - public const int FactoryHP = 8000; - public const int CommunityHP = 6000; - public const int FortHP = 12000; - public const int WormholeHP = 18000; - public const int HomeHP = 24000; + public const int ResourceHP = 32000; + public const int FactoryHP = 12000; + public const int CommunityHP = 10000; + public const int FortHP = 16000; + public const int WormholeHP = 24000; + public const int HomeHP = 48000; public const int FortRange = 6000; - public const int FortDamage = 500; + public const int FortDamage = 300; } } diff --git a/logic/Server/RpcServices.cs b/logic/Server/RpcServices.cs index 5976e25b..7a7c0863 100755 --- a/logic/Server/RpcServices.cs +++ b/logic/Server/RpcServices.cs @@ -342,6 +342,38 @@ public override Task Construct(ConstructMsg request, ServerCallContext return Task.FromResult(boolRes); } + public override Task RepairHome(IDMsg request, ServerCallContext context) + { + GameServerLogging.logger.ConsoleLogDebug( + $"TRY RepairHome: Player {request.PlayerId} from Team {request.TeamId}"); + BoolRes boolRes = new(); + if (request.PlayerId >= spectatorMinPlayerID) + { + boolRes.ActSuccess = false; + return Task.FromResult(boolRes); + } + // var gameID = communicationToGameID[request.TeamId][request.PlayerId]; + boolRes.ActSuccess = game.RepairHome(request.TeamId, request.PlayerId); + GameServerLogging.logger.ConsoleLogDebug("END RepairHome"); + return Task.FromResult(boolRes); + } + + public override Task RepairWormhole(IDMsg request, ServerCallContext context) + { + GameServerLogging.logger.ConsoleLogDebug( + $"TRY RepairWormhole: Player {request.PlayerId} from Team {request.TeamId}"); + BoolRes boolRes = new(); + if (request.PlayerId >= spectatorMinPlayerID) + { + boolRes.ActSuccess = false; + return Task.FromResult(boolRes); + } + // var gameID = communicationToGameID[request.TeamId][request.PlayerId]; + boolRes.ActSuccess = game.RepairWormhole(request.TeamId, request.PlayerId); + GameServerLogging.logger.ConsoleLogDebug("END RepairWormhole"); + return Task.FromResult(boolRes); + } + public override Task Attack(AttackMsg request, ServerCallContext context) { GameServerLogging.logger.ConsoleLogDebug(