Exemplo n.º 1
0
 bool Animal::Eat(const subs sub) {
     const int value = NutritionalValue(sub);
     if ( value ) {
         satiation += value;
         ReceiveSignal(tr("Ate."));
         if ( SECONDS_IN_DAY < satiation ) {
             satiation = 1.1 * SECONDS_IN_DAY;
             ReceiveSignal(tr("You have gorged yourself!"));
         }
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
void Active::ActRare() {
    Inventory* const inv = HasInventory();
    if (Q_UNLIKELY(inv != nullptr)) {
        for (int i=inv->GetSize()-1; i; --i) {
            if ( inv->IsEmpty(i) ) continue;
            Active* const active = inv->ShowBlock(i)->ActiveBlock();
            if ( active && active->ActInner() == INNER_ACTION_MESSAGE ) {
                TrString signalString = QObject::tr("%1 in slot '%2': %3");
                ReceiveSignal( signalString.arg(inv->InvFullName(i))
                                           .arg(char('a'+i))
                                           .arg(active->GetNote()) );
            }
        }
    }
    DoRareAction();
}