Пример #1
0
void the::object::checkAction(const Action::type &type, int x, int y)
{
    Intersection intersect;
    auto engine = aux::engine;
    auto trgObject = Intersection::get(x, y, intersect);

    if(trgObject && trgObject.get() == this)
    {
        for(auto i = actions.begin(); i != actions.end();)
        {
            auto action = i->second;
            if(action.destroed())
            {
                logger::extra("[Action ] del '%s'; object: '%s' surface : %d", i->first.c_str(), getTag().c_str(), action.getSurface());
                i = actions.erase(i);
            }    
            else
            {    
                if(action.getActionType() == type && action.getSurface() == intersect.surfaceId) 
                {    
                    action.invoke(intersect.point);
                }
                i++;
            }
        }
    }
}
Пример #2
0
bool Action::operator == (const Action *rhs) const
{
	if (this->getActionType() != rhs->getActionType())
		return false;

	switch (getActionType()) {
		case Action::Type::Movement:
			return static_cast<const MovementAction *>(this) == static_cast<const MovementAction *>(rhs);
		case Action::Type::Combat:
			return static_cast<const CombatAction *>(this) == static_cast<const CombatAction *>(rhs);
		default:
			return false;
	}
}
Пример #3
0
QString ListItem::getRawDisplayPath(int charsAvail){
    if(charsAvail==-1){
        charsAvail = m_charsAvail;
    } else {
        m_charsAvail =  charsAvail;
    }
    if(getActionType()==CatItem::NOUN_ACTION){
        QStringList l = getPathPieces();
        m_displayLengths = decomposeByStrings(charsAvail,l);
        l = truncByLength(l, m_displayLengths);

        l = positionOrder(l);
        l = stripNulls(l);
        return l.join("/");
    }
    else {
        return this->getDescription();
    }
}