当前位置: 首页>>代码示例>>C++>>正文


C++ Craft::getStatus方法代码示例

本文整理汇总了C++中Craft::getStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ Craft::getStatus方法的具体用法?C++ Craft::getStatus怎么用?C++ Craft::getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Craft的用法示例。


在下文中一共展示了Craft::getStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lstCraftsClick

/**
 * Pick a target for the selected craft.
 * @param action Pointer to an action.
 */
void InterceptState::lstCraftsClick(Action *)
{
	Craft* c = _crafts[_lstCrafts->getSelectedRow()];
	if (c->getStatus() != "STR_OUT" && (c->getStatus() == "STR_READY" || Options::getBool("craftLaunchAlways")))
	{
		_game->popState();
		_game->pushState(new SelectDestinationState(_game, c, _globe));
	}
}
开发者ID:2xG,项目名称:OpenXcom,代码行数:13,代码来源:InterceptState.cpp

示例2: lstCraftsLeftClick

/**
 * Pick a target for the selected craft.
 * @param action Pointer to an action.
 */
void InterceptState::lstCraftsLeftClick(Action *)
{
	Craft* c = _crafts[_lstCrafts->getSelectedRow()];
	if (c->getStatus() == "STR_READY" || ((c->getStatus() == "STR_OUT" || Options::craftLaunchAlways) && !c->getLowFuel() && !c->getMissionComplete()))
	{
		_game->popState();
		if (_target == 0)
		{
			_game->pushState(new SelectDestinationState(c, _globe));
		}
		else
		{
			_game->pushState(new ConfirmDestinationState(c, _target));
		}
	}
}
开发者ID:stavrossk,项目名称:OpenXcom,代码行数:20,代码来源:InterceptState.cpp

示例3: lstCraftsRightClick

/**
 * Centers on the selected craft.
 * @param action Pointer to an action.
 */
void InterceptState::lstCraftsRightClick(Action *)
{
	Craft* c = _crafts[_lstCrafts->getSelectedRow()];
	if (c->getStatus() == "STR_OUT")
	{
		_globe->center(c->getLongitude(), c->getLatitude());
		_game->popState();
	}
}
开发者ID:stavrossk,项目名称:OpenXcom,代码行数:13,代码来源:InterceptState.cpp

示例4: init

/**
 * The craft info can change
 * after going into other screens.
 */
void CraftInfoState::init()
{
    // Set palette
    _game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(3)), Palette::backPos, 16);

    Craft *c = _base->getCrafts()->at(_craft);

    _edtCraft->setText(c->getName(_game->getLanguage()));

    SurfaceSet *texture = _game->getResourcePack()->getSurfaceSet("BASEBITS.PCK");
    texture->getFrame(c->getRules()->getSprite() + 33)->setX(0);
    texture->getFrame(c->getRules()->getSprite() + 33)->setY(0);
    texture->getFrame(c->getRules()->getSprite() + 33)->blit(_sprite);

    std::wstringstream ss;
    ss << tr("STR_DAMAGE_UC_").arg(Text::formatPercentage(c->getDamagePercentage()));
    if (c->getStatus() == "STR_REPAIRS")
    {
        int damageDays = (int)ceil((float)c->getDamage() / c->getRules()->getRepairRate() / 24.0f);
        ss << L"\n(" << tr("STR_DAY", damageDays) << ")";
    }
    _txtDamage->setText(ss.str());

    std::wstringstream ss2;
    ss2 << tr("STR_FUEL").arg(Text::formatPercentage(c->getFuelPercentage()));
    if (c->getStatus() == "STR_REFUELLING")
    {
        int fuelDays = (int) ceil((float)(c->getRules()->getMaxFuel() - c->getFuel()) / c->getRules()->getRefuelRate() / 48.0f);
        ss2 << L"\n(" << tr("STR_DAY", fuelDays) << ")";
    }
    _txtFuel->setText(ss2.str());

    if (c->getRules()->getSoldiers() > 0)
    {
        _crew->clear();
        _equip->clear();

        Surface *frame1 = texture->getFrame(38);
        frame1->setY(0);
        for (int i = 0, x = 0; i < c->getNumSoldiers(); ++i, x += 10)
        {
            frame1->setX(x);
            frame1->blit(_crew);
        }

        Surface *frame2 = texture->getFrame(40);
        frame2->setY(0);
        int x = 0;
        for (int i = 0; i < c->getNumVehicles(); ++i, x += 10)
        {
            frame2->setX(x);
            frame2->blit(_equip);
        }
        Surface *frame3 = texture->getFrame(39);
        for (int i = 0; i < c->getNumEquipment(); i += 4, x += 10)
        {
            frame3->setX(x);
            frame3->blit(_equip);
        }
    }
    else
    {
        _crew->setVisible(false);
        _equip->setVisible(false);
        _btnCrew->setVisible(false);
        _btnEquip->setVisible(false);
        _btnArmor->setVisible(false);
    }

    if (c->getRules()->getWeapons() > 0)
    {
        CraftWeapon *w1 = c->getWeapons()->at(0);

        if (w1 != 0)
        {
            Surface *frame = texture->getFrame(w1->getRules()->getSprite() + 48);
            frame->setX(0);
            frame->setY(0);
            frame->blit(_weapon1);

            _txtW1Name->setText(tr(w1->getRules()->getType()));
            _txtW1Ammo->setText(tr("STR_AMMO_").arg(w1->getAmmo()));
            _txtW1Max->setText(tr("STR_MAX").arg(w1->getRules()->getAmmoMax()));
        }
        else
        {
            _weapon1->clear();
            _txtW1Name->setText(L"");
            _txtW1Ammo->setText(L"");
            _txtW1Max->setText(L"");
        }
    }
    else
    {
        _weapon1->setVisible(false);
        _btnW1->setVisible(false);
//.........这里部分代码省略.........
开发者ID:JoakimSoderberg,项目名称:OpenXcom,代码行数:101,代码来源:CraftInfoState.cpp


注:本文中的Craft::getStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。