From e67396b200866787acec18b7116ad63c6066abbb Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 8 Oct 2022 20:47:45 +0800 Subject: [PATCH 1/2] chore : add land to messagetype, add player view range to player message, add auto clang-format to proto cpp_output.sh --- CAPI/proto/Message2Clients.grpc.pb.cc | 0 CAPI/proto/Message2Clients.grpc.pb.h | 0 CAPI/proto/Message2Clients.pb.cc | 188 ++++++++++------ CAPI/proto/Message2Clients.pb.h | 132 +++++++++--- CAPI/proto/Message2Server.grpc.pb.cc | 0 CAPI/proto/Message2Server.grpc.pb.h | 0 CAPI/proto/Message2Server.pb.cc | 0 CAPI/proto/Message2Server.pb.h | 0 CAPI/proto/MessageType.grpc.pb.cc | 0 CAPI/proto/MessageType.grpc.pb.h | 0 CAPI/proto/MessageType.pb.cc | 43 ++-- CAPI/proto/MessageType.pb.h | 18 +- dependency/proto/.clang-format | 283 +++++++++++++++++++++++++ dependency/proto/Message2Clients.proto | 7 +- dependency/proto/Message2Server.proto | 0 dependency/proto/MessageType.proto | 16 +- dependency/proto/README.md | 0 dependency/proto/cpp_output.sh | 2 + dependency/proto/format.sh | 75 +++++++ 19 files changed, 633 insertions(+), 131 deletions(-) mode change 100755 => 100644 CAPI/proto/Message2Clients.grpc.pb.cc mode change 100755 => 100644 CAPI/proto/Message2Clients.grpc.pb.h mode change 100755 => 100644 CAPI/proto/Message2Clients.pb.cc mode change 100755 => 100644 CAPI/proto/Message2Clients.pb.h mode change 100755 => 100644 CAPI/proto/Message2Server.grpc.pb.cc mode change 100755 => 100644 CAPI/proto/Message2Server.grpc.pb.h mode change 100755 => 100644 CAPI/proto/Message2Server.pb.cc mode change 100755 => 100644 CAPI/proto/Message2Server.pb.h mode change 100755 => 100644 CAPI/proto/MessageType.grpc.pb.cc mode change 100755 => 100644 CAPI/proto/MessageType.grpc.pb.h mode change 100755 => 100644 CAPI/proto/MessageType.pb.cc mode change 100755 => 100644 CAPI/proto/MessageType.pb.h create mode 100755 dependency/proto/.clang-format mode change 100644 => 100755 dependency/proto/Message2Clients.proto mode change 100644 => 100755 dependency/proto/Message2Server.proto mode change 100644 => 100755 dependency/proto/MessageType.proto mode change 100644 => 100755 dependency/proto/README.md create mode 100755 dependency/proto/format.sh diff --git a/CAPI/proto/Message2Clients.grpc.pb.cc b/CAPI/proto/Message2Clients.grpc.pb.cc old mode 100755 new mode 100644 diff --git a/CAPI/proto/Message2Clients.grpc.pb.h b/CAPI/proto/Message2Clients.grpc.pb.h old mode 100755 new mode 100644 diff --git a/CAPI/proto/Message2Clients.pb.cc b/CAPI/proto/Message2Clients.pb.cc old mode 100755 new mode 100644 index 08047af..1d3a37f --- a/CAPI/proto/Message2Clients.pb.cc +++ b/CAPI/proto/Message2Clients.pb.cc @@ -40,10 +40,11 @@ namespace protobuf , guid_(int64_t{0}), chair_time_(0), - ground_time_(0), - player_id_(int64_t{0}), on_chair_(false), - on_ground_(false) + on_ground_(false), + view_range_(0), + ground_time_(0), + player_id_(int64_t{0}) { } struct MessageOfHumanDefaultTypeInternal @@ -82,7 +83,8 @@ namespace protobuf , movable_(false), - playerid_(int64_t{0}) + playerid_(int64_t{0}), + view_range_(0) { } struct MessageOfButcherDefaultTypeInternal @@ -294,6 +296,7 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, on_ground_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, ground_time_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, player_id_), + PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, view_range_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfHuman, buff_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfButcher, _internal_metadata_), @@ -312,6 +315,7 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfButcher, guid_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfButcher, movable_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfButcher, playerid_), + PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfButcher, view_range_), PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfButcher, buff_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::protobuf::MessageOfProp, _internal_metadata_), @@ -378,14 +382,14 @@ const uint32_t TableStruct_Message2Clients_2eproto::offsets[] PROTOBUF_SECTION_V }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::protobuf::MessageOfHuman)}, - {22, -1, -1, sizeof(::protobuf::MessageOfButcher)}, - {40, -1, -1, sizeof(::protobuf::MessageOfProp)}, - {52, -1, -1, sizeof(::protobuf::MessageOfPickedProp)}, - {63, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, - {70, -1, -1, sizeof(::protobuf::MessageOfMap)}, - {77, -1, -1, sizeof(::protobuf::MessageToClient)}, - {87, -1, -1, sizeof(::protobuf::MoveRes)}, - {95, -1, -1, sizeof(::protobuf::BoolRes)}, + {23, -1, -1, sizeof(::protobuf::MessageOfButcher)}, + {42, -1, -1, sizeof(::protobuf::MessageOfProp)}, + {54, -1, -1, sizeof(::protobuf::MessageOfPickedProp)}, + {65, -1, -1, sizeof(::protobuf::MessageOfMap_Row)}, + {72, -1, -1, sizeof(::protobuf::MessageOfMap)}, + {79, -1, -1, sizeof(::protobuf::MessageToClient)}, + {89, -1, -1, sizeof(::protobuf::MoveRes)}, + {97, -1, -1, sizeof(::protobuf::BoolRes)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = { @@ -402,7 +406,7 @@ static ::PROTOBUF_NAMESPACE_ID::Message const* const file_default_instances[] = const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\025Message2Clients.proto\022\010protobuf\032\021Messa" - "geType.proto\032\024Message2Server.proto\"\201\003\n\016M" + "geType.proto\032\024Message2Server.proto\"\225\003\n\016M" "essageOfHuman\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022\r\n\005s" "peed\030\003 \001(\005\022\014\n\004life\030\004 \001(\005\022\023\n\013hanged_time\030" "\005 \001(\005\022\"\n\032time_until_skill_available\030\006 \001(" @@ -411,15 +415,16 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ "_type\030\t \001(\0162\023.protobuf.HumanType\022\014\n\004guid" "\030\n \001(\003\022\020\n\010on_chair\030\013 \001(\010\022\022\n\nchair_time\030\014" " \001(\001\022\021\n\ton_ground\030\r \001(\010\022\023\n\013ground_time\030\016" - " \001(\001\022\021\n\tplayer_id\030\017 \001(\003\022%\n\004buff\030\020 \003(\0162\027." - "protobuf.HumanBuffType\"\270\002\n\020MessageOfButc" - "her\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005\022\r\n\005speed\030\003 \001(\005" - "\022\016\n\006damage\030\004 \001(\005\022\"\n\032time_until_skill_ava" - "ilable\030\005 \001(\001\022\"\n\005place\030\006 \001(\0162\023.protobuf.P" - "laceType\022 \n\004prop\030\007 \001(\0162\022.protobuf.PropTy" - "pe\022+\n\014butcher_type\030\010 \001(\0162\025.protobuf.Butc" - "herType\022\014\n\004guid\030\t \001(\003\022\017\n\007movable\030\n \001(\010\022\020" - "\n\010playerID\030\013 \001(\003\022\'\n\004buff\030\014 \003(\0162\031.protobu" + " \001(\001\022\021\n\tplayer_id\030\017 \001(\003\022\022\n\nview_range\030\020 " + "\001(\005\022%\n\004buff\030\021 \003(\0162\027.protobuf.HumanBuffTy" + "pe\"\314\002\n\020MessageOfButcher\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030" + "\002 \001(\005\022\r\n\005speed\030\003 \001(\005\022\016\n\006damage\030\004 \001(\005\022\"\n\032" + "time_until_skill_available\030\005 \001(\001\022\"\n\005plac" + "e\030\006 \001(\0162\023.protobuf.PlaceType\022 \n\004prop\030\007 \001" + "(\0162\022.protobuf.PropType\022+\n\014butcher_type\030\010" + " \001(\0162\025.protobuf.ButcherType\022\014\n\004guid\030\t \001(" + "\003\022\017\n\007movable\030\n \001(\010\022\020\n\010playerID\030\013 \001(\003\022\022\n\n" + "view_range\030\014 \001(\005\022\'\n\004buff\030\r \003(\0162\031.protobu" "f.ButcherBuffType\"\223\001\n\rMessageOfProp\022 \n\004t" "ype\030\001 \001(\0162\022.protobuf.PropType\022\t\n\001x\030\002 \001(\005" "\022\t\n\001y\030\003 \001(\005\022\030\n\020facing_direction\030\004 \001(\001\022\014\n" @@ -462,7 +467,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Cli const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Clients_2eproto = { false, false, - 2095, + 2135, descriptor_table_protodef_Message2Clients_2eproto, "Message2Clients.proto", &descriptor_table_Message2Clients_2eproto_once, @@ -509,13 +514,13 @@ namespace protobuf buff_(from.buff_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - ::memcpy(&x_, &from.x_, static_cast(reinterpret_cast(&on_ground_) - reinterpret_cast(&x_)) + sizeof(on_ground_)); + ::memcpy(&x_, &from.x_, static_cast(reinterpret_cast(&player_id_) - reinterpret_cast(&x_)) + sizeof(player_id_)); // @@protoc_insertion_point(copy_constructor:protobuf.MessageOfHuman) } inline void MessageOfHuman::SharedCtor() { - ::memset(reinterpret_cast(this) + static_cast(reinterpret_cast(&x_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&on_ground_) - reinterpret_cast(&x_)) + sizeof(on_ground_)); + ::memset(reinterpret_cast(this) + static_cast(reinterpret_cast(&x_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&player_id_) - reinterpret_cast(&x_)) + sizeof(player_id_)); } MessageOfHuman::~MessageOfHuman() @@ -553,7 +558,7 @@ namespace protobuf (void)cached_has_bits; buff_.Clear(); - ::memset(&x_, 0, static_cast(reinterpret_cast(&on_ground_) - reinterpret_cast(&x_)) + sizeof(on_ground_)); + ::memset(&x_, 0, static_cast(reinterpret_cast(&player_id_) - reinterpret_cast(&x_)) + sizeof(player_id_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -721,14 +726,24 @@ namespace protobuf else goto handle_unusual; continue; - // repeated .protobuf.HumanBuffType buff = 16; + // int32 view_range = 16; case 16: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 130)) + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 128)) + { + view_range_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + // repeated .protobuf.HumanBuffType buff = 17; + case 17: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 138)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_buff(), ptr, ctx); CHK_(ptr); } - else if (static_cast(tag) == 128) + else if (static_cast(tag) == 136) { uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -894,13 +909,20 @@ namespace protobuf target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(15, this->_internal_player_id(), target); } - // repeated .protobuf.HumanBuffType buff = 16; + // int32 view_range = 16; + if (this->_internal_view_range() != 0) + { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(16, this->_internal_view_range(), target); + } + + // repeated .protobuf.HumanBuffType buff = 17; { int byte_size = _buff_cached_byte_size_.load(std::memory_order_relaxed); if (byte_size > 0) { target = stream->WriteEnumPacked( - 16, buff_, byte_size, target + 17, buff_, byte_size, target ); } } @@ -924,7 +946,7 @@ namespace protobuf // Prevent compiler warnings about cached_has_bits being unused (void)cached_has_bits; - // repeated .protobuf.HumanBuffType buff = 16; + // repeated .protobuf.HumanBuffType buff = 17; { size_t data_size = 0; unsigned int count = static_cast(this->_internal_buff_size()); @@ -1023,6 +1045,27 @@ namespace protobuf total_size += 1 + 8; } + // bool on_chair = 11; + if (this->_internal_on_chair() != 0) + { + total_size += 1 + 1; + } + + // bool on_ground = 13; + if (this->_internal_on_ground() != 0) + { + total_size += 1 + 1; + } + + // int32 view_range = 16; + if (this->_internal_view_range() != 0) + { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_view_range() + ); + } + // double ground_time = 14; static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size."); double tmp_ground_time = this->_internal_ground_time(); @@ -1039,18 +1082,6 @@ namespace protobuf total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_player_id()); } - // bool on_chair = 11; - if (this->_internal_on_chair() != 0) - { - total_size += 1 + 1; - } - - // bool on_ground = 13; - if (this->_internal_on_ground() != 0) - { - total_size += 1 + 1; - } - return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } @@ -1129,6 +1160,18 @@ namespace protobuf { _internal_set_chair_time(from._internal_chair_time()); } + if (from._internal_on_chair() != 0) + { + _internal_set_on_chair(from._internal_on_chair()); + } + if (from._internal_on_ground() != 0) + { + _internal_set_on_ground(from._internal_on_ground()); + } + if (from._internal_view_range() != 0) + { + _internal_set_view_range(from._internal_view_range()); + } static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size."); double tmp_ground_time = from._internal_ground_time(); uint64_t raw_ground_time; @@ -1141,14 +1184,6 @@ namespace protobuf { _internal_set_player_id(from._internal_player_id()); } - if (from._internal_on_chair() != 0) - { - _internal_set_on_chair(from._internal_on_chair()); - } - if (from._internal_on_ground() != 0) - { - _internal_set_on_ground(from._internal_on_ground()); - } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -1172,7 +1207,7 @@ namespace protobuf _internal_metadata_.InternalSwap(&other->_internal_metadata_); buff_.InternalSwap(&other->buff_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(MessageOfHuman, on_ground_) + sizeof(MessageOfHuman::on_ground_) - PROTOBUF_FIELD_OFFSET(MessageOfHuman, x_)>( + PROTOBUF_FIELD_OFFSET(MessageOfHuman, player_id_) + sizeof(MessageOfHuman::player_id_) - PROTOBUF_FIELD_OFFSET(MessageOfHuman, x_)>( reinterpret_cast(&x_), reinterpret_cast(&other->x_) ); @@ -1208,13 +1243,13 @@ namespace protobuf buff_(from.buff_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - ::memcpy(&x_, &from.x_, static_cast(reinterpret_cast(&playerid_) - reinterpret_cast(&x_)) + sizeof(playerid_)); + ::memcpy(&x_, &from.x_, static_cast(reinterpret_cast(&view_range_) - reinterpret_cast(&x_)) + sizeof(view_range_)); // @@protoc_insertion_point(copy_constructor:protobuf.MessageOfButcher) } inline void MessageOfButcher::SharedCtor() { - ::memset(reinterpret_cast(this) + static_cast(reinterpret_cast(&x_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&playerid_) - reinterpret_cast(&x_)) + sizeof(playerid_)); + ::memset(reinterpret_cast(this) + static_cast(reinterpret_cast(&x_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&view_range_) - reinterpret_cast(&x_)) + sizeof(view_range_)); } MessageOfButcher::~MessageOfButcher() @@ -1252,7 +1287,7 @@ namespace protobuf (void)cached_has_bits; buff_.Clear(); - ::memset(&x_, 0, static_cast(reinterpret_cast(&playerid_) - reinterpret_cast(&x_)) + sizeof(playerid_)); + ::memset(&x_, 0, static_cast(reinterpret_cast(&view_range_) - reinterpret_cast(&x_)) + sizeof(view_range_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -1380,14 +1415,24 @@ namespace protobuf else goto handle_unusual; continue; - // repeated .protobuf.ButcherBuffType buff = 12; + // int32 view_range = 12; case 12: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 98)) + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 96)) + { + view_range_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } + else + goto handle_unusual; + continue; + // repeated .protobuf.ButcherBuffType buff = 13; + case 13: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 106)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_buff(), ptr, ctx); CHK_(ptr); } - else if (static_cast(tag) == 96) + else if (static_cast(tag) == 104) { uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -1517,13 +1562,20 @@ namespace protobuf target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(11, this->_internal_playerid(), target); } - // repeated .protobuf.ButcherBuffType buff = 12; + // int32 view_range = 12; + if (this->_internal_view_range() != 0) + { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(12, this->_internal_view_range(), target); + } + + // repeated .protobuf.ButcherBuffType buff = 13; { int byte_size = _buff_cached_byte_size_.load(std::memory_order_relaxed); if (byte_size > 0) { target = stream->WriteEnumPacked( - 12, buff_, byte_size, target + 13, buff_, byte_size, target ); } } @@ -1547,7 +1599,7 @@ namespace protobuf // Prevent compiler warnings about cached_has_bits being unused (void)cached_has_bits; - // repeated .protobuf.ButcherBuffType buff = 12; + // repeated .protobuf.ButcherBuffType buff = 13; { size_t data_size = 0; unsigned int count = static_cast(this->_internal_buff_size()); @@ -1642,6 +1694,12 @@ namespace protobuf total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_playerid()); } + // int32 view_range = 12; + if (this->_internal_view_range() != 0) + { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_view_range()); + } + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } @@ -1716,6 +1774,10 @@ namespace protobuf { _internal_set_playerid(from._internal_playerid()); } + if (from._internal_view_range() != 0) + { + _internal_set_view_range(from._internal_view_range()); + } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -1739,7 +1801,7 @@ namespace protobuf _internal_metadata_.InternalSwap(&other->_internal_metadata_); buff_.InternalSwap(&other->buff_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(MessageOfButcher, playerid_) + sizeof(MessageOfButcher::playerid_) - PROTOBUF_FIELD_OFFSET(MessageOfButcher, x_)>( + PROTOBUF_FIELD_OFFSET(MessageOfButcher, view_range_) + sizeof(MessageOfButcher::view_range_) - PROTOBUF_FIELD_OFFSET(MessageOfButcher, x_)>( reinterpret_cast(&x_), reinterpret_cast(&other->x_) ); diff --git a/CAPI/proto/Message2Clients.pb.h b/CAPI/proto/Message2Clients.pb.h old mode 100755 new mode 100644 index 576cf4e..82549e9 --- a/CAPI/proto/Message2Clients.pb.h +++ b/CAPI/proto/Message2Clients.pb.h @@ -268,7 +268,7 @@ namespace protobuf enum : int { - kBuffFieldNumber = 16, + kBuffFieldNumber = 17, kXFieldNumber = 1, kYFieldNumber = 2, kSpeedFieldNumber = 3, @@ -280,12 +280,13 @@ namespace protobuf kHumanTypeFieldNumber = 9, kGuidFieldNumber = 10, kChairTimeFieldNumber = 12, - kGroundTimeFieldNumber = 14, - kPlayerIdFieldNumber = 15, kOnChairFieldNumber = 11, kOnGroundFieldNumber = 13, + kViewRangeFieldNumber = 16, + kGroundTimeFieldNumber = 14, + kPlayerIdFieldNumber = 15, }; - // repeated .protobuf.HumanBuffType buff = 16; + // repeated .protobuf.HumanBuffType buff = 17; int buff_size() const; private: @@ -415,26 +416,6 @@ namespace protobuf double _internal_chair_time() const; void _internal_set_chair_time(double value); - public: - // double ground_time = 14; - void clear_ground_time(); - double ground_time() const; - void set_ground_time(double value); - - private: - double _internal_ground_time() const; - void _internal_set_ground_time(double value); - - public: - // int64 player_id = 15; - 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 on_chair = 11; void clear_on_chair(); @@ -455,6 +436,36 @@ namespace protobuf bool _internal_on_ground() const; void _internal_set_on_ground(bool value); + public: + // int32 view_range = 16; + void clear_view_range(); + int32_t view_range() const; + void set_view_range(int32_t value); + + private: + int32_t _internal_view_range() const; + void _internal_set_view_range(int32_t value); + + public: + // double ground_time = 14; + void clear_ground_time(); + double ground_time() const; + void set_ground_time(double value); + + private: + double _internal_ground_time() const; + void _internal_set_ground_time(double value); + + public: + // int64 player_id = 15; + 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.MessageOfHuman) @@ -478,10 +489,11 @@ namespace protobuf int human_type_; int64_t guid_; double chair_time_; - double ground_time_; - int64_t player_id_; bool on_chair_; bool on_ground_; + int32_t view_range_; + double ground_time_; + int64_t player_id_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_Message2Clients_2eproto; }; @@ -646,7 +658,7 @@ namespace protobuf enum : int { - kBuffFieldNumber = 12, + kBuffFieldNumber = 13, kXFieldNumber = 1, kYFieldNumber = 2, kSpeedFieldNumber = 3, @@ -658,8 +670,9 @@ namespace protobuf kButcherTypeFieldNumber = 8, kMovableFieldNumber = 10, kPlayerIDFieldNumber = 11, + kViewRangeFieldNumber = 12, }; - // repeated .protobuf.ButcherBuffType buff = 12; + // repeated .protobuf.ButcherBuffType buff = 13; int buff_size() const; private: @@ -789,6 +802,16 @@ namespace protobuf int64_t _internal_playerid() const; void _internal_set_playerid(int64_t value); + public: + // int32 view_range = 12; + void clear_view_range(); + int32_t view_range() const; + void set_view_range(int32_t value); + + private: + int32_t _internal_view_range() const; + void _internal_set_view_range(int32_t value); + public: // @@protoc_insertion_point(class_scope:protobuf.MessageOfButcher) @@ -812,6 +835,7 @@ namespace protobuf int butcher_type_; bool movable_; int64_t playerid_; + int32_t view_range_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_Message2Clients_2eproto; }; @@ -2718,7 +2742,31 @@ namespace protobuf // @@protoc_insertion_point(field_set:protobuf.MessageOfHuman.player_id) } - // repeated .protobuf.HumanBuffType buff = 16; + // int32 view_range = 16; + inline void MessageOfHuman::clear_view_range() + { + view_range_ = 0; + } + inline int32_t MessageOfHuman::_internal_view_range() const + { + return view_range_; + } + inline int32_t MessageOfHuman::view_range() const + { + // @@protoc_insertion_point(field_get:protobuf.MessageOfHuman.view_range) + return _internal_view_range(); + } + inline void MessageOfHuman::_internal_set_view_range(int32_t value) + { + view_range_ = value; + } + inline void MessageOfHuman::set_view_range(int32_t value) + { + _internal_set_view_range(value); + // @@protoc_insertion_point(field_set:protobuf.MessageOfHuman.view_range) + } + + // repeated .protobuf.HumanBuffType buff = 17; inline int MessageOfHuman::_internal_buff_size() const { return buff_.size(); @@ -3040,7 +3088,31 @@ namespace protobuf // @@protoc_insertion_point(field_set:protobuf.MessageOfButcher.playerID) } - // repeated .protobuf.ButcherBuffType buff = 12; + // int32 view_range = 12; + inline void MessageOfButcher::clear_view_range() + { + view_range_ = 0; + } + inline int32_t MessageOfButcher::_internal_view_range() const + { + return view_range_; + } + inline int32_t MessageOfButcher::view_range() const + { + // @@protoc_insertion_point(field_get:protobuf.MessageOfButcher.view_range) + return _internal_view_range(); + } + inline void MessageOfButcher::_internal_set_view_range(int32_t value) + { + view_range_ = value; + } + inline void MessageOfButcher::set_view_range(int32_t value) + { + _internal_set_view_range(value); + // @@protoc_insertion_point(field_set:protobuf.MessageOfButcher.view_range) + } + + // repeated .protobuf.ButcherBuffType buff = 13; inline int MessageOfButcher::_internal_buff_size() const { return buff_.size(); diff --git a/CAPI/proto/Message2Server.grpc.pb.cc b/CAPI/proto/Message2Server.grpc.pb.cc old mode 100755 new mode 100644 diff --git a/CAPI/proto/Message2Server.grpc.pb.h b/CAPI/proto/Message2Server.grpc.pb.h old mode 100755 new mode 100644 diff --git a/CAPI/proto/Message2Server.pb.cc b/CAPI/proto/Message2Server.pb.cc old mode 100755 new mode 100644 diff --git a/CAPI/proto/Message2Server.pb.h b/CAPI/proto/Message2Server.pb.h old mode 100755 new mode 100644 diff --git a/CAPI/proto/MessageType.grpc.pb.cc b/CAPI/proto/MessageType.grpc.pb.cc old mode 100755 new mode 100644 diff --git a/CAPI/proto/MessageType.grpc.pb.h b/CAPI/proto/MessageType.grpc.pb.h old mode 100755 new mode 100644 diff --git a/CAPI/proto/MessageType.pb.cc b/CAPI/proto/MessageType.pb.cc old mode 100755 new mode 100644 index b7b3836..4f47a0e --- a/CAPI/proto/MessageType.pb.cc +++ b/CAPI/proto/MessageType.pb.cc @@ -26,30 +26,31 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema* schemas = n static constexpr ::PROTOBUF_NAMESPACE_ID::Message* const* file_default_instances = nullptr; const char descriptor_table_protodef_MessageType_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\021MessageType.proto\022\010protobuf*]\n\tPlaceTy" - "pe\022\023\n\017NULL_PLACE_TYPE\020\000\022\010\n\004WALL\020\001\022\t\n\005GRA" - "SS\020\002\022\013\n\007MACHINE\020\003\022\010\n\004GATE\020\004\022\017\n\013HIDDEN_GA" - "TE\020\005*8\n\tShapeType\022\023\n\017NULL_SHAPE_TYPE\020\000\022\n" - "\n\006CIRCLE\020\001\022\n\n\006SQUARE\020\002*N\n\010PropType\022\022\n\016NU" - "LL_PROP_TYPE\020\000\022\n\n\006PTYPE1\020\001\022\n\n\006PTYPE2\020\002\022\n" - "\n\006PTYPE3\020\003\022\n\n\006PTYPE4\020\004*d\n\rHumanBuffType\022" - "\023\n\017NULL_HBUFF_TYPE\020\000\022\016\n\nHBUFFTYPE1\020\001\022\016\n\n" - "HBUFFTYPE2\020\002\022\016\n\nHBUFFTYPE3\020\003\022\016\n\nHBUFFTYP" - "E4\020\004*f\n\017ButcherBuffType\022\023\n\017NULL_BBUFF_TY" - "PE\020\000\022\016\n\nBBUFFTYPE1\020\001\022\016\n\nBBUFFTYPE2\020\002\022\016\n\n" - "BBUFFTYPE3\020\003\022\016\n\nBBUFFTYPE4\020\004*2\n\nPlayerTy" - "pe\022\020\n\014HUMAN_PLAYER\020\000\022\022\n\016BUTCHER_PLAYER\020\001" - "*`\n\tHumanType\022\023\n\017NULL_HUMAN_TYPE\020\000\022\016\n\nHU" - "MANTYPE1\020\001\022\016\n\nHUMANTYPE2\020\002\022\016\n\nHUMANTYPE3" - "\020\003\022\016\n\nHUMANTYPE4\020\004*l\n\013ButcherType\022\025\n\021NUL" - "L_BUTCHER_TYPE\020\000\022\020\n\014BUTCHERTYPE1\020\001\022\020\n\014BU" - "TCHERTYPE2\020\002\022\020\n\014BUTCHERTYPE3\020\003\022\020\n\014BUTCHE" - "RTYPE4\020\004b\006proto3"; + "\n\021MessageType.proto\022\010protobuf*g\n\tPlaceTy" + "pe\022\023\n\017NULL_PLACE_TYPE\020\000\022\010\n\004LAND\020\001\022\010\n\004WAL" + "L\020\002\022\t\n\005GRASS\020\003\022\013\n\007MACHINE\020\004\022\010\n\004GATE\020\005\022\017\n" + "\013HIDDEN_GATE\020\006*8\n\tShapeType\022\023\n\017NULL_SHAP" + "E_TYPE\020\000\022\n\n\006CIRCLE\020\001\022\n\n\006SQUARE\020\002*N\n\010Prop" + "Type\022\022\n\016NULL_PROP_TYPE\020\000\022\n\n\006PTYPE1\020\001\022\n\n\006" + "PTYPE2\020\002\022\n\n\006PTYPE3\020\003\022\n\n\006PTYPE4\020\004*d\n\rHuma" + "nBuffType\022\023\n\017NULL_HBUFF_TYPE\020\000\022\016\n\nHBUFFT" + "YPE1\020\001\022\016\n\nHBUFFTYPE2\020\002\022\016\n\nHBUFFTYPE3\020\003\022\016" + "\n\nHBUFFTYPE4\020\004*f\n\017ButcherBuffType\022\023\n\017NUL" + "L_BBUFF_TYPE\020\000\022\016\n\nBBUFFTYPE1\020\001\022\016\n\nBBUFFT" + "YPE2\020\002\022\016\n\nBBUFFTYPE3\020\003\022\016\n\nBBUFFTYPE4\020\004*H" + "\n\nPlayerType\022\024\n\020NULL_PLAYER_TYPE\020\000\022\020\n\014HU" + "MAN_PLAYER\020\001\022\022\n\016BUTCHER_PLAYER\020\002*`\n\tHuma" + "nType\022\023\n\017NULL_HUMAN_TYPE\020\000\022\016\n\nHUMANTYPE1" + "\020\001\022\016\n\nHUMANTYPE2\020\002\022\016\n\nHUMANTYPE3\020\003\022\016\n\nHU" + "MANTYPE4\020\004*l\n\013ButcherType\022\025\n\021NULL_BUTCHE" + "R_TYPE\020\000\022\020\n\014BUTCHERTYPE1\020\001\022\020\n\014BUTCHERTYP" + "E2\020\002\022\020\n\014BUTCHERTYPE3\020\003\022\020\n\014BUTCHERTYPE4\020\004" + "b\006proto3"; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_MessageType_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_MessageType_2eproto = { false, false, - 736, + 768, descriptor_table_protodef_MessageType_2eproto, "MessageType.proto", &descriptor_table_MessageType_2eproto_once, @@ -87,6 +88,7 @@ namespace protobuf case 3: case 4: case 5: + case 6: return true; default: return false; @@ -182,6 +184,7 @@ namespace protobuf { case 0: case 1: + case 2: return true; default: return false; diff --git a/CAPI/proto/MessageType.pb.h b/CAPI/proto/MessageType.pb.h old mode 100755 new mode 100644 index 7ce1ccb..a2c218d --- a/CAPI/proto/MessageType.pb.h +++ b/CAPI/proto/MessageType.pb.h @@ -59,11 +59,12 @@ namespace protobuf enum PlaceType : int { NULL_PLACE_TYPE = 0, - WALL = 1, - GRASS = 2, - MACHINE = 3, - GATE = 4, - HIDDEN_GATE = 5, + LAND = 1, + WALL = 2, + GRASS = 3, + MACHINE = 4, + GATE = 5, + HIDDEN_GATE = 6, PlaceType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), PlaceType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() }; @@ -217,13 +218,14 @@ namespace protobuf } enum PlayerType : int { - HUMAN_PLAYER = 0, - BUTCHER_PLAYER = 1, + NULL_PLAYER_TYPE = 0, + HUMAN_PLAYER = 1, + BUTCHER_PLAYER = 2, PlayerType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), PlayerType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() }; bool PlayerType_IsValid(int value); - constexpr PlayerType PlayerType_MIN = HUMAN_PLAYER; + constexpr PlayerType PlayerType_MIN = NULL_PLAYER_TYPE; constexpr PlayerType PlayerType_MAX = BUTCHER_PLAYER; constexpr int PlayerType_ARRAYSIZE = PlayerType_MAX + 1; diff --git a/dependency/proto/.clang-format b/dependency/proto/.clang-format new file mode 100755 index 0000000..f10f5bd --- /dev/null +++ b/dependency/proto/.clang-format @@ -0,0 +1,283 @@ +--- +BasedOnStyle: Microsoft +Language: CSharp +AccessModifierOffset: -4 +AlignAfterOpenBracket: BlockIndent +AlignArrayOfStructures: None +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Custom +BreakInheritanceList: AfterColon +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: AfterColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 0 +CommentPragmas: '^ THU pragma:' +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: Always +ExperimentalAutoDetectBinPacking: false +PackConstructorInitializers: CurrentLine +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Merge +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IndentAccessModifiers: false +IndentCaseLabels: true +IndentCaseBlocks: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequires: false +IndentWidth: 4 +IndentWrappedFunctionNames: true +InsertTrailingCommas: None +LambdaBodyIndentation: Signature +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +PointerAlignment: Left +QualifierAlignment: Leave +ReferenceAlignment: Pointer +ReflowComments: true +SeparateDefinitionBlocks: Leave +SortIncludes: Never +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpacesInSquareBrackets: false +SpaceInEmptyBlock: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInLineCommentPrefix: + Minimum: 1 +SpacesInParentheses: false +SpaceBeforeSquareBrackets: false +Standard: Latest +TabWidth: 4 +UseTab: Never +--- +BasedOnStyle: Google +Language: Cpp +AccessModifierOffset: -4 +AlignAfterOpenBracket: BlockIndent +AlignArrayOfStructures: None +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Custom +BreakInheritanceList: AfterColon +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: AfterColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 0 +CommentPragmas: '^ THU pragma:' +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: Always +ExperimentalAutoDetectBinPacking: false +PackConstructorInitializers: CurrentLine +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Merge +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IndentAccessModifiers: false +IndentCaseLabels: true +IndentCaseBlocks: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequires: false +IndentWidth: 4 +IndentWrappedFunctionNames: true +InsertTrailingCommas: None +LambdaBodyIndentation: Signature +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +PointerAlignment: Left +QualifierAlignment: Leave +ReferenceAlignment: Pointer +ReflowComments: true +SeparateDefinitionBlocks: Leave +SortIncludes: Never +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpacesInSquareBrackets: false +SpaceInEmptyBlock: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInLineCommentPrefix: + Minimum: 1 +SpacesInParentheses: false +SpaceBeforeSquareBrackets: false +Standard: c++17 +TabWidth: 4 +UseTab: Never + diff --git a/dependency/proto/Message2Clients.proto b/dependency/proto/Message2Clients.proto old mode 100644 new mode 100755 index e2588ad..75a196a --- a/dependency/proto/Message2Clients.proto +++ b/dependency/proto/Message2Clients.proto @@ -22,7 +22,8 @@ message MessageOfHuman bool on_ground = 13; // 是否倒地 double ground_time = 14; // 倒地时间 int64 player_id = 15; - repeated HumanBuffType buff = 16; + int32 view_range = 16; // 视野距离 + repeated HumanBuffType buff = 17; } message MessageOfButcher @@ -38,8 +39,8 @@ message MessageOfButcher int64 guid = 9; bool movable = 10; // 是否进入了攻击后摇 int64 playerID = 11; - repeated ButcherBuffType buff = 12; - + int32 view_range = 12; // 视野距离 + repeated ButcherBuffType buff = 13; } message MessageOfProp // 可拾取道具的信息 diff --git a/dependency/proto/Message2Server.proto b/dependency/proto/Message2Server.proto old mode 100644 new mode 100755 diff --git a/dependency/proto/MessageType.proto b/dependency/proto/MessageType.proto old mode 100644 new mode 100755 index a48b0ac..2041fe0 --- a/dependency/proto/MessageType.proto +++ b/dependency/proto/MessageType.proto @@ -7,11 +7,12 @@ enum PlaceType // 地图中的所有物件类型 NULL_PLACE_TYPE = 0; // 地图情况,其中Gate是总体的大门,HiddenGate是地窖 - WALL = 1; - GRASS = 2; - MACHINE = 3; - GATE = 4; - HIDDEN_GATE = 5; + LAND = 1; + WALL = 2; + GRASS = 3; + MACHINE = 4; + GATE = 5; + HIDDEN_GATE = 6; // 待补充有特殊效果的地形 } @@ -55,8 +56,9 @@ enum ButcherBuffType // 屠夫可用的增益效果类型 enum PlayerType { - HUMAN_PLAYER = 0; - BUTCHER_PLAYER = 1; + NULL_PLAYER_TYPE = 0; + HUMAN_PLAYER = 1; + BUTCHER_PLAYER = 2; } enum HumanType diff --git a/dependency/proto/README.md b/dependency/proto/README.md old mode 100644 new mode 100755 diff --git a/dependency/proto/cpp_output.sh b/dependency/proto/cpp_output.sh index 34ec741..ad44a16 100755 --- a/dependency/proto/cpp_output.sh +++ b/dependency/proto/cpp_output.sh @@ -4,5 +4,7 @@ protoc MessageType.proto --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_p protoc MessageType.proto --cpp_out=. protoc Message2Server.proto --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` protoc Message2Server.proto --cpp_out=. +chmod -R 755 ./ +./format.sh mv -f ./*.h ../../CAPI/proto mv -f ./*.cc ../../CAPI/proto \ No newline at end of file diff --git a/dependency/proto/format.sh b/dependency/proto/format.sh new file mode 100755 index 0000000..63bdd5a --- /dev/null +++ b/dependency/proto/format.sh @@ -0,0 +1,75 @@ +clang-format --version +if [ $? -eq 0 ] +then + for i in {1..10} + do + find . -iname "*.cs" \ + -or -iname "*.c" \ + -or -iname "*.h" \ + -or -iname "*.C" \ + -or -iname "*.H" \ + -or -iname "*.cpp" \ + -or -iname "*.hpp" \ + -or -iname "*.cc" \ + -or -iname "*.hh" \ + -or -iname "*.c++" \ + -or -iname "*.h++" \ + -or -iname "*.cxx" \ + -or -iname "*.hxx" \ + -or -iname "*.i" \ + -or -iname "*.ixx" \ + -or -iname "*.ipp" \ + -or -iname "*.i++" \ + | xargs clang-format -i + done +fi +clang-format-15 --version +if [ $? -eq 0 ] +then + for i in {1..10} + do + find . -iname "*.cs" \ + -or -iname "*.c" \ + -or -iname "*.h" \ + -or -iname "*.C" \ + -or -iname "*.H" \ + -or -iname "*.cpp" \ + -or -iname "*.hpp" \ + -or -iname "*.cc" \ + -or -iname "*.hh" \ + -or -iname "*.c++" \ + -or -iname "*.h++" \ + -or -iname "*.cxx" \ + -or -iname "*.hxx" \ + -or -iname "*.i" \ + -or -iname "*.ixx" \ + -or -iname "*.ipp" \ + -or -iname "*.i++" \ + | xargs clang-format-15 -i + done +fi +clang-format-14 --version +if [ $? -eq 0 ] +then + for i in {1..10} + do + find . -iname "*.cs" \ + -or -iname "*.c" \ + -or -iname "*.h" \ + -or -iname "*.C" \ + -or -iname "*.H" \ + -or -iname "*.cpp" \ + -or -iname "*.hpp" \ + -or -iname "*.cc" \ + -or -iname "*.hh" \ + -or -iname "*.c++" \ + -or -iname "*.h++" \ + -or -iname "*.cxx" \ + -or -iname "*.hxx" \ + -or -iname "*.i" \ + -or -iname "*.ixx" \ + -or -iname "*.ipp" \ + -or -iname "*.i++" \ + | xargs clang-format-14 -i + done +fi \ No newline at end of file From 4d27194b3ef41015a5a0f69bbe386d047b165ed2 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Sat, 8 Oct 2022 22:22:40 +0800 Subject: [PATCH 2/2] chore : add escape rpc interface --- CAPI/proto/Message2Clients.grpc.pb.cc | 54 ++++++- CAPI/proto/Message2Clients.grpc.pb.h | 213 ++++++++++++++++++++++++- CAPI/proto/Message2Clients.pb.cc | 7 +- dependency/proto/Message2Clients.proto | 1 + 4 files changed, 267 insertions(+), 8 deletions(-) diff --git a/CAPI/proto/Message2Clients.grpc.pb.cc b/CAPI/proto/Message2Clients.grpc.pb.cc index b93e36b..8e33e9d 100644 --- a/CAPI/proto/Message2Clients.grpc.pb.cc +++ b/CAPI/proto/Message2Clients.grpc.pb.cc @@ -35,6 +35,7 @@ namespace protobuf "/protobuf.AvailableService/CarryHuman", "/protobuf.AvailableService/ReleaseHuman", "/protobuf.AvailableService/HangHuman", + "/protobuf.AvailableService/Escape", }; std::unique_ptr AvailableService::NewStub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) @@ -57,7 +58,8 @@ namespace protobuf rpcmethod_Attack_(AvailableService_method_names[8], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_CarryHuman_(AvailableService_method_names[9], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), rpcmethod_ReleaseHuman_(AvailableService_method_names[10], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), - rpcmethod_HangHuman_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) + rpcmethod_HangHuman_(AvailableService_method_names[11], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel), + rpcmethod_Escape_(AvailableService_method_names[12], options.suffix_for_stats(), ::grpc::internal::RpcMethod::NORMAL_RPC, channel) { } @@ -373,6 +375,34 @@ namespace protobuf return result; } + ::grpc::Status AvailableService::Stub::Escape(::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_Escape_, context, request, response); + } + + void AvailableService::Stub::async::Escape(::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_Escape_, context, request, response, std::move(f)); + } + + void AvailableService::Stub::async::Escape(::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_Escape_, context, request, response, reactor); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::PrepareAsyncEscapeRaw(::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_Escape_, context, request); + } + + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AvailableService::Stub::AsyncEscapeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + auto* result = + this->PrepareAsyncEscapeRaw(context, request, cq); + result->StartCall(); + return result; + } + AvailableService::Service::Service() { AddMethod(new ::grpc::internal::RpcServiceMethod( @@ -541,6 +571,20 @@ namespace protobuf this ) )); + AddMethod(new ::grpc::internal::RpcServiceMethod( + AvailableService_method_names[12], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler( + [](AvailableService::Service* service, + ::grpc::ServerContext* ctx, + const ::protobuf::IDMsg* req, + ::protobuf::BoolRes* resp) + { + return service->Escape(ctx, req, resp); + }, + this + ) + )); } AvailableService::Service::~Service() @@ -641,4 +685,12 @@ namespace protobuf return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } + ::grpc::Status AvailableService::Service::Escape(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + } // namespace protobuf diff --git a/CAPI/proto/Message2Clients.grpc.pb.h b/CAPI/proto/Message2Clients.grpc.pb.h index a3fe8cc..4dc2515 100644 --- a/CAPI/proto/Message2Clients.grpc.pb.h +++ b/CAPI/proto/Message2Clients.grpc.pb.h @@ -164,6 +164,15 @@ namespace protobuf { return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncHangHumanRaw(context, request, cq)); } + virtual ::grpc::Status Escape(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> AsyncEscape(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(AsyncEscapeRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>> PrepareAsyncEscape(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>>(PrepareAsyncEscapeRaw(context, request, cq)); + } class async_interface { public: @@ -195,6 +204,8 @@ namespace protobuf virtual void ReleaseHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; virtual void HangHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0; virtual void HangHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void Escape(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) = 0; + virtual void Escape(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; }; typedef class async_interface experimental_async_interface; virtual class async_interface* async() @@ -234,6 +245,8 @@ namespace protobuf virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncReleaseHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncHangHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncHangHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* AsyncEscapeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface<::protobuf::BoolRes>* PrepareAsyncEscapeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) = 0; }; class Stub final : public StubInterface { @@ -356,6 +369,15 @@ namespace protobuf { return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncHangHumanRaw(context, request, cq)); } + ::grpc::Status Escape(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::protobuf::BoolRes* response) override; + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> AsyncEscape(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(AsyncEscapeRaw(context, request, cq)); + } + std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>> PrepareAsyncEscape(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) + { + return std::unique_ptr<::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>>(PrepareAsyncEscapeRaw(context, request, cq)); + } class async final : public StubInterface::async_interface { @@ -381,6 +403,8 @@ namespace protobuf void ReleaseHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; void HangHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override; void HangHuman(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void Escape(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, std::function) override; + void Escape(::grpc::ClientContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response, ::grpc::ClientUnaryReactor* reactor) override; private: friend class Stub; @@ -432,6 +456,8 @@ namespace protobuf ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncReleaseHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncHangHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncHangHumanRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* AsyncEscapeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader<::protobuf::BoolRes>* PrepareAsyncEscapeRaw(::grpc::ClientContext* context, const ::protobuf::IDMsg& request, ::grpc::CompletionQueue* cq) override; const ::grpc::internal::RpcMethod rpcmethod_AddPlayer_; const ::grpc::internal::RpcMethod rpcmethod_Move_; const ::grpc::internal::RpcMethod rpcmethod_PickProp_; @@ -444,6 +470,7 @@ namespace protobuf const ::grpc::internal::RpcMethod rpcmethod_CarryHuman_; const ::grpc::internal::RpcMethod rpcmethod_ReleaseHuman_; const ::grpc::internal::RpcMethod rpcmethod_HangHuman_; + const ::grpc::internal::RpcMethod rpcmethod_Escape_; }; static std::unique_ptr NewStub(const std::shared_ptr<::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); @@ -468,6 +495,7 @@ namespace protobuf virtual ::grpc::Status CarryHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); virtual ::grpc::Status ReleaseHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); virtual ::grpc::Status HangHuman(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); + virtual ::grpc::Status Escape(::grpc::ServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response); }; template class WithAsyncMethod_AddPlayer : public BaseClass @@ -805,7 +833,35 @@ namespace protobuf ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); } }; - typedef WithAsyncMethod_AddPlayer>>>>>>>>>>> AsyncService; + template + class WithAsyncMethod_Escape : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithAsyncMethod_Escape() + { + ::grpc::Service::MarkMethodAsync(12); + } + ~WithAsyncMethod_Escape() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Escape(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestEscape(::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(12, context, request, response, new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_AddPlayer>>>>>>>>>>>> AsyncService; template class WithCallbackMethod_AddPlayer : public BaseClass { @@ -1250,7 +1306,46 @@ namespace protobuf return nullptr; } }; - typedef WithCallbackMethod_AddPlayer>>>>>>>>>>> CallbackService; + template + class WithCallbackMethod_Escape : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithCallbackMethod_Escape() + { + ::grpc::Service::MarkMethodCallback(12, new ::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::CallbackServerContext* context, const ::protobuf::IDMsg* request, ::protobuf::BoolRes* response) + { return this->Escape(context, request, response); })); + } + void SetMessageAllocatorFor_Escape( + ::grpc::MessageAllocator<::protobuf::IDMsg, ::protobuf::BoolRes>* allocator + ) + { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12); + static_cast<::grpc::internal::CallbackUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_Escape() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Escape(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Escape( + ::grpc::CallbackServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/ + ) + { + return nullptr; + } + }; + typedef WithCallbackMethod_AddPlayer>>>>>>>>>>>> CallbackService; typedef CallbackService ExperimentalCallbackService; template class WithGenericMethod_AddPlayer : public BaseClass @@ -1541,6 +1636,30 @@ namespace protobuf } }; template + class WithGenericMethod_Escape : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithGenericMethod_Escape() + { + ::grpc::Service::MarkMethodGeneric(12); + } + ~WithGenericMethod_Escape() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Escape(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template class WithRawMethod_AddPlayer : public BaseClass { private: @@ -1877,6 +1996,34 @@ namespace protobuf } }; template + class WithRawMethod_Escape : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawMethod_Escape() + { + ::grpc::Service::MarkMethodRaw(12); + } + ~WithRawMethod_Escape() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Escape(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestEscape(::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); + } + }; + template class WithRawCallbackMethod_AddPlayer : public BaseClass { private: @@ -2249,6 +2396,37 @@ namespace protobuf } }; template + class WithRawCallbackMethod_Escape : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithRawCallbackMethod_Escape() + { + ::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->Escape(context, request, response); })); + } + ~WithRawCallbackMethod_Escape() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Escape(::grpc::ServerContext* /*context*/, const ::protobuf::IDMsg* /*request*/, ::protobuf::BoolRes* /*response*/) override + { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Escape( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/ + ) + { + return nullptr; + } + }; + template class WithStreamedUnaryMethod_Move : public BaseClass { private: @@ -2491,7 +2669,34 @@ namespace protobuf // replace default version of method with streamed unary virtual ::grpc::Status StreamedHangHuman(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; }; - typedef WithStreamedUnaryMethod_Move>>>>>>>> StreamedUnaryService; + template + class WithStreamedUnaryMethod_Escape : public BaseClass + { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) + { + } + + public: + WithStreamedUnaryMethod_Escape() + { + ::grpc::Service::MarkMethodStreamed(12, new ::grpc::internal::StreamedUnaryHandler<::protobuf::IDMsg, ::protobuf::BoolRes>([this](::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* streamer) + { return this->StreamedEscape(context, streamer); })); + } + ~WithStreamedUnaryMethod_Escape() override + { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Escape(::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 StreamedEscape(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer<::protobuf::IDMsg, ::protobuf::BoolRes>* server_unary_streamer) = 0; + }; + typedef WithStreamedUnaryMethod_Move>>>>>>>>> StreamedUnaryService; template class WithSplitStreamingMethod_AddPlayer : public BaseClass { @@ -2520,7 +2725,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 WithSplitStreamingMethod_AddPlayer>>>>>>>>> StreamedService; + typedef WithSplitStreamingMethod_AddPlayer>>>>>>>>>> StreamedService; }; } // namespace protobuf diff --git a/CAPI/proto/Message2Clients.pb.cc b/CAPI/proto/Message2Clients.pb.cc index 1d3a37f..ff9754d 100644 --- a/CAPI/proto/Message2Clients.pb.cc +++ b/CAPI/proto/Message2Clients.pb.cc @@ -442,7 +442,7 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ "+\n\013map_massage\030\004 \001(\0132\026.protobuf.MessageO" "fMap\"5\n\007MoveRes\022\024\n\014actual_speed\030\001 \001(\003\022\024\n" "\014actual_angle\030\002 \001(\001\"\036\n\007BoolRes\022\023\n\013act_su" - "ccess\030\001 \001(\0102\371\004\n\020AvailableService\022=\n\tAddP" + "ccess\030\001 \001(\0102\247\005\n\020AvailableService\022=\n\tAddP" "layer\022\023.protobuf.PlayerMsg\032\031.protobuf.Me" "ssageToClient0\001\022,\n\004Move\022\021.protobuf.MoveM" "sg\032\021.protobuf.MoveRes\0220\n\010PickProp\022\021.prot" @@ -458,7 +458,8 @@ const char descriptor_table_protodef_Message2Clients_2eproto[] PROTOBUF_SECTION_ "f.IDMsg\032\021.protobuf.BoolRes\0222\n\014ReleaseHum" "an\022\017.protobuf.IDMsg\032\021.protobuf.BoolRes\022/" "\n\tHangHuman\022\017.protobuf.IDMsg\032\021.protobuf." - "BoolResb\006proto3"; + "BoolRes\022,\n\006Escape\022\017.protobuf.IDMsg\032\021.pro" + "tobuf.BoolResb\006proto3"; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* const descriptor_table_Message2Clients_2eproto_deps[2] = { &::descriptor_table_Message2Server_2eproto, &::descriptor_table_MessageType_2eproto, @@ -467,7 +468,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Message2Cli const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Message2Clients_2eproto = { false, false, - 2135, + 2181, descriptor_table_protodef_Message2Clients_2eproto, "Message2Clients.proto", &descriptor_table_Message2Clients_2eproto_once, diff --git a/dependency/proto/Message2Clients.proto b/dependency/proto/Message2Clients.proto index 75a196a..0017aa3 100755 --- a/dependency/proto/Message2Clients.proto +++ b/dependency/proto/Message2Clients.proto @@ -107,5 +107,6 @@ service AvailableService rpc CarryHuman (IDMsg) returns (BoolRes); rpc ReleaseHuman (IDMsg) returns (BoolRes); rpc HangHuman (IDMsg) returns (BoolRes); + rpc Escape (IDMsg) returns (BoolRes); } \ No newline at end of file