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


C++ Campaign类代码示例

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


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

示例1:

void
MissionSelector::addCampaignGroup(string handle, vector<string> missions)
{
  Campaign* campaign = mHandleToCampaign[handle];
  if(campaign == NULL) return;
  campaign->addGroup(missions);
}
开发者ID:MrPhil,项目名称:ShortHike,代码行数:7,代码来源:MissionSelector.cpp

示例2: rMain

void
MissionSelector::show(bool enableClose)
{
  mCloseButton->setEnabled(enableClose);
  
  Mission* currentMission = rMain()->getMission();
  if(ConfigManager::getPlayer()->getHomeBase() == currentMission) {
    mHomeBaseButton->setVisible(false);
  }
  else {
    mHomeBaseButton->setVisible(true);
  }  

  sort(mCampaigns.begin(), mCampaigns.end(), lessCampaign);
  mCampaignList->removeAllItems();  
  for(vector<Campaign*>::const_iterator iCampaign = mCampaigns.begin(); iCampaign != mCampaigns.end(); ++iCampaign) {
    Campaign* campaign = *iCampaign;
    mCampaignList->addItem(campaign->getName());
  }  

  sort(mMissions.begin(), mMissions.end(), lessEntry);
  updateMissionList();
  
  Dialog::show();
}
开发者ID:MrPhil,项目名称:ShortHike,代码行数:25,代码来源:MissionSelector.cpp

示例3:

void
CmpCompleteDlg::Show()
{
    FormWindow::Show();

    Campaign* c = Campaign::GetCampaign();

    if (img_title && c) {
        DataLoader*    loader = DataLoader::GetLoader();
        Starshatter*   stars  = Starshatter::GetInstance();
        CombatEvent*   event  = c->GetLastEvent();
        char           img_name[256];

        if (event) {
            strcpy_s(img_name, event->ImageFile());

            if (!strstr(img_name, ".pcx")) {
                strcat_s(img_name, ".pcx");
            }

            if (loader) {
                loader->SetDataPath(c->Path());
                loader->LoadBitmap(img_name, banner);
                loader->SetDataPath(0);

                Rect tgt_rect;
                tgt_rect.w = img_title->Width();
                tgt_rect.h = img_title->Height();

                img_title->SetTargetRect(tgt_rect);
                img_title->SetPicture(banner);
            }
        }
    }
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:35,代码来源:CmpCompleteDlg.cpp

示例4: if

void
MsnSelectDlg::OnDel(AWEvent* event)
{
	const char* cname = 0;

	if (cmb_campaigns)
	cname = cmb_campaigns->GetSelectedItem();
	else if (lst_campaigns)
	cname = lst_campaigns->GetSelectedItem();

	Campaign* c = Campaign::SelectCampaign(cname);
	if (!c) return;

	Mission* m = c->GetMission(mission_id);
	if (!m) return;

	ConfirmDlg* confirm = manager->GetConfirmDlg();
	if (confirm) {
		char msg[256];
		sprintf_s(msg, Game::GetText("MsnSelectDlg.are-you-sure").data(), m->Name());
		confirm->SetMessage(msg);
		confirm->SetTitle(Game::GetText("MsnSelectDlg.confirm-delete"));
		confirm->SetParentControl(btn_del);

		manager->ShowConfirmDlg();
	}

	else {
		OnDelConfirm(event);
	}
}
开发者ID:The-E,项目名称:Starshatter-Experimental,代码行数:31,代码来源:MsnSelectDlg.cpp

示例5: getNearestObject

void Functions::getNearestObject(Aurora::NWScript::FunctionContext &ctx) {
	Campaign *campaign = _game->getCampaigns().getCurrentCampaign();
	if (!campaign)
		return;

	DragonAge::Object *target = DragonAge::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (!target)
		return;

	// Bitfield of type(s) to check for
	const uint32 type = ctx.getParams()[1].getInt();
	// We want the nth nearest object
	size_t count = MAX<int32>(ctx.getParams()[2].getInt(), 0);

	if (count == 0)
		return;

	Aurora::NWScript::Variable::Array &result = ctx.getReturn().getArray();

	// TODO: nCheckLiving
	// TODO: nCheckPerceived

	const bool includeSelf = ctx.getParams()[5].getInt() != 0;
	if (includeSelf) {
		result.push_back(boost::make_shared<Aurora::NWScript::Variable>(target));
		count--;
	}

	if (count == 0)
		return;

	Aurora::NWScript::ObjectSearch *search = campaign->findObjects();
	Aurora::NWScript::Object       *object = 0;

	std::list<Object *> objects;
	while ((object = search->next())) {
		// Needs to be a valid object and not the target
		DragonAge::Object *daObject = DragonAge::ObjectContainer::toObject(object);
		if (!daObject || (daObject == target))
			continue;

		// Ignore invalid object types
		const uint32 objectType = (uint32) daObject->getType();
		if (objectType >= kObjectTypeMAX)
			continue;

		if (type & objectType)
			objects.push_back(daObject);
	}

	delete search;

	objects.sort(ObjectDistanceSort(*target));

	for (std::list<Object *>::iterator it = objects.begin(); it != objects.end() && count > 0; ++it, count--)
		result.push_back(boost::make_shared<Aurora::NWScript::Variable>(*it));
}
开发者ID:clone2727,项目名称:xoreos,代码行数:57,代码来源:functions_object.cpp

示例6: getHero

void Functions::getHero(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	Campaign *campaign = _game->getCampaigns().getCurrentCampaign();
	if (!campaign)
		return;

	ctx.getReturn() = (Aurora::NWScript::Object *) campaign->getPC();
}
开发者ID:ImperatorPrime,项目名称:xoreos,代码行数:9,代码来源:functions_module.cpp

示例7:

void
CombatAction::FailAction()
{
	Campaign* campaign = Campaign::GetCampaign();
	if (campaign)
	time = (int) campaign->GetTime();

	count  = 0;
	status = FAILED;
}
开发者ID:The-E,项目名称:Starshatter-Experimental,代码行数:10,代码来源:CombatAction.cpp

示例8: getArea

void Functions::getArea(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	const DragonAge::Object *object = DragonAge::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (!object)
		return;

	Campaign *campaign = _game->getCampaigns().getCurrentCampaign();
	if (!campaign)
		return;

	ctx.getReturn() = (Aurora::NWScript::Object *) campaign->getCurrentArea();
}
开发者ID:clone2727,项目名称:xoreos,代码行数:13,代码来源:functions_object.cpp

示例9: entry

CampaignMapEntryEditor::CampaignMapEntryEditor(Campaign& campaign, CampaignMapEntry& mapEntry) : entry(mapEntry), campaign(campaign)
{
	StringTable& table=*Toolkit::getStringTable();
	title = new Text(0, 18, ALIGN_FILL, ALIGN_SCREEN_CENTERED, "menu", table.getString("[editing map]"));
	mapsUnlockedBy = new CheckList(10, 80, 150, 300, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", false);
	mapsUnlockedByLabel = new Text(10, 50, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", table.getString("[unlocked by]"));
	nameEditorLabel = new Text(405, 80, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", table.getString("[map name]"));
	nameEditor=new TextInput(420, 105, 180, 25, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", entry.getMapName());
	isUnlockedLabel = new Text(430, 140, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", table.getString("[unlocked at start]"));
	isUnlocked = new OnOffButton(405, 140, 20, 20, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, entry.isUnlocked(), ISLOCKED);
	descriptionEditorLabel = new Text(405, 170, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", table.getString("[map description]"));
	descriptionEditor = new TextArea(420, 195, 180, 225, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", false, entry.getDescription().c_str());
	ok = new TextButton(260, 430, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[ok]"), OK);
	cancel = new TextButton(450, 430, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[Cancel]"), CANCEL);

	std::set<std::string> unlockedBy;
	for(unsigned n=0; n<entry.getUnlockedByMaps().size(); ++n)
	{
		unlockedBy.insert(entry.getUnlockedByMaps()[n]);
	}
	for(unsigned n=0; n<campaign.getMapCount(); ++n)
	{
		if(campaign.getMap(n).getMapName() != entry.getMapName())
		{
			if(unlockedBy.find(campaign.getMap(n).getMapName())==unlockedBy.end())
			{
				mapsUnlockedBy->addItem(campaign.getMap(n).getMapName(), false);
			}
			else
			{
				mapsUnlockedBy->addItem(campaign.getMap(n).getMapName(), true);
			}
		}
	}
	addWidget(title);
	addWidget(mapsUnlockedBy);
	addWidget(mapsUnlockedByLabel);
	addWidget(nameEditorLabel);
	addWidget(nameEditor);
	addWidget(isUnlockedLabel);
	addWidget(isUnlocked);
	addWidget(descriptionEditorLabel);
	addWidget(descriptionEditor);
	addWidget(ok);
	addWidget(cancel);
}
开发者ID:krichter722,项目名称:glob2,代码行数:46,代码来源:CampaignEditor.cpp

示例10:

void
CmpLoadDlg::MoveTo(const Rect& r)
{
	FormWindow::MoveTo(r);

	Campaign* campaign = Campaign::GetCampaign();

	if (campaign && img_title && campaign->GetImage(3)) {
		Bitmap* bmp = campaign->GetImage(3);

		Rect tgt_rect;
		tgt_rect.w = img_title->Width();
		tgt_rect.h = img_title->Height();

		img_title->SetTargetRect(tgt_rect);
		img_title->SetPicture(*bmp);
	}
}
开发者ID:The-E,项目名称:Starshatter-Experimental,代码行数:18,代码来源:CmpLoadDlg.cpp

示例11: RealTime

void
StarServer::UpdateWorld()
{
    long   new_time      = real_time;
    double delta         = new_time - frame_time;
    seconds       = max_frame_length;
    gui_seconds   = delta * 0.001;

    if (frame_time == 0)
    gui_seconds = 0;

    time_comp = 1;

    if (delta < max_frame_length * 1000)
    seconds = delta * 0.001;

    frame_time = new_time;

    Galaxy* galaxy = Galaxy::GetInstance();
    if (galaxy) galaxy->ExecFrame();

    Campaign* campaign = Campaign::GetCampaign();
    if (campaign) campaign->ExecFrame();

    if (paused) {
        if (world)
        world->ExecFrame(0);
    }

    else {
        game_time += (DWORD) (seconds * 1000);

        Drive::StartFrame();

        if (world)
        world->ExecFrame(seconds);
    }

    static DWORD refresh_time = 0;
    if (RealTime() - refresh_time > 1000) {
        refresh_time = RealTime();
        RedrawWindow(hwnd, 0, 0, RDW_ERASE|RDW_INVALIDATE);
    }
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:44,代码来源:StarServer.cpp

示例12: getObjectByTag

void Functions::getObjectByTag(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	Campaign *campaign = _game->getCampaigns().getCurrentCampaign();
	if (!campaign)
		return;

	const Common::UString &tag = ctx.getParams()[0].getString();
	if (tag.empty())
		return;

	int nth = ctx.getParams()[1].getInt();

	Aurora::NWScript::ObjectSearch *search = campaign->findObjectsByTag(tag);
	while (nth-- > 0)
		search->next();

	ctx.getReturn() = search->get();
	delete search;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:20,代码来源:functions_object.cpp

示例13: unload

void Campaigns::loadCampaign(const Campaign &campaign) {
	unload(false);

	try {
		_currentCampaign = getCampaign(campaign.getUID());
		if (!_currentCampaign)
			throw Common::Exception("Campaign does not exist in this context");

		_currentCampaign->load();

	} catch (Common::Exception &e) {
		unload(false);

		e.add("Failed loading campaign \"%s\" (\"%s\")",
		      campaign.getUID().c_str(), campaign.getName().getString().c_str());
		throw e;
	}

	_hasCampaign = true;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:20,代码来源:campaigns.cpp

示例14: UT_getNearestObjectByTag

void Functions::UT_getNearestObjectByTag(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	Campaign *campaign = _game->getCampaigns().getCurrentCampaign();
	if (!campaign)
		return;

	DragonAge::Object *target = DragonAge::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (!target)
		return;

	const Common::UString &tag = ctx.getParams()[1].getString();
	if (tag.empty())
		return;

	const bool includeSelf = ctx.getParams()[2].getInt() != 0;
	if (includeSelf && (target->getTag() == tag)) {
		ctx.getReturn() = (Aurora::NWScript::Object *) target;
		return;
	}

	Aurora::NWScript::ObjectSearch *search = campaign->findObjectsByTag(tag);
	Aurora::NWScript::Object       *object = 0;

	std::list<Object *> objects;
	while ((object = search->next())) {
		// Needs to be a valid object and not the target
		DragonAge::Object *daObject = DragonAge::ObjectContainer::toObject(object);
		if (!daObject || (daObject == target))
			continue;

		objects.push_back(daObject);
	}

	delete search;

	objects.sort(ObjectDistanceSort(*target));

	if (!objects.empty())
		ctx.getReturn() = (Aurora::NWScript::Object *) *objects.begin();
}
开发者ID:clone2727,项目名称:xoreos,代码行数:41,代码来源:functions_object.cpp

示例15: switch

void CampaignBuilder::setPlayerPos(Campaign& campaign, Vec2 pos, ViewId playerViewId) {
  switch (getPlayerRole()) {
    case PlayerRole::KEEPER:
      if (campaign.playerPos)
        campaign.clearSite(*campaign.playerPos);
      campaign.playerPos = pos;
      campaign.sites[*campaign.playerPos].dweller =
          Campaign::SiteInfo::Dweller(Campaign::KeeperInfo{playerViewId});
      break;
    case PlayerRole:: ADVENTURER:
      campaign.playerPos = pos;
      break;
  }
}
开发者ID:miki151,项目名称:keeperrl,代码行数:14,代码来源:campaign_builder.cpp


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