完成新手出生点问题
This commit is contained in:
parent
bc83b602b7
commit
3af2905498
@ -130,7 +130,7 @@ public:
|
||||
MetaMgr::Instance()->gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("gas_inactive_time");
|
||||
|
||||
MetaMgr::Instance()->newbie_gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("newbie_gas_inactive_time", 10);
|
||||
MetaMgr::Instance()->newbie_born_point = MetaMgr::Instance()->GetSysParamAsInt("newbie_born_point");
|
||||
MetaMgr::Instance()->newbie_born_point = MetaMgr::Instance()->GetSysParamAsString("newbie_born_point");
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
std::string tmpstr = MetaMgr::Instance()->GetSysParamAsString("newbie_drop");
|
||||
|
@ -66,7 +66,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
int niube_win_times = 0;
|
||||
|
||||
int newbie_fill_interval = 0;
|
||||
int newbie_born_point = 0;
|
||||
std::string newbie_born_point;
|
||||
std::vector<int> newbie_drop;
|
||||
std::vector<int> newbie_airdrop;
|
||||
int newbie_first_robot_distance = 0;
|
||||
|
@ -1486,15 +1486,25 @@ BornPoint* Room::AllocBornPoint(Human* hum)
|
||||
return born_point;
|
||||
}
|
||||
|
||||
BornPoint* Room::GetBornPoint(int point_uniid)
|
||||
{
|
||||
auto itr = born_point_hash_.find(point_uniid);
|
||||
return itr != born_point_hash_.end() ? &itr->second : nullptr;
|
||||
}
|
||||
|
||||
void Room::CreateSpawnPoints()
|
||||
{
|
||||
if (!spawn_points || spawn_points->empty()) {
|
||||
abort();
|
||||
}
|
||||
for (auto& thing_tpl : *spawn_points) {
|
||||
int uniid = AllocUniid();
|
||||
BornPoint born_point;
|
||||
born_point.thing_tpl = thing_tpl;
|
||||
born_point_hash_[AllocUniid()] = born_point;
|
||||
born_point_hash_[uniid] = born_point;
|
||||
if (thing_tpl == newbie_born_point_meta) {
|
||||
newbie_born_point_uniid_ = uniid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1619,9 +1629,30 @@ void Room::SecondRandPoint()
|
||||
} else {
|
||||
hum->SetPos(hum->born_point->RandPoint());
|
||||
}
|
||||
hum->FindLocation();
|
||||
hum->RefreshView();
|
||||
grid_service->MoveHuman(hum);
|
||||
if (!a8::HasBitFlag(hum->status, HS_Disable)) {
|
||||
hum->FindLocation();
|
||||
hum->RefreshView();
|
||||
grid_service->MoveHuman(hum);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (room_type == RT_NewBrid) {
|
||||
for (auto& pair : accountid_hash_) {
|
||||
Human* hum = pair.second;
|
||||
BornPoint* newbie_point = GetBornPoint(newbie_born_point_uniid_);
|
||||
if (newbie_point && hum->born_point != newbie_point) {
|
||||
if (hum->born_point) {
|
||||
DecBornPointHumanNum(hum->born_point, hum);
|
||||
}
|
||||
hum->born_point = newbie_point;
|
||||
if (hum->born_point) {
|
||||
IncBornPointHumanNum(hum->born_point, hum);
|
||||
}
|
||||
hum->FindLocation();
|
||||
hum->RefreshView();
|
||||
grid_service->MoveHuman(hum);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
RoomType_e room_type = RT_NewBrid;
|
||||
long long last_add_player_tick = 0;
|
||||
std::vector<MetaData::MapTplThing*>* spawn_points = nullptr;
|
||||
MetaData::MapTplThing* newbie_born_point_meta = nullptr;
|
||||
std::vector<MetaData::MapTplThing*>* loots = nullptr;
|
||||
std::vector<Building*>* buildings = nullptr;
|
||||
|
||||
@ -143,6 +144,7 @@ private:
|
||||
void RandRemoveAndroid();
|
||||
void NotifyWxVoip();
|
||||
BornPoint* AllocBornPoint(Human* hum);
|
||||
BornPoint* GetBornPoint(int point_uniid);
|
||||
void CreateSpawnPoints();
|
||||
void CreateLoots();
|
||||
void CreateDropObjs();
|
||||
@ -161,6 +163,7 @@ private:
|
||||
MetaData::AirLine* airline_ = nullptr;
|
||||
a8::XTimerAttacher xtimer_attacher_;
|
||||
size_t airdrop_times_ = 0;
|
||||
int newbie_born_point_uniid_ = 0;
|
||||
|
||||
int current_teamid_ = 0;
|
||||
int current_uniid_ = FIXED_OBJECT_MAXID;
|
||||
|
@ -332,6 +332,7 @@ bool RoomMgr::IsLimitJoin()
|
||||
void RoomMgr::CreateThings()
|
||||
{
|
||||
std::string map_tpl_name = map_meta_->RandTemplate();
|
||||
std::map<std::string, MetaData::MapTplThing*> spawn_points_hash;
|
||||
std::vector<MetaData::MapTplThing>* things = MetaMgr::Instance()->GetMapTplThing(map_tpl_name);
|
||||
if (things) {
|
||||
for (auto& thing_tpl : *things) {
|
||||
@ -345,7 +346,12 @@ void RoomMgr::CreateThings()
|
||||
break;
|
||||
case kMOT_SpawnPoint:
|
||||
{
|
||||
if (spawn_points_hash.find(thing_tpl.i->name()) !=
|
||||
spawn_points_hash.end()) {
|
||||
abort();
|
||||
}
|
||||
spawn_points_.push_back(&thing_tpl);
|
||||
spawn_points_hash[thing_tpl.i->name()] = &thing_tpl;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -354,6 +360,10 @@ void RoomMgr::CreateThings()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (spawn_points_hash.find(MetaMgr::Instance()->newbie_born_point) !=
|
||||
spawn_points_hash.end()) {
|
||||
newbie_born_point_ = spawn_points_hash[MetaMgr::Instance()->newbie_born_point];
|
||||
}
|
||||
}
|
||||
|
||||
void RoomMgr::CreateMapObject(MetaData::MapTplThing& thing_tpl)
|
||||
@ -491,6 +501,7 @@ Room* RoomMgr::CreateRoom(RoomType_e room_type)
|
||||
room->grid_service = grid_service_;
|
||||
room->map_service = map_service_;
|
||||
room->spawn_points = &spawn_points_;
|
||||
room->newbie_born_point_meta = newbie_born_point_;
|
||||
room->loots = &loots_;
|
||||
room->buildings = &buildings_;
|
||||
if (GetRoomByUuid(room->room_uuid)) {
|
||||
|
@ -78,6 +78,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
GridService* grid_service_ = nullptr;
|
||||
MetaData::Map* map_meta_ = nullptr;
|
||||
std::vector<MetaData::MapTplThing*> spawn_points_;
|
||||
MetaData::MapTplThing* newbie_born_point_ = nullptr;
|
||||
std::vector<MetaData::MapTplThing*> loots_;
|
||||
std::vector<Building*> buildings_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user