This commit is contained in:
aozhiwei 2020-05-29 20:20:39 +08:00
parent 675d17f1bb
commit 1b9aa8c34a

View File

@ -951,7 +951,7 @@ void Room::CombineTeam()
hum->auto_fill = true; hum->auto_fill = true;
hum->team_uuid = a8::XValue(room_uuid_).GetString(); hum->team_uuid = a8::XValue(room_uuid_).GetString();
} }
for (size_t i = 0; i < 4 - accountid_hash_.size(); ++i) { for (size_t i = 0; i < MAX_TEAM_NUM - accountid_hash_.size(); ++i) {
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
Human* hum = pair.second; Human* hum = pair.second;
if (hum->IsAndroid() && if (hum->IsAndroid() &&
@ -1289,7 +1289,7 @@ void Room::RandRemoveAndroid()
RemoveFromMoveableHash(hum); RemoveFromMoveableHash(hum);
RemoveFromEntityHash(hum); RemoveFromEntityHash(hum);
RemoveFromHuamnHash(hum); RemoveFromHuamnHash(hum);
removed_robot_hash_[hum->entity_uniid] = hum; AddToRemovedRobotHash(hum);
--alive_count_; --alive_count_;
--App::Instance()->perf.alive_count; --App::Instance()->perf.alive_count;
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
@ -1300,7 +1300,8 @@ void Room::RandRemoveAndroid()
void Room::NotifyUiUpdate() void Room::NotifyUiUpdate()
{ {
xtimer.AddDeadLineTimerAndAttach(0, xtimer.AddDeadLineTimerAndAttach
(0,
a8::XParams() a8::XParams()
.SetSender(this), .SetSender(this),
[] (const a8::XParams& param) [] (const a8::XParams& param)
@ -1375,7 +1376,8 @@ bool Room::HaveMyTeam(const std::string& team_uuid)
void Room::NotifyWxVoip() void Room::NotifyWxVoip()
{ {
xtimer.AddDeadLineTimerAndAttach(0, xtimer.AddDeadLineTimerAndAttach
(0,
a8::XParams() a8::XParams()
.SetSender(this), .SetSender(this),
[] (const a8::XParams& param) [] (const a8::XParams& param)
@ -1418,7 +1420,8 @@ BornPoint* Room::AllocBornPoint(Human* hum)
} }
} else { } else {
for (auto& pair : born_point_hash_) { for (auto& pair : born_point_hash_) {
if (pair.second.player_num + pair.second.android_num < pair.second.thing_tpl->i->param1()) { if (pair.second.player_num + pair.second.android_num <
pair.second.thing_tpl->i->param1()) {
born_point = &pair.second; born_point = &pair.second;
break; break;
} }
@ -1454,7 +1457,6 @@ void Room::CreateSpawnPoints()
void Room::CreateLoots() void Room::CreateLoots()
{ {
if (loots_) {
for (auto& thing_tpl : *loots_) { for (auto& thing_tpl : *loots_) {
int thing_id = thing_tpl->RandThing(); int thing_id = thing_tpl->RandThing();
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id); MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id);
@ -1483,16 +1485,15 @@ void Room::CreateLoots()
} }
} }
} }
}
} }
void Room::CreateDropObjs() void Room::CreateDropObjs()
{ {
if (buildings_) {
for (auto& building : *buildings_) { for (auto& building : *buildings_) {
for (auto& obj : building->meta->i->dropobj()) { for (auto& obj : building->meta->i->dropobj()) {
CreateLoot(obj.id(), CreateLoot(obj.id(),
a8::Vec2( a8::Vec2
(
building->GetX() + obj.x() - building->meta->i->tilewidth() / 2.0, building->GetX() + obj.x() - building->meta->i->tilewidth() / 2.0,
building->GetY() + obj.y() - building->meta->i->tileheight() / 2.0 building->GetY() + obj.y() - building->meta->i->tileheight() / 2.0
), ),
@ -1501,7 +1502,6 @@ void Room::CreateDropObjs()
); );
} }
} }
}
} }
void Room::IncBornPointHumanNum(BornPoint* point, Human* hum) void Room::IncBornPointHumanNum(BornPoint* point, Human* hum)
@ -1605,7 +1605,9 @@ void Room::SecondRandPoint()
#endif #endif
for (auto& pair : accountid_hash_) { for (auto& pair : accountid_hash_) {
if (room_type_ == RT_MidBrid) { if (room_type_ == RT_MidBrid) {
pair.second->on_grid_chg = std::bind(&Room::OnHumanGridChg, this, std::placeholders::_1); pair.second->on_grid_chg = std::bind(&Room::OnHumanGridChg,
this,
std::placeholders::_1);
} }
} }
#ifdef DEBUG #ifdef DEBUG