This commit is contained in:
aozhiwei 2019-04-26 09:47:05 +08:00
parent 0119ab5556
commit 8e130a9243
2 changed files with 24 additions and 11 deletions

View File

@ -636,14 +636,23 @@ void Human::FindLocation()
}
{
std::vector<Entity*> objects;
int detection_flags = 0;
{
a8::SetBitFlag(detection_flags, ET_Obstacle);
a8::SetBitFlag(detection_flags, ET_Player);
for (auto& grid : grid_list) {
for (Entity* entity : grid->entity_list) {
switch (entity->entity_type) {
case ET_Obstacle:
{
if (TestCollision(entity)){
objects.push_back(entity);
}
}
break;
default:
{
}
break;
}
}
}
#if 0
room->CollisionDetection(this, detection_flags, objects);
#endif
if (objects.empty()) {
return;
}

View File

@ -399,10 +399,14 @@ void Room::CreateBuilding(int thing_id, float building_x, float building_y)
Obstacle* Room::CreateObstacle(int id, float x, float y)
{
return InternalCreateObstacle(id, x, y,
[] (Obstacle*)
{
});
Obstacle* entity = InternalCreateObstacle(id, x, y,
[] (Obstacle*)
{
});
if (entity) {
entity->BroadcastFullState();
}
return entity;
}
void Room::CreateLoot(int equip_id, Vector2D pos, int count)