From 60a274d2c0bbf17ed28fd2561adf736e3c5cdd16 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 10 Sep 2019 14:32:38 +0800 Subject: [PATCH] 1 --- server/gameserver/room.cc | 18 +++++++++++++++++- server/gameserver/room.h | 1 + server/gameserver/types.h | 1 + server/tools/protobuild/metatable.proto | 5 +++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 494ed12..44ca2e6 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -367,6 +367,12 @@ void Room::CreateThings() CreateObstacle(thing_id, thing_tpl.i->x(), thing_tpl.i->y()); } } else if (thing_id == BORN_POINT_THINGID) { + CreateBornPoint(thing_tpl.i->x(), + thing_tpl.i->y(), + thing_tpl.i->width(), + thing_tpl.i->height(), + thing_tpl.i->param1() + ); } else { MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id); if (equip_meta) { @@ -1484,11 +1490,21 @@ void Room::NotifyWxVoip() &xtimer_attacher.timer_list_); } +void Room::CreateBornPoint(int x, int y, int width, int height, int hum_limit) +{ + BornPoint born_point; + born_point.born_point_id = AllocUniid(); + born_point.pos = a8::Vec2(x, y); + born_point.rad = std::min(width, height); + born_point.hum_limit = hum_limit; + born_point_hash_[born_point.born_point_id] = born_point; +} + BornPoint* Room::AllocBornPoint(Human* hum) { BornPoint* born_point = nullptr; for (auto& pair : born_point_hash_) { - if (pair.second.player_num + pair.second.android_num < 6) { + if (pair.second.player_num + pair.second.android_num < pair.second.hum_limit) { born_point = &pair.second; break; } diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 7b11af0..085adb6 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -120,6 +120,7 @@ private: void OnGameOver(); void RandRemoveAndroid(); void NotifyWxVoip(); + void CreateBornPoint(int x, int y, int width, int height, int hum_limit); BornPoint* AllocBornPoint(Human* hum); private: diff --git a/server/gameserver/types.h b/server/gameserver/types.h index 6428d41..52e1c4f 100755 --- a/server/gameserver/types.h +++ b/server/gameserver/types.h @@ -128,5 +128,6 @@ struct BornPoint int player_num = 0; int android_num = 0; + int hum_limit = 0; a8::Vec2 RandPoint() const; }; diff --git a/server/tools/protobuild/metatable.proto b/server/tools/protobuild/metatable.proto index 61f5332..50f0d4b 100755 --- a/server/tools/protobuild/metatable.proto +++ b/server/tools/protobuild/metatable.proto @@ -248,4 +248,9 @@ message MapTplThingJson optional int32 weight = 4; optional float x = 5; optional float y = 6; + optional float height = 7; + optional float width = 8; + optional float param1 = 9; + optional float param2 = 10; + optional float param3 = 11; } \ No newline at end of file