1
This commit is contained in:
parent
5bdaf08212
commit
3655a279b9
@ -75,11 +75,6 @@ void GridCell::TraverseObstacles(std::function<void (Obstacle*, bool&)>& func,
|
||||
}
|
||||
}
|
||||
|
||||
void GridCell::AddPermanentEntity(Entity* entity)
|
||||
{
|
||||
entitys_[0].insert(entity);
|
||||
}
|
||||
|
||||
void GridCell::AddRoomEntity(Room* room, Entity* entity)
|
||||
{
|
||||
entitys_[room->GetRoomIdx()].insert(entity);
|
||||
|
@ -26,7 +26,6 @@ public:
|
||||
void AddCreature(Creature* c);
|
||||
void RemoveCreature(Creature* c);
|
||||
bool CreatureExists(Creature* c);
|
||||
void AddPermanentEntity(Entity* entity);
|
||||
void AddRoomEntity(Room* room, Entity* entity);
|
||||
void RemoveRoomEntity(Room* room, Entity* entity);
|
||||
bool EntityExists(Room* room, Entity* Entity);
|
||||
|
@ -233,36 +233,6 @@ void GridService::DelRoomEntity(Room* room, Entity* entity)
|
||||
cell.RemoveRoomEntity(room, entity);
|
||||
}
|
||||
|
||||
void GridService::AddPermanentEntity(Entity* entity)
|
||||
{
|
||||
assert(!entity->IsEntityType(ET_Player));
|
||||
int x = (int)entity->GetPos().GetX() + cell_width_;
|
||||
int y = (int)entity->GetPos().GetZ() + cell_width_;
|
||||
if (BroderOverFlow(x, y)) {
|
||||
#if 1
|
||||
f8::UdpLog::Instance()->Warning
|
||||
(
|
||||
"AddPermanentEntity broder over pos:%f,%f,%f new:%f,%f",
|
||||
{
|
||||
entity->GetPos().GetX(),
|
||||
entity->GetPos().GetY(),
|
||||
entity->GetPos().GetZ(),
|
||||
x,
|
||||
y
|
||||
}
|
||||
);
|
||||
return;
|
||||
#else
|
||||
A8_ABORT();
|
||||
#endif
|
||||
}
|
||||
entity->SetGridId(x/cell_width_ + (y/cell_width_) * cell_count_per_row_);
|
||||
if (entity->GetGridId() == 0 || entity->GetGridId() > max_grid_id_) {
|
||||
A8_ABORT();
|
||||
}
|
||||
cells_[entity->GetGridId()].AddPermanentEntity(entity);
|
||||
}
|
||||
|
||||
bool GridService::CreatureInGridList(Creature* c, std::set<GridCell*>& grid_list)
|
||||
{
|
||||
for (auto& cell : grid_list) {
|
||||
|
@ -30,8 +30,6 @@ class GridService
|
||||
void AddRoomEntity(Room* room, Entity* entity);
|
||||
void DelRoomEntity(Room* room, Entity* entity);
|
||||
|
||||
void AddPermanentEntity(Entity* entity);
|
||||
|
||||
bool CreatureInGridList(Creature* c, std::set<GridCell*>& grid_list);
|
||||
bool EntityInGridList(Room* room, Entity* entity, std::set<GridCell*>& grid_list);
|
||||
bool InView(int a_grid, int b_grid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user