Ejemplo n.º 1
0
bool Quest::CanBeTaken( Player *_Player )
{
	bool result = ( !RewardIsTaken( _Player ) && IsCompatible( _Player ) && 
					 PreReqSatisfied( _Player ) );

	return result;
}
Ejemplo n.º 2
0
/**
 * Checks compatibility of pointers
 * 
 *
 * @param left class ID
 * @param right class ID
 *
 * @return true if compatible, false otherwise
 */
bool IsCompatible(long lID,long rID)
{
	if(lID==rID)
		return true;
	if(classHashTables[rID].parentID==-1)
		return false;
	return IsCompatible(lID,classHashTables[rID].parentID);
}
void* CMarmaladeAutoMaterial::GetShader(const UUID& uuidRenderEngine, void* pvData) const
{
    if (!IsCompatible(uuidRenderEngine))
        return NULL;

    CMarmaladeShader* pShader = m_pShader->Clone();

    pShader->ParamBlock() = m_ParamBlock;

    return reinterpret_cast<void*>(pShader);
}
Ejemplo n.º 4
0
static int LoadModules()

{
    int i;

    /* Set the number of modules.
       -------------------------- */
    NumMods = App->ArgC;
    if (NumMods > MAX_MODULES)
    {
	MTX_ERROR1("Too many modules (max. %d allowed)",MAX_MODULES);
	return -1;
    }

    /* Read the .cfinfo files and load the generators (if needed).
       ----------------------------------------------------------- */
    for (i = 0; i < NumMods; ++i)
    {
	int k;
        if (Lat_ReadInfo(&ModList[i].Info,App->ArgV[i]) != 0)
	    return -1;
	if (!IsCompatible(i))
	    return -1;

	/* Clear any existing peak words.
	   ------------------------------ */
	for (k = 0; k < ModList[i].Info.NCf; ++k)
	    ModList[i].Info.Cf[k].peakword = -1;

	/* Read the generators, set up ss bases and word generators.
	   --------------------------------------------------------- */
	if (!opt_n || opt_k || opt_b)
	{
	    ModList[i].Rep = MrLoad(App->ArgV[i],ModList[i].Info.NGen);
	    ModList[i].Wg = WgAlloc(ModList[i].Rep);
	    if (opt_b)
	    {
		int dim = ModList[i].Rep->Gen[0]->Nor;
		ModList[i].SsBasis = MatAlloc(FfOrder,dim,dim);
	    }
	}
    }

    return 0;
}
Ejemplo n.º 5
0
TargetPhrase *TargetPhrase::MergeNext(const TargetPhrase &inputPhrase) const
{
  if (! IsCompatible(inputPhrase)) {
    return NULL;
  }

  // ok, merge
  TargetPhrase *clone				= new TargetPhrase(*this);
  clone->m_sourcePhrase = m_sourcePhrase;
  int currWord = 0;
  const size_t len = GetSize();
  for (size_t currPos = 0 ; currPos < len ; currPos++) {
    const Word &inputWord	= inputPhrase.GetWord(currPos);
    Word &cloneWord = clone->GetWord(currPos);
    cloneWord.Merge(inputWord);

    currWord++;
  }

  return clone;
}
Ejemplo n.º 6
0
bool CUnit::IsCompatible(const std::string& otherUnit, std::string* errorMsg /* = NULL */) const
{
  bool bOk = false;

  try 
  {
    CUnit unit( otherUnit );
    bOk = IsCompatible(unit);
  }
  catch (CException& e)
  {
    if (errorMsg != NULL)
    {
      errorMsg->append(CTools::Format("Error while checking unit (CUnit::IsCompatible) : %s\n",
                                  e.Message().c_str()));
    }
    else
    {
      throw e;
    }
  }
  return bOk;
}
Ejemplo n.º 7
0
//---------------------------------------------------------------------------
void __fastcall TRADIOSetDlg::SetMaker(void)
{
	int i;
	for( i = 0; __MK[i] != NULL; i++ ){
		if( IsSame(AnsiString(CmdRx->Text).c_str(), __MT[i][1]) && IsSame(AnsiString(CmdTx->Text).c_str(), __MT[i][2]) && IsCompatible (m_PollType,i)){       //AA6YQ 1.66	JA7UDE 0428
			m_DisEvent++;
			Maker->Text = __MK[i];
			m_DisEvent--;
			m_Maker = i;
			SetVFOList();
			return;
		}
	}
	m_Maker = MAKER_UNKNOWN;
	m_DisEvent++;
	Maker->Text = "Unknown";
	SetVFOList();
	m_DisEvent--;
}
Ejemplo n.º 8
0
//----------------------------------------
bool CUnit::IsCompatible(const CUnit*	otherUnit) const
{
  return IsCompatible(*otherUnit);
}
Ejemplo n.º 9
0
bool RecordIterator::operator == (const RecordIterator& other) const { 
  ASSERT_TRUE(IsCompatible(other));  // maybe you changed the database while iterating?
  return current == other.current;
}
Ejemplo n.º 10
0
bool RecordIterator::operator != (const RecordIterator& other) const {
  ASSERT_TRUE(IsCompatible(other));
  return current != other.current; 
}
Ejemplo n.º 11
0
// overload IsCompatible to use this
int YARPImageLabel::Apply(int x, int y, YARPImageOf<YarpPixelInt>& dest)
{
  int IMG_H = x;
  int IMG_W = y;
  int nalloc_len = IMG_H*IMG_W*4;
  if (nalloc_len>alloc_len)
    {
      Clean();
      alloc_len = nalloc_len;
      xstack = new int [alloc_len];
      ystack = new int [alloc_len];
    }
  assert(xstack!=NULL&&ystack!=NULL);
  int i, j;
  int ii, jj;
  int id = 1;
  int top = 0;
  int maxCount = 0;
  int maxCountId = 0;
  int count;
  int stop = 0;

  for (i=0; i<IMG_H; i++)
    {
      for (j=0; j<IMG_W; j++)
	{
	  dest(i,j) = 0;
	}
    }
  for (i=0; i<IMG_H; i++)
    {
      for (j=0; j<IMG_W; j++)
	{
	  if (dest(i,j) == 0)
	    {
	      //int ref = src(i,j);
	      if (stop)
		{
		  Notify(id,count,1);
		}
	      id++;
	      //printf(":: %d %d (%d)\n", i, j, id);
	      //if (id>255)
	      //{
	      //  id = 2;
	      //}
	      count = 0;
	      Notify(id,count,0);
	      stop = 1;
	      top = 1;
	      ystack[0] = i;
	      xstack[0] = j;
	      while (top>0)
		{
		  top--;
		  ii = ystack[top];
		  jj = xstack[top];
		  if (dest(ii,jj) == 0)
		    if (IsCompatible(i,j,ii,jj))
		    {
		      dest(ii,jj) = id;
		      Notify(ii,jj);
		      count++;
		      if (ii>0)
			{
			  if (dest(ii-1,jj) == 0)
			    if (IsCompatible(i,j,ii-1,jj))
			    {
			      ystack[top] = ii-1;
			      xstack[top] = jj;
			      top++;
			    }
			}
		      if (ii+1<IMG_H)
			{
			  if (dest(ii+1,jj) == 0) 
			    if (IsCompatible(i,j,ii+1,jj))
			    {
			      ystack[top] = ii+1;
			      xstack[top] = jj;
			      top++;
			    }
			}
		      if (jj>0)
			{
			  if (dest(ii,jj-1) == 0)
			    if (IsCompatible(i,j,ii,jj-1))
			    {
			      ystack[top] = ii;
			      xstack[top] = jj-1;
			      top++;
			    }
			}
		      if (jj+1<IMG_W)
			{
			  if (dest(ii,jj+1) == 0)
			    if (IsCompatible(i,j,ii,jj+1))
			    {
			      ystack[top] = ii;
			      xstack[top] = jj+1;
			      top++;
			    }
			}
		    }
		}
	      if (count>maxCount)
		{
		  maxCount = count;
		  maxCountId = id;
		}
	    }
	}
    }
  bestId = maxCountId;
  return maxCountId;
}