diff --git a/server/gameserver/mapinstance.cc b/server/gameserver/mapinstance.cc index b26264c1..4551894c 100644 --- a/server/gameserver/mapinstance.cc +++ b/server/gameserver/mapinstance.cc @@ -889,8 +889,27 @@ bool MapInstance::SceneRaycast(const glm::vec3& orig, glm::vec3 nearest_pt(0.0f, 0.0f, 0.0f); int raycast_index = MapMgr::Instance()->IncCurrRaycastIndex(); float len = 0.0f; - while (true) { + do { + glm::vec3 curr_pos = orig + dir * len; + len += 5.0f; + if (len > max_distance) { + len = max_distance; + curr_pos = orig + dir * len; + } + int grid_id = map_service_->GetGridId(curr_pos.x, curr_pos.z); + list_head* grid_list[9]; + int grid_count = 0; + map_service_->GetGridList(grid_id, grid_list, grid_count); + for (int i = 0; i < grid_count; ++i){ + list_head* head = grid_list[i]; + if (list_empty(head)) { + continue; + } - } + CellNode *node, *tmp; + list_for_each_entry_safe(node, tmp, head, entry) { + } + } + } while (true); return false; }