1
This commit is contained in:
parent
345334c37c
commit
a88bf63b7c
@ -47,8 +47,8 @@ class Human : public Entity
|
|||||||
|
|
||||||
std::set<Human*> my_seen_players;
|
std::set<Human*> my_seen_players;
|
||||||
std::set<Human*> seen_me_players;
|
std::set<Human*> seen_me_players;
|
||||||
std::set<Human*> new_players;
|
std::set<Entity*> new_objects;
|
||||||
std::set<Human*> part_players;
|
std::set<Entity*> part_objects;
|
||||||
|
|
||||||
Human();
|
Human();
|
||||||
virtual ~Human() override;
|
virtual ~Human() override;
|
||||||
|
@ -62,8 +62,8 @@ void Player::Update(int delta_time)
|
|||||||
MakeUpdateMsg();
|
MakeUpdateMsg();
|
||||||
SendNotifyMsg(*update_msg);
|
SendNotifyMsg(*update_msg);
|
||||||
{
|
{
|
||||||
if (!new_players.empty()) {
|
if (!new_objects.empty()) {
|
||||||
new_players.clear();
|
new_objects.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ void Player::MakeUpdateMsg()
|
|||||||
for (auto& obj_uniid : room->frame_data.deleted_objects) {
|
for (auto& obj_uniid : room->frame_data.deleted_objects) {
|
||||||
update_msg->add_del_objids(obj_uniid);
|
update_msg->add_del_objids(obj_uniid);
|
||||||
}
|
}
|
||||||
for (auto& itr : new_players) {
|
for (auto& itr : new_objects) {
|
||||||
itr->FillMFObjectFull(update_msg->add_full_objects());
|
itr->FillMFObjectFull(update_msg->add_full_objects());
|
||||||
#if 0
|
#if 0
|
||||||
if (itr->frame_data.bullets.size() > 0) {
|
if (itr->frame_data.bullets.size() > 0) {
|
||||||
@ -224,7 +224,7 @@ void Player::MakeUpdateMsg()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
for (auto& itr : part_players) {
|
for (auto& itr : part_objects) {
|
||||||
itr->FillMFObjectPart(update_msg->add_part_objects());
|
itr->FillMFObjectPart(update_msg->add_part_objects());
|
||||||
#if 0
|
#if 0
|
||||||
if (itr->frame_data.bullets.size() > 0) {
|
if (itr->frame_data.bullets.size() > 0) {
|
||||||
@ -246,10 +246,10 @@ void Player::MakeUpdateMsg()
|
|||||||
if (!update_msg->del_objids_size() > 0) {
|
if (!update_msg->del_objids_size() > 0) {
|
||||||
a8::SetBitFlag(data_flags32, F_del_objids);
|
a8::SetBitFlag(data_flags32, F_del_objids);
|
||||||
}
|
}
|
||||||
if (!new_players.empty()) {
|
if (!new_objects.empty()) {
|
||||||
a8::SetBitFlag(data_flags32, F_full_objects);
|
a8::SetBitFlag(data_flags32, F_full_objects);
|
||||||
}
|
}
|
||||||
if (!part_players.empty()) {
|
if (!part_objects.empty()) {
|
||||||
a8::SetBitFlag(data_flags32, F_part_objects);
|
a8::SetBitFlag(data_flags32, F_part_objects);
|
||||||
}
|
}
|
||||||
if (update_msg->bullets_size() > 0) {
|
if (update_msg->bullets_size() > 0) {
|
||||||
|
@ -81,14 +81,14 @@ void Room::AddPlayer(Player* hum)
|
|||||||
accountid_hash_[hum->account_id] = hum;
|
accountid_hash_[hum->account_id] = hum;
|
||||||
human_hash_[hum->entity_uniid] = hum;
|
human_hash_[hum->entity_uniid] = hum;
|
||||||
++alive_count_;
|
++alive_count_;
|
||||||
hum->new_players.insert(hum);
|
hum->new_objects.insert(hum);
|
||||||
hum->part_players.insert(hum);
|
hum->part_objects.insert(hum);
|
||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
if (pair.second != hum) {
|
if (pair.second != hum) {
|
||||||
pair.second->new_players.insert(hum);
|
pair.second->new_objects.insert(hum);
|
||||||
pair.second->part_players.insert(hum);
|
pair.second->part_objects.insert(hum);
|
||||||
hum->new_players.insert(pair.second);
|
hum->new_objects.insert(pair.second);
|
||||||
hum->part_players.insert(pair.second);
|
hum->part_objects.insert(pair.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,10 +130,10 @@ void Room::ShuaAndroid()
|
|||||||
|
|
||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
if (pair.second != hum) {
|
if (pair.second != hum) {
|
||||||
pair.second->new_players.insert(hum);
|
pair.second->new_objects.insert(hum);
|
||||||
pair.second->part_players.insert(hum);
|
pair.second->part_objects.insert(hum);
|
||||||
hum->new_players.insert(pair.second);
|
hum->new_objects.insert(pair.second);
|
||||||
hum->part_players.insert(pair.second);
|
hum->part_objects.insert(pair.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,8 +142,17 @@ void Room::ShuaAndroid()
|
|||||||
void Room::ShuaObstacle(Human* hum)
|
void Room::ShuaObstacle(Human* hum)
|
||||||
{
|
{
|
||||||
MetaData::MapThing* thing = MetaMgr::Instance()->GetMapThing(61001);
|
MetaData::MapThing* thing = MetaMgr::Instance()->GetMapThing(61001);
|
||||||
if (!thing) {
|
if (thing) {
|
||||||
return;
|
Obstacle* entity = new Obstacle();
|
||||||
|
entity->room = this;
|
||||||
|
entity->meta = thing;
|
||||||
|
entity->entity_uniid = AllocUniid();
|
||||||
|
entity->Initialize();
|
||||||
|
uniid_hash_[entity->entity_uniid] = entity;
|
||||||
|
for (auto& pair : human_hash_) {
|
||||||
|
pair.second->new_objects.insert(entity);
|
||||||
|
pair.second->part_objects.insert(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user