From e30f9e2274bf2175561bcf413633333fe95f38d2 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 29 Mar 2024 16:41:37 +0800 Subject: [PATCH] 1 --- server/gameserver/mt/InGameVoice.cc | 18 ++++++++++++------ server/gameserver/mt/InGameVoice.h | 6 +++--- server/gameserver/mtb/InGameVoice.h | 8 +++++++- server/gameserver/mtb/mtb.all.cc | 4 +++- server/tools/protobuild/mt.proto | 2 ++ 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/server/gameserver/mt/InGameVoice.cc b/server/gameserver/mt/InGameVoice.cc index 779a1799..32ccc564 100644 --- a/server/gameserver/mt/InGameVoice.cc +++ b/server/gameserver/mt/InGameVoice.cc @@ -5,9 +5,9 @@ #include "mt/InGameVoice.h" IMPL_TABLE(mt::InGameVoice) -int mt::InGameVoice::play_interval = 0; -int mt::InGameVoice::series_kill_interval = 0; -std::map> mt::InGameVoice::type_hash_; +int mt::InGameVoice::s_play_interval = 0; +int mt::InGameVoice::s_series_kill_interval = 0; +std::map> mt::InGameVoice::s_type_hash_; namespace mt { @@ -46,13 +46,19 @@ namespace mt } _notify_object = ParseNotifyObject(notify_object()); { - auto itr = type_hash_.find(event_type()); - if (itr != type_hash_.end()) { + auto itr = s_type_hash_.find(event_type()); + if (itr != s_type_hash_.end()) { itr->second.push_back(this); } else { - type_hash_[event_type()] = std::vector({this}); + s_type_hash_[event_type()] = std::vector({this}); } } + if (play_interval() > 0) { + s_play_interval = play_interval(); + } + if (series_kill_interval() > 0) { + s_series_kill_interval = series_kill_interval(); + } } void InGameVoice::Init2() diff --git a/server/gameserver/mt/InGameVoice.h b/server/gameserver/mt/InGameVoice.h index 6fc24a58..bfead452 100644 --- a/server/gameserver/mt/InGameVoice.h +++ b/server/gameserver/mt/InGameVoice.h @@ -37,8 +37,8 @@ namespace mt "ingameVoice@ingameVoice.json", "id") public: - static int play_interval; - static int series_kill_interval; + static int s_play_interval; + static int s_series_kill_interval; void Init1(); void Init2(); @@ -48,7 +48,7 @@ namespace mt private: InGameVoiceNotifyObject_e _notify_object; - static std::map> type_hash_; + static std::map> s_type_hash_; }; diff --git a/server/gameserver/mtb/InGameVoice.h b/server/gameserver/mtb/InGameVoice.h index 7cd7e16a..a1bd0361 100644 --- a/server/gameserver/mtb/InGameVoice.h +++ b/server/gameserver/mtb/InGameVoice.h @@ -16,6 +16,8 @@ namespace mtb int cond() const { return cond_; }; const std::string notify_object() const { return notify_object_; }; int notify_fields() const { return notify_fields_; }; + int play_interval() const { return play_interval_; }; + int series_kill_interval() const { return series_kill_interval_; }; bool has_event_type() const { return __flags__.test(0);}; bool has_moba_is_play() const { return __flags__.test(1);}; @@ -23,6 +25,8 @@ namespace mtb bool has_cond() const { return __flags__.test(3);}; bool has_notify_object() const { return __flags__.test(4);}; bool has_notify_fields() const { return __flags__.test(5);}; + bool has_play_interval() const { return __flags__.test(6);}; + bool has_series_kill_interval() const { return __flags__.test(7);}; protected: @@ -32,9 +36,11 @@ namespace mtb int cond_ = 0; std::string notify_object_; int notify_fields_ = 0; + int play_interval_ = 0; + int series_kill_interval_ = 0; public: - std::bitset<6> __flags__; + std::bitset<8> __flags__; }; }; diff --git a/server/gameserver/mtb/mtb.all.cc b/server/gameserver/mtb/mtb.all.cc index fcc5b6fc..7d456c20 100644 --- a/server/gameserver/mtb/mtb.all.cc +++ b/server/gameserver/mtb/mtb.all.cc @@ -133,13 +133,15 @@ namespace mtb { std::shared_ptr meta_class = nullptr; if (!meta_class) { - meta_class = std::make_shared("InGameVoice", 6, 0); + meta_class = std::make_shared("InGameVoice", 8, 0); meta_class->SetSimpleField(0, "event_type", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, event_type_)); meta_class->SetSimpleField(1, "moba_is_play", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, moba_is_play_)); meta_class->SetSimpleField(2, "sound_id", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, sound_id_)); meta_class->SetSimpleField(3, "cond", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, cond_)); meta_class->SetSimpleField(4, "notify_object", a8::reflect::ET_STRING, my_offsetof2(InGameVoice, notify_object_)); meta_class->SetSimpleField(5, "notify_fields", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, notify_fields_)); + meta_class->SetSimpleField(6, "play_interval", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, play_interval_)); + meta_class->SetSimpleField(7, "series_kill_interval", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, series_kill_interval_)); } return meta_class; } diff --git a/server/tools/protobuild/mt.proto b/server/tools/protobuild/mt.proto index 8fa6a033..fc24a227 100755 --- a/server/tools/protobuild/mt.proto +++ b/server/tools/protobuild/mt.proto @@ -66,6 +66,8 @@ message InGameVoice optional int32 cond = 4; optional string notify_object = 5; optional int32 notify_fields = 6; + optional int32 play_interval = 7; + optional int32 series_kill_interval = 8; } message MapArea