This commit is contained in:
aozhiwei 2019-07-20 14:19:36 +08:00
parent 4719508948
commit ec39cb553c
3 changed files with 26 additions and 26 deletions

View File

@ -11,16 +11,16 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
cs::SMUpdate* msg = new cs::SMUpdate;
{
Room* room = hum->room;
for (auto& itr : hum->new_objects) {
for (auto& itr : hum->new_objects_) {
itr->FillMFObjectFull(msg->add_full_objects());
}
for (auto& itr : hum->part_objects) {
for (auto& itr : hum->part_objects_) {
itr->FillMFObjectPart(msg->add_part_objects());
}
for (auto& itr : hum->del_objects) {
for (auto& itr : hum->del_objects_) {
msg->add_del_objids(itr);
}
for (auto& itr : hum->out_objects) {
for (auto& itr : hum->out_objects_) {
msg->add_out_objids(itr);
}
for (size_t idx : hum->shots_) {

View File

@ -393,7 +393,7 @@ void Human::SyncAroundPlayers()
{
for (auto& cell : grid_list) {
for (Human* hum : cell->human_list) {
hum->new_objects.insert(this);
hum->new_objects_.insert(this);
}
}
}
@ -501,32 +501,32 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
void Human::AddToNewObjects(Entity* entity)
{
new_objects.insert(entity);
new_objects_.insert(entity);
}
void Human::AddToPartObjects(Entity* entity)
{
part_objects.insert(entity);
part_objects_.insert(entity);
}
void Human::RemovePartObjects(Entity* entity)
{
part_objects.erase(entity);
part_objects_.erase(entity);
}
void Human::RemoveObjects(Entity* entity)
{
del_objects.insert(entity->entity_uniid);
del_objects_.insert(entity->entity_uniid);
}
void Human::AddOutObjects(Entity* entity)
{
out_objects.insert(entity->entity_uniid);
out_objects_.insert(entity->entity_uniid);
}
void Human::RemoveOutObjects(Entity* entity)
{
out_objects.erase(entity->entity_uniid);
out_objects_.erase(entity->entity_uniid);
}
bool Human::HasLiveTeammate()
@ -872,7 +872,7 @@ void Human::SendUpdateMsg()
}
}
for (Entity* entity : view_objects) {
if (new_objects.find(entity) == new_objects.end()) {
if (new_objects_.find(entity) == new_objects_.end()) {
entity->FillMFObjectFull(msg->add_full_objects());
}
}
@ -1549,26 +1549,26 @@ void Human::PullHuman(const a8::Vec2& pull_dir, float distance)
void Human::ClearFrameData()
{
if (!new_objects.empty()) {
new_objects.clear();
if (!new_objects_.empty()) {
new_objects_.clear();
}
if (!del_objects.empty()) {
for (auto& itr : del_objects) {
if (!del_objects_.empty()) {
for (auto& itr : del_objects_) {
Entity* entity = room->GetEntityByUniId(itr);
if (entity) {
part_objects.erase(entity);
part_objects_.erase(entity);
}
}
del_objects.clear();
del_objects_.clear();
}
if (!out_objects.empty()) {
for (auto& itr : out_objects) {
if (!out_objects_.empty()) {
for (auto& itr : out_objects_) {
Entity* entity = room->GetEntityByUniId(itr);
if (entity) {
part_objects.erase(entity);
part_objects_.erase(entity);
}
}
out_objects.clear();
out_objects_.clear();
}
if (!shots_.empty()) {
shots_.clear();

View File

@ -217,10 +217,10 @@ protected:
std::array<int, IS_END - 1> inventory_ = {};
std::array<int, IS_END> volume_ = {};
std::set<Entity*> new_objects;
std::set<Entity*> part_objects;
std::set<int> del_objects;
std::set<int> out_objects;
std::set<Entity*> new_objects_;
std::set<Entity*> part_objects_;
std::set<int> del_objects_;
std::set<int> out_objects_;
std::vector<int> shots_;
std::vector<int> emotes_;
std::vector<int> bullets_;