Logo Search packages:      
Sourcecode: fillets-ng version File versions

int Rules::actionOut (  ) 

Let model to go out of room.

Returns:
out depth, 0 for normal, 1 for going out, 2... for on the way, -1 for out of screen

Definition at line 238 of file Rules.cpp.

References Cube::change_goOut(), MarkMask::getBorderDir(), Cube::isBusy(), Cube::isLost(), Cube::isWall(), and Cube::shouldGoOut().

{
    if (!m_model->isWall() && !m_model->isLost()
            && !m_model->isBusy())
    {
        //NOTE: normal objects are not allowed to go out of screen
        if (m_model->shouldGoOut()) {
            Dir::eDir borderDir = m_mask->getBorderDir();
            if (borderDir != Dir::DIR_NO) {
                m_dir = borderDir;
                m_outDepth += 1;
            }
            else {
                if (m_outDepth > 0) {
                    m_model->change_goOut();
                    m_outDepth = -1;
                }
            }
        }
    }

    return m_outDepth;
}


Generated by  Doxygen 1.6.0   Back to index