This commit is contained in:
aozhiwei 2020-07-15 10:59:24 +08:00
parent a5364ad0ad
commit d782d47a53
3 changed files with 18 additions and 1 deletions

View File

@ -692,6 +692,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func)
return; return;
} }
#ifdef DEBUG #ifdef DEBUG
#if 0
room->CheckPartObjects(); room->CheckPartObjects();
a8::UdpLog::Instance()->Debug("room_idx:%d syncaround begin %s %d %s", a8::UdpLog::Instance()->Debug("room_idx:%d syncaround begin %s %d %s",
{ {
@ -701,12 +702,14 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func)
func func
}); });
#endif #endif
#endif
TouchAllLayerHumanList TouchAllLayerHumanList
( (
[this, file, line, func] (Human* hum, bool& stop) [this, file, line, func] (Human* hum, bool& stop)
{ {
hum->AddToNewObjects(this); hum->AddToNewObjects(this);
#ifdef DEBUG #ifdef DEBUG
#if 0
{ {
std::string objs_str; std::string objs_str;
for (auto& obj : hum->part_objects) { for (auto& obj : hum->part_objects) {
@ -723,6 +726,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func)
} }
room->CheckPartObjects(hum, this); room->CheckPartObjects(hum, this);
hum->InPartObjects(this); hum->InPartObjects(this);
#endif
#endif #endif
assert(hum->part_objects.find(this) != hum->part_objects.end()); assert(hum->part_objects.find(this) != hum->part_objects.end());
if (hum->part_objects.find(this) == hum->part_objects.end()) { if (hum->part_objects.find(this) == hum->part_objects.end()) {
@ -741,6 +745,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func)
} }
}); });
#ifdef DEBUG #ifdef DEBUG
#if 0
room->CheckPartObjects(); room->CheckPartObjects();
a8::UdpLog::Instance()->Debug("syncaround end %s %d %s", a8::UdpLog::Instance()->Debug("syncaround end %s %d %s",
{ {
@ -748,6 +753,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func)
line, line,
func func
}); });
#endif
#endif #endif
} }
@ -3277,12 +3283,14 @@ void Human::ProcDecGridList(std::set<GridCell*>& old_grids,
AddOutObjects(hum); AddOutObjects(hum);
hum->AddOutObjects(this); hum->AddOutObjects(this);
#ifdef DEBUG #ifdef DEBUG
#if 0
a8::UdpLog::Instance()->Debug("addoutobjects %d %d", a8::UdpLog::Instance()->Debug("addoutobjects %d %d",
{ {
(long long)hum, (long long)hum,
hum->GetEntityUniId() hum->GetEntityUniId()
}); });
#endif #endif
#endif
} }
}); });
room->grid_service->TouchAllLayerEntityList room->grid_service->TouchAllLayerEntityList

View File

@ -60,7 +60,7 @@ public:
std::list<metatable::Robot> robot_meta_list; std::list<metatable::Robot> robot_meta_list;
std::vector<MetaData::Robot> robot_list; std::vector<MetaData::Robot> robot_list;
std::list<metatable::AI> ai_meta_list; std::list<metatable::AI> ai_meta_list;
std::vector<MetaData::AI> ai_list; std::list<MetaData::AI> ai_list;
std::map<std::string, MetaData::Parameter*> parameter_hash; std::map<std::string, MetaData::Parameter*> parameter_hash;
std::map<int, MetaData::Map*> gamemap_hash; std::map<int, MetaData::Map*> gamemap_hash;

View File

@ -533,6 +533,7 @@ void Room::RemoveObjectLater(RoomEntity* entity)
} }
entity->room->RemoveFromEntityHash(entity); entity->room->RemoveFromEntityHash(entity);
#ifdef DEBUG #ifdef DEBUG
#if 0
a8::UdpLog::Instance()->Debug a8::UdpLog::Instance()->Debug
( (
"remove object pointer:%d uniid:%d", "remove object pointer:%d uniid:%d",
@ -541,6 +542,7 @@ void Room::RemoveObjectLater(RoomEntity* entity)
entity->GetEntityUniId() entity->GetEntityUniId()
} }
); );
#endif
#endif #endif
delete entity; delete entity;
}; };
@ -2371,6 +2373,7 @@ bool Room::RuningInTimer()
#ifdef DEBUG #ifdef DEBUG
void Room::InitDebugInfo() void Room::InitDebugInfo()
{ {
#if 0
xtimer.AddRepeatTimer xtimer.AddRepeatTimer
( (
SERVER_FRAME_RATE * 3, SERVER_FRAME_RATE * 3,
@ -2385,14 +2388,17 @@ void Room::InitDebugInfo()
room->RealAliveCount() room->RealAliveCount()
}); });
}); });
#endif
} }
void Room::UnInitDebugInfo() void Room::UnInitDebugInfo()
{ {
#if 0
a8::UdpLog::Instance()->Debug("destroy room_idx:%d", a8::UdpLog::Instance()->Debug("destroy room_idx:%d",
{ {
GetRoomIdx() GetRoomIdx()
}); });
#endif
} }
#endif #endif
@ -2906,6 +2912,9 @@ void Room::InitAndroidAI()
} }
} }
for (Android* hum : androids) { for (Android* hum : androids) {
#if 1
hum->SetAiLevel(2);
#endif
if (IsMiniRoom()) { if (IsMiniRoom()) {
int rnd = rand() % MetaMgr::Instance()->mini_room_ai_weights_space; int rnd = rand() % MetaMgr::Instance()->mini_room_ai_weights_space;
++rnd; ++rnd;