bool CK2Title::eatTitle(CK2Title* target, bool checkInheritance)
{
	// see if it's valid to consume the target title

	if (target == this)
	{
		LOG(LogLevel::Warning) << target->getTitleString() << " attempted to autocephalate.\n";
		return false;
	}

	// merged titles must have the same holder, and the holder must exist
	if (!getHolder())
		return false;
	if (getHolder() != target->getHolder())
		return false;

	// don't merge barony titles (causes problems elsewhere, and there's no real reason to)
	if (titleString.substr(0,2) == "b_" || target->titleString.substr(0,2) == "b_")
		return false;

	// don't merge anything with the designated hre title
	if (titleString == Configuration::getHRETitle() || target->titleString == Configuration::getHRETitle())
		return false;

	// can't merge a vassal with an independent entity
	if (isIndependent() != target->isIndependent())
		return false;

	// merged vassal titles must have the same liege
	if (!isIndependent())
	{
		if (getLiegeString() != target->getLiegeString())
			return false;
	}

	// if we are checking inheritance, merged titles must have the same heir, succession and gender laws, and neither can be elective, gavelkind, or bishoporic
	if (checkInheritance)
	{
		if (getHeir() != target->getHeir())
			return false;
		if (successionLaw != target->successionLaw || genderLaw != target->genderLaw)
			return false;
		if (successionLaw == "feudal_elective" || successionLaw == "open_elective" || successionLaw == "gavelkind" || successionLaw == "catholic_bishopric")
			return false;
	}

	absorbTitle(target);
	return true;
}
Beispiel #2
0
void UContainerTag::menu(QMenu &menu)
{
    QMenu *m;
    if(isIndependent())
    {
        m=menu.addMenu("Insert within");
    }else
        m=&menu;
    m->addAction("  - Insert -")->setEnabled(false);
    m->addAction("Condition",this,SLOT(addCondition()));
    m->addAction("Traverse",this,SLOT(addTraverse()));
    m->addAction("Loop",this,SLOT(addLoop()));
    m->addAction("Break loop",this,SLOT(addBreak()));
    m->addAction("Continue loop",this,SLOT(addContinue()));
    m->addAction("Function call",this,SLOT(addFunction()));
    m->addAction("Variable assign",this,SLOT(addAssign()));
    m->addAction("Return",this,SLOT(addReturn()));
    m->addAction("Python command",this,SLOT(addExec()));
    m->addAction("Comment",this,SLOT(addComment()));
}
void AndroidApplication::run()
{
	int ident;
	int events;
	struct android_poll_source* source;

	app_dummy();
	_gameEngine->setCurrentScript("scripts/interfaces/main.lua");
	if (!isIndependent())
		(*_gameEngine)();
	else
	{
		_run = true;
		while (_run)
		{

			while ((ident = ALooper_pollAll(_applicationEnabled ? 0 : -1, NULL, &events, (void**)&source)) >= 0)
			{


				if (source != NULL)
					source->process(_context, source);

				if (_context->destroyRequested != 0)
				{
					_run = false;
					break;
				}
			}

			//if (_context->window != NULL && _applicationEnabled)
			//	stepApplication();

		}
		Log::debug("Exit");
		_gameEngine->stop();
	}
	ANativeActivity_finish(_context->activity);
	::exit(0);
}