From ecc478c4c2c906bcf971af438614716a5398aed0 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 6 Sep 2023 14:50:04 +0800 Subject: [PATCH] 1 --- server/gameserver/debugcmd.cc | 5 ----- server/gameserver/debugcmd.h | 1 - server/gameserver/mapinstance.cc | 14 ++------------ server/gameserver/mapmgr.cc | 5 ----- server/gameserver/mt/Map.cc | 5 +++++ server/gameserver/mt/Map.h | 1 + server/gameserver/mtb/Map.h | 6 ++++++ server/gameserver/mtb/mtb.all.cc | 4 +++- server/gameserver/player.cc | 5 ----- server/gameserver/roommgr.cc | 4 ++-- server/tools/protobuild/mt.proto | 6 ++++++ 11 files changed, 25 insertions(+), 31 deletions(-) diff --git a/server/gameserver/debugcmd.cc b/server/gameserver/debugcmd.cc index a4657849..6a382c15 100644 --- a/server/gameserver/debugcmd.cc +++ b/server/gameserver/debugcmd.cc @@ -11,11 +11,6 @@ bool DebugCmd::Enable() return App::Instance()->instance_id == 6; } -bool DebugCmd::EnableNewMap() -{ - return App::Instance()->instance_id == 3; -} - void DebugCmd::CreateSphere(Creature* c, const glm::vec3& pos, const glm::vec3& scale, diff --git a/server/gameserver/debugcmd.h b/server/gameserver/debugcmd.h index b5049349..5136b4e3 100644 --- a/server/gameserver/debugcmd.h +++ b/server/gameserver/debugcmd.h @@ -11,7 +11,6 @@ class DebugCmd public: static bool Enable(); - static bool EnableNewMap(); static void CreateSphere(Creature* c, const glm::vec3& pos, diff --git a/server/gameserver/mapinstance.cc b/server/gameserver/mapinstance.cc index 0276aa1b..a1d682ec 100644 --- a/server/gameserver/mapinstance.cc +++ b/server/gameserver/mapinstance.cc @@ -108,12 +108,7 @@ void MapInstance::Init() MAP_GRID_WIDTH); { navmesh_ = dtAllocNavMesh(); - std::string navmesh_file = "map4.bin"; -#ifdef DEBUG - if (DebugCmd::EnableNewMap() && map_id == 2002) { - navmesh_file = "map5.bin"; - } -#endif + std::string navmesh_file = map_meta_->navmesh_file(); FILE *fp = fopen((mt::MetaMgr::Instance()->GetResDir() + navmesh_file).c_str(), "rb"); if(fp){ //fseek(fp, 0, SEEK_END); @@ -1251,12 +1246,7 @@ void MapInstance::MarkConnectablePolys() { dtPolyRef startRef = INVALID_NAVMESH_POLYREF; { - glm::vec3 pos = glm::vec3(5120.000000000000f, 6.250846862793f, 5120.000000000000f); -#ifdef DEBUG - if (DebugCmd::EnableNewMap() && map_id == 2002) { - pos = glm::vec3(287.000000000000f, 6.19, 453); - } -#endif + glm::vec3 pos = map_meta_->GroundSamplingPos(); dtQueryFilter filter; filter.setIncludeFlags(0xffff); diff --git a/server/gameserver/mapmgr.cc b/server/gameserver/mapmgr.cc index 30f582e8..b9afe7fc 100644 --- a/server/gameserver/mapmgr.cc +++ b/server/gameserver/mapmgr.cc @@ -97,11 +97,6 @@ void MapMgr::AttachRoom(Room* room, RoomInitInfo& init_info) } #endif } -#endif -#ifdef DEBUG - if (DebugCmd::EnableNewMap()) { - map_instance = GetMapInstance(2002); - } #endif if (!map_instance) { A8_ABORT(); diff --git a/server/gameserver/mt/Map.cc b/server/gameserver/mt/Map.cc index cd480974..db9cf6a5 100644 --- a/server/gameserver/mt/Map.cc +++ b/server/gameserver/mt/Map.cc @@ -274,4 +274,9 @@ namespace mt return is_open(); } + glm::vec3 Map::GroundSamplingPos() const + { + + } + } diff --git a/server/gameserver/mt/Map.h b/server/gameserver/mt/Map.h index 7e781b04..f8fe6c46 100644 --- a/server/gameserver/mt/Map.h +++ b/server/gameserver/mt/Map.h @@ -43,6 +43,7 @@ namespace mt int RandSafeArea() const; bool IsPveMap() const; bool IsOpen() const; + glm::vec3 GroundSamplingPos() const; void Init1(); void Init2(); diff --git a/server/gameserver/mtb/Map.h b/server/gameserver/mtb/Map.h index 89bc4f5d..f6e0712a 100644 --- a/server/gameserver/mtb/Map.h +++ b/server/gameserver/mtb/Map.h @@ -35,6 +35,8 @@ namespace mtb int team() const { return team_; }; int star_condition() const { return star_condition_; }; int is_open() const { return is_open_; }; + const std::string ground_sampling_pos() const { return ground_sampling_pos_; }; + const std::string navmesh_file() const { return navmesh_file_; }; bool has_map_id() const { return __flags__.test(0);}; bool has_template_list() const { return __flags__.test(1);}; @@ -61,6 +63,8 @@ namespace mtb bool has_team() const { return __flags__.test(22);}; bool has_star_condition() const { return __flags__.test(23);}; bool has_is_opon() const { return __flags__.test(24);}; + bool has_ground_sampling_pos() const { return __flags__.test(25);}; + bool has_navmesh_file() const { return __flags__.test(26);}; protected: @@ -89,6 +93,8 @@ namespace mtb int team_ = 0; int star_condition_ = 0; int is_open_ = 0; + std::string ground_sampling_pos_; + std::string navmesh_file_; public: std::bitset<21> __flags__; diff --git a/server/gameserver/mtb/mtb.all.cc b/server/gameserver/mtb/mtb.all.cc index bcf0d90e..2726a272 100644 --- a/server/gameserver/mtb/mtb.all.cc +++ b/server/gameserver/mtb/mtb.all.cc @@ -71,7 +71,7 @@ namespace mtb { a8::reflect::Class* meta_class = nullptr; if (!meta_class) { - meta_class = new a8::reflect::Class("Map", 25, 0); + meta_class = new a8::reflect::Class("Map", 27, 0); meta_class->SetSimpleField(0, "map_id", a8::reflect::ET_INT32, my_offsetof2(Map, map_id_)); meta_class->SetSimpleField(1, "template_list", a8::reflect::ET_STRING, my_offsetof2(Map, template_list_)); meta_class->SetSimpleField(2, "map_name", a8::reflect::ET_STRING, my_offsetof2(Map, map_name_)); @@ -97,6 +97,8 @@ namespace mtb meta_class->SetSimpleField(22, "team", a8::reflect::ET_INT32, my_offsetof2(Map, team_)); meta_class->SetSimpleField(23, "star_condition", a8::reflect::ET_INT32, my_offsetof2(Map, star_condition_)); meta_class->SetSimpleField(24, "is_open", a8::reflect::ET_INT32, my_offsetof2(Map, is_open_)); + meta_class->SetSimpleField(25, "ground_sampling_pos", a8::reflect::ET_STRING, my_offsetof2(Map, ground_sampling_pos_)); + meta_class->SetSimpleField(26, "navmesh_fle", a8::reflect::ET_STRING, my_offsetof2(Map, navmesh_file_)); } return meta_class; } diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index f32ede33..aab13f4d 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -1440,11 +1440,6 @@ void Player::PushJoinRoomMsg() notifymsg.set_map_id(room->GetMapMeta()->map_id()); #if 1 notifymsg.set_map_id(1001); -#endif -#ifdef DEBUG - if (DebugCmd::EnableNewMap()) { - notifymsg.set_map_id(room->GetMapMeta()->map_id()); - } #endif notifymsg.set_map_width(room->GetMapMeta()->map_width()); notifymsg.set_map_height(room->GetMapMeta()->map_height()); diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index dd23786d..f442060f 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -33,8 +33,8 @@ #include #include -const int ROOM_NUM_UP_LIMIT = 1000; -const int HUM_NUM_DOWN_LIMIT = 2500; +static const int ROOM_NUM_UP_LIMIT = 1000; +static const int HUM_NUM_DOWN_LIMIT = 2500; static RoomType_e GetHumanRoomType(const std::shared_ptr netdata) { diff --git a/server/tools/protobuild/mt.proto b/server/tools/protobuild/mt.proto index 6f9578bb..505418dd 100755 --- a/server/tools/protobuild/mt.proto +++ b/server/tools/protobuild/mt.proto @@ -36,6 +36,12 @@ message Map optional string map_collider = 19; optional string world_object_file = 20; optional string terrain_file = 21; + optional int32 map_type = 22; + optional int32 team = 23; + optional int32 star_condition = 24; + optional int32 is_open = 25; + optional string ground_sampling_pos = 26; + optional string navmesh_file = 27; } message MapArea