示例#1
0
bool NounStructure::build()
{
	if (! isBuilding() )
		return true;

	m_nBuildTime += 1;
	if (! isBuilding() )
	{
		// construction complete!
		if ( isServer() && planet() != NULL )
			factionChat( CharString().format( "<color;ffffff>Comms: %s %s constructed", planet()->name(), name() ) );

		return true;
	}
	return false;
}
示例#2
0
void CommandLineFrontend::handleTaskProgress(int value, AbstractJob *job)
{
    if (isBuilding()) {
        int &currentJobEffort = m_buildEfforts[job];
        m_currentBuildEffort += value - currentJobEffort;
        currentJobEffort = value;
        if (m_buildEffortsRetrieved == m_buildEffortsNeeded)
            m_observer->setProgressValue(m_currentBuildEffort);
    } else if (!resolvingMultipleProjects()) {
        m_observer->setProgressValue(value);
    }
}
示例#3
0
/**
 * toSTring
 *
 * @return std::string - a textual dump of the ring item contents.
 */
std::string
CGlomParameters::toString() const
{
    CGlomParameters* This = const_cast<CGlomParameters*>(this);
    pGlomParameters pItem =
        reinterpret_cast<pGlomParameters>(This->getItemPointer());
    std::stringstream    out;
    
    out << "Glom is " << (isBuilding() ? "" : " not ") << "building events\n";
    if (isBuilding()) {
        out << "Event building coincidence window is: "
            << coincidenceTicks() << " timestamp ticks\n";
    }
    unsigned tsPolicy = static_cast<unsigned>(timestampPolicy());
    if (tsPolicy >= sizeof(policyNames)/sizeof(char*)) {
        tsPolicy = sizeof(policyNames)/sizeof(char*) - 1;
    }
    out << "TimestampPolicy : policyNames[tsPolicy]\n";
    
    
    return out.str();
}
示例#4
0
CharString NounStructure::status() const
{
	CharString info;
	info += "\n";

	if ( damage() > 0 )
		info += CharString().format("<color;0000ff>DAMAGE: %d%%</color>\n", (damage() * 100) / maxDamage() );
	if ( workers() != 0 )
		info += CharString().format( "Workers: %s\n", FormatNumber<char,int>( -workers() ).cstr() );
	if ( power() != 0 )
		info += CharString().format( "Power: %s\n", FormatNumber<char,int>( power() ).cstr() );
	if ( technology() != 0 )
		info += CharString().format( "Technology: %d\n", technology() );
	if ( upkeep() != 0 )
		info += CharString().format( "Upkeep: %d\n", upkeep() );

	if ( active() )
	{
		if ( food() != 0 )
			info += CharString().format( "Food: %s\n", FormatNumber<char,int>( food() ).cstr() );
		if ( habitat() != 0 )
			info += CharString().format( "Habitat: %s\n", FormatNumber<char,int>( habitat() ).cstr() );
		if ( mining() != 0 )
			info += CharString().format( "Mining: %s\n", FormatNumber<char,int>( mining() ).cstr() );
		if ( research() != 0 )
			info += CharString().format( "Research: %s\n", FormatNumber<char,int>( research() ).cstr() );
		if ( production() != 0 )
			info += CharString().format( "Production: %s\n", FormatNumber<char,int>( production() ).cstr() );
		if ( protection() != 0.0f )
			info += CharString().format( "PD: %d%%\n", (int)(protection() * 100) );
	}
	else if ( flags() & FLAG_ACTIVE )
	{
		if ( flags() & FLAG_WORKER_SHORT )
			info += "<color;0000ff>WORKER SHORTAGE!</color>\n";
		if ( flags() & FLAG_POWER_SHORT )
			info += "<color;0000ff>POWER SHORTAGE!</color>\n";
		if ( flags() & FLAG_TECH_SHORT )
			info += "<color;0000ff>TECHNOLOGY SHORTAGE!</color>\n";
	}
	else
	{
		info += "\n<color;ffffff>INACTIVE</color>\n";
	}

	if ( isBuilding() )
		info += CharString().format("\nBuilding...%d%% complete\n", buildComplete() );

	return info;
}
示例#5
0
    void visitArea(const utymap::entities::Area& area)
    {
        Style style = context_.styleProvider.forElement(area, context_.quadKey.levelOfDetail);

        // NOTE this might happen if relation contains not a building
        if (!isBuilding(style))
            return;

        bool justCreated = ensureContext(area);
        polygon_->addContour(toPoints(area.coordinates));
        build(area, style);

        completeIfNecessary(justCreated);
    }
示例#6
0
int TerrainTile::encode() const
{
  int res = 0;
  if (isTree())
  {
    res += 0x1;
    res += 0x10;
  }
  if (isRock())     { res +=  0x2; }
  if (isWater())    { res +=  0x4; }
  if (isBuilding()) { res +=  0x8; }
  if (isRoad())     { res += 0x40; }

  return res;
}
示例#7
0
void CommandLineFrontend::handleNewTaskStarted(const QString &description, int totalEffort)
{
    // If the user does not want a progress bar, we just print the current activity.
    if (!m_parser.showProgress()) {
        if (!m_parser.logTime())
            qbsInfo() << description;
        return;
    }
    if (isBuilding()) {
        m_totalBuildEffort += totalEffort;
        if (++m_buildEffortsRetrieved == m_buildEffortsNeeded) {
            m_observer->initialize(tr("Building"), m_totalBuildEffort);
            if (m_currentBuildEffort > 0)
                m_observer->setProgressValue(m_currentBuildEffort);
        }
    } else if (!resolvingMultipleProjects()) {
        m_observer->initialize(description, totalEffort);
    }
}
示例#8
0
    void visitRelation(const utymap::entities::Relation& relation)
    {
        if (relation.elements.empty())
            return;

        bool justCreated = ensureContext(relation);

        Style style = context_.styleProvider.forElement(relation, context_.quadKey.levelOfDetail);

        if (isMultipolygon(style) && isBuilding(style)) {
            MultiPolygonVisitor visitor(polygon_);

            for (const auto& element : relation.elements)
                element->accept(visitor);

            build(relation, style);
        }
        else {
            for (const auto& element : relation.elements)
                element->accept(*this);
        }

        completeIfNecessary(justCreated);
    }
示例#9
0
void CommandLineFrontend::handleTotalEffortChanged(int totalEffort)
{
    // Can only happen when resolving.
    if (m_parser.showProgress() && !isBuilding() && !resolvingMultipleProjects())
        m_observer->setMaximum(totalEffort);
}