开始后组队玩家跳到统一的出生点
This commit is contained in:
parent
2c06f591c9
commit
ddd77d25d2
@ -1635,23 +1635,7 @@ BornPoint* Room::AllocBornPoint(Human* hum)
|
||||
}
|
||||
}
|
||||
if (pre_point) {
|
||||
switch (hum->entity_subtype) {
|
||||
case EST_Player:
|
||||
{
|
||||
--pre_point->player_num;
|
||||
}
|
||||
break;
|
||||
case EST_Android:
|
||||
{
|
||||
--pre_point->android_num;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
DecBornPointHumanNum(pre_point, hum);
|
||||
}
|
||||
if (!free_point_list.empty()) {
|
||||
born_point = free_point_list[rand() % free_point_list.size()];
|
||||
@ -1667,22 +1651,7 @@ BornPoint* Room::AllocBornPoint(Human* hum)
|
||||
}
|
||||
}
|
||||
if (born_point) {
|
||||
switch (hum->entity_subtype) {
|
||||
case EST_Player:
|
||||
{
|
||||
++born_point->player_num;
|
||||
}
|
||||
break;
|
||||
case EST_Android:
|
||||
{
|
||||
++born_point->android_num;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
DecBornPointHumanNum(born_point, hum);
|
||||
}
|
||||
return born_point;
|
||||
}
|
||||
@ -1731,15 +1700,72 @@ void Room::CreateMapSpawnPoint(MetaData::MapTplThing& thing_tpl)
|
||||
born_point_hash_[AllocUniid()] = born_point;
|
||||
}
|
||||
|
||||
void Room::IncBornPointHumanNum(BornPoint* point, Human* hum)
|
||||
{
|
||||
switch (hum->entity_subtype) {
|
||||
case EST_Player:
|
||||
{
|
||||
++point->player_num;
|
||||
}
|
||||
break;
|
||||
case EST_Android:
|
||||
{
|
||||
++point->android_num;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Room::DecBornPointHumanNum(BornPoint* point, Human* hum)
|
||||
{
|
||||
switch (hum->entity_subtype) {
|
||||
case EST_Player:
|
||||
{
|
||||
--point->player_num;
|
||||
}
|
||||
break;
|
||||
case EST_Android:
|
||||
{
|
||||
--point->android_num;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Room::SecondRandPoint()
|
||||
{
|
||||
for (auto& pair : accountid_hash_) {
|
||||
Human* hum = pair.second;
|
||||
hum->born_point = AllocBornPoint(hum);
|
||||
}
|
||||
for (auto& pair : team_hash_) {
|
||||
if (pair.second.size() < 2) {
|
||||
continue;
|
||||
}
|
||||
Human* target = nullptr;
|
||||
for (Human* hum : pair.second) {
|
||||
if (!target) {
|
||||
target = hum;
|
||||
} else {
|
||||
if (target->born_point) {
|
||||
if (hum->born_point) {
|
||||
DecBornPointHumanNum(hum->born_point, hum);
|
||||
}
|
||||
hum->born_point = target->born_point;
|
||||
if (!hum->born_point) {
|
||||
hum->SetX(DEFAULT_BORN_POINT_X + rand() % 100);
|
||||
hum->SetY(DEFAULT_BORN_POINT_Y + rand() % 200);
|
||||
} else {
|
||||
IncBornPointHumanNum(hum->born_point, hum);
|
||||
hum->SetPos(hum->born_point->RandPoint());
|
||||
}
|
||||
hum->FindLocation();
|
||||
@ -1747,6 +1773,9 @@ void Room::SecondRandPoint()
|
||||
grid_service.MoveHuman(hum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Room::NotifyGameStart()
|
||||
{
|
||||
|
@ -135,6 +135,8 @@ private:
|
||||
BornPoint* AllocBornPoint(Human* hum);
|
||||
void CreateMapObject(MetaData::MapTplThing& thing_tpl);
|
||||
void CreateMapSpawnPoint(MetaData::MapTplThing& thing_tpl);
|
||||
void IncBornPointHumanNum(BornPoint* point, Human* hum);
|
||||
void DecBornPointHumanNum(BornPoint* point, Human* hum);
|
||||
void SecondRandPoint();
|
||||
void NotifyGameStart();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user