| 2540 | } |
| 2541 | |
| 2542 | void process_command(command_type cmd) |
| 2543 | { |
| 2544 | // the chooser needs a cursor, but we need to hide it here |
| 2545 | cursor_control cc(false); |
| 2546 | bool loop_done = m_dc.process_command(cmd); |
| 2547 | |
| 2548 | // Don't allow going out of bounds. |
| 2549 | if (!crawl_view.in_viewport_g(m_dc.target())) |
| 2550 | m_dc.set_target(old_target); |
| 2551 | |
| 2552 | // Update ray and flag any redraws that will be needed if the loop is |
| 2553 | // not done. |
| 2554 | if (old_target != m_dc.target()) |
| 2555 | { |
| 2556 | m_dc.have_beam = m_dc.show_beam |
| 2557 | && find_ray(you.pos(), m_dc.target(), m_dc.beam, |
| 2558 | opc_solid_see, you.current_vision); |
| 2559 | m_dc.need_text_redraw = true; |
| 2560 | m_dc.need_viewport_redraw = true; |
| 2561 | m_dc.need_cursor_redraw = true; |
| 2562 | } |
| 2563 | |
| 2564 | if (loop_done) |
| 2565 | { |
| 2566 | m_is_alive = false; |
| 2567 | |
| 2568 | if (!m_dc.just_looking && !m_dc.move_is_ok()) |
| 2569 | { |
| 2570 | m_dc.moves.isCancel = true; |
| 2571 | m_dc.moves.isValid = false; |
| 2572 | } |
| 2573 | return; |
| 2574 | } |
| 2575 | |
| 2576 | if (m_dc.need_viewport_redraw || m_dc.need_cursor_redraw |
| 2577 | || m_dc.need_text_redraw || m_dc.need_all_redraw) |
| 2578 | { |
| 2579 | _expose(); |
| 2580 | } |
| 2581 | |
| 2582 | old_target = m_dc.target(); |
| 2583 | } |
| 2584 | |
| 2585 | bool is_alive() |
| 2586 | { |
no test coverage detected