int Thing::getStackPriority() { if(isGround()) return 0; else if(isGroundBorder()) return 1; else if(isOnBottom()) return 2; else if(isOnTop()) return 3; else if(asCreature()) return 4; else // common items return 5; }
void Model::print() const { std::cout << "Model: "; for (const Cube& it : world.cubes) { if (isOnTop(it)) { Cube current = it; while (!isOnBottom(current)) { std::cout << IDToName(current); current = *getBelow(current); } std::cout << IDToName(current) << "| "; } } if (invalidInterpretation.get()) { std::cout << ", "; invalidInterpretation->print(); } }
void LogViewForm::update(bool log_zapped) { if (!isVisible()) return; if (log_zapped) { close(); show(); return; } if (logstream) { QString s = logstream->readAll(); if (!s.isNull() && !s.isEmpty()) { bool bottom = isOnBottom(); logTextEdit->appendPlainText(s); if (bottom) scrollToBottom(); } } }
void Item::calculatePatterns(int& xPattern, int& yPattern, int& zPattern) { if(isStackable() && getNumPatternX() == 4 && getNumPatternY() == 2) { if(m_countOrSubType <= 0) { xPattern = 0; yPattern = 0; } else if(m_countOrSubType < 5) { xPattern = m_countOrSubType-1; yPattern = 0; } else if(m_countOrSubType < 10) { xPattern = 0; yPattern = 1; } else if(m_countOrSubType < 25) { xPattern = 1; yPattern = 1; } else if(m_countOrSubType < 50) { xPattern = 2; yPattern = 1; } else { xPattern = 3; yPattern = 1; } } else if(isHangable()) { const TilePtr& tile = getTile(); if(tile) { if(tile->mustHookSouth()) xPattern = getNumPatternX() >= 2 ? 1 : 0; else if(tile->mustHookEast()) xPattern = getNumPatternX() >= 3 ? 2 : 0; } } else if(isSplash() || isFluidContainer()) { int color = Otc::FluidTransparent; switch(m_countOrSubType) { case Otc::FluidNone: color = Otc::FluidTransparent; break; case Otc::FluidWater: color = Otc::FluidBlue; break; case Otc::FluidMana: color = Otc::FluidPurple; break; case Otc::FluidBeer: color = Otc::FluidBrown; break; case Otc::FluidOil: color = Otc::FluidBrown; break; case Otc::FluidBlood: color = Otc::FluidRed; break; case Otc::FluidSlime: color = Otc::FluidGreen; break; case Otc::FluidMud: color = Otc::FluidBrown; break; case Otc::FluidLemonade: color = Otc::FluidYellow; break; case Otc::FluidMilk: color = Otc::FluidWhite; break; case Otc::FluidWine: color = Otc::FluidPurple; break; case Otc::FluidHealth: color = Otc::FluidRed; break; case Otc::FluidUrine: color = Otc::FluidYellow; break; case Otc::FluidRum: color = Otc::FluidBrown; break; case Otc::FluidFruidJuice: color = Otc::FluidYellow; break; case Otc::FluidCoconutMilk: color = Otc::FluidWhite; break; case Otc::FluidTea: color = Otc::FluidBrown; break; case Otc::FluidMead: color = Otc::FluidBrown; break; default: color = Otc::FluidTransparent; break; } xPattern = (color % 4) % getNumPatternX(); yPattern = (color / 4) % getNumPatternY(); } else if(isGround() || isOnBottom()) { xPattern = m_position.x % getNumPatternX(); yPattern = m_position.y % getNumPatternY(); zPattern = m_position.z % getNumPatternZ(); } }