Esempio n. 1
0
void CAutoMapper::ProceedLocalized(CLayerTiles *pLayer, int ConfigID, int Seed, int X, int Y, int Width, int Height)
{
	if(!m_FileLoaded || pLayer->m_Readonly || ConfigID < 0 || ConfigID >= m_lConfigs.size())
		return;

	if(Width < 0)
		Width = pLayer->m_Width;

	if(Height < 0)
		Height = pLayer->m_Height;

	CConfiguration *pConf = &m_lConfigs[ConfigID];

	int CommitFromX = clamp(X + pConf->m_StartX, 0, pLayer->m_Width);
	int CommitFromY = clamp(Y + pConf->m_StartY, 0, pLayer->m_Height);
	int CommitToX = clamp(X + Width + pConf->m_EndX, 0, pLayer->m_Width);
	int CommitToY = clamp(Y + Height + pConf->m_EndY, 0, pLayer->m_Height);

	int UpdateFromX = clamp(X + 3 * pConf->m_StartX, 0, pLayer->m_Width);
	int UpdateFromY = clamp(Y + 3 * pConf->m_StartY, 0, pLayer->m_Height);
	int UpdateToX = clamp(X + Width + 3 * pConf->m_EndX, 0, pLayer->m_Width);
	int UpdateToY = clamp(Y + Height + 3 * pConf->m_EndY, 0, pLayer->m_Height);

	CLayerTiles *pUpdateLayer;
	if (UpdateFromX != 0 || UpdateFromY != 0 || UpdateToX != pLayer->m_Width || UpdateToY != pLayer->m_Width)
	{ // Needs a layer to work on
		pUpdateLayer = new CLayerTiles(UpdateToX - UpdateFromX, UpdateToY - UpdateFromY);

		for(int y = UpdateFromY; y < UpdateToY; y++) {
			for(int x = UpdateFromX; x < UpdateToX; x++)
			{
				CTile *in = &pLayer->m_pTiles[y*pLayer->m_Width+x];
				CTile *out = &pUpdateLayer->m_pTiles[(y-UpdateFromY)*pUpdateLayer->m_Width+x-UpdateFromX];
				out->m_Index = in->m_Index;
				out->m_Flags = in->m_Flags;
			}
		}
	}
	else
	{
		pUpdateLayer = pLayer;
	}

	Proceed(pUpdateLayer, ConfigID, Seed, UpdateFromX, UpdateFromY);

	for(int y = CommitFromY; y < CommitToY; y++) {
		for(int x = CommitFromX; x < CommitToX; x++)
		{
			CTile *in = &pUpdateLayer->m_pTiles[(y-UpdateFromY)*pUpdateLayer->m_Width+x-UpdateFromX];
			CTile *out = &pLayer->m_pTiles[y*pLayer->m_Width+x];
			out->m_Index = in->m_Index;
			out->m_Flags = in->m_Flags;
		}
	}
}
int EvalExpres(void)    /* 表达式求解函数*/
{
	int a,b,i=0,s=0;
	char c[80],r;
	InitStack(&StackR);
	Push(&StackR,'#');
	InitStack(&StackD);
	printf(" 请输入表达式并以‘#’结束:");
	gets(c);
	while(c[i]!='#' || GetTop(&StackR)!='#')
	{      
		if(!In(c[i]))   /* 判断读入的字符不是运算符 是则进栈*/
		{ if(c[i] >= '0' && c[i] <= '9')
		{
			s += c[i]-'0';      
			while(!In(c[++i]))    /*此处实现的功能为当输入的数字为多位数时*/
			{ s*=10;
			s += c[i]-'0';
			}
			Push(&StackD,s+'0');
			s = 0;
		}
		else
		{
			printf("你输入的表达式有误!\n");
			return 0;
		}            
		}
		else        
			switch(Proceed(GetTop(&StackR),c[i])) /* 此函数用来比较读取的运算符和栈顶运算符的优先级*/
		{
			case '<':   /* 栈顶的元素优先级高*/
				Push(&StackR,c[i]);
				i++;
				break;
			case '=':   /* 遇到匹配的小括号时则去掉他*/
				Pop(&StackR);
				i++;
				break;
			case '>': /* 栈顶的优先级低则出栈并将结果写入栈内*/
				r = Pop(&StackR);
				a = Pop(&StackD)-'0';
				b = Pop(&StackD)-'0';
				Push(&StackD,Operate(a,r,b)) ;
				break;                
		}
	}
	return (GetTop(&StackD)-'0');   /* 返回运算结果*/
}
Esempio n. 3
0
File: run.cpp Progetto: bihai/fbide
void MyFrame::OnCompile (wxCommandEvent& WXUNUSED(event)) {
    if (stc==0)
        return;
    if (ProcessIsRunning)
        return;
    if (Proceed()!=1)
        return;
    FBConsole->DeleteAllItems();
    SetStatusText( "Compiling..." );
    if (Compile( FBNotebook->GetSelection() )==0)
        SetStatusText( "Compilation Complete." );
    else
        SetStatusText( "Compilation Failed!" );
    return;
}
Esempio n. 4
0
//+--------------------------------------------------------------------------+
//|							From IPFTest									 |
//+--------------------------------------------------------------------------+
bool PFTestGoToRotation::ProceedStep2(TimeValue timeStartTick, float timeStartFraction, TimeValue& timeEndTick, float& timeEndFraction, BitArray& testResult, Tab<float>& testTime)
{
	PreciseTimeValue timeStart = PreciseTimeValue(timeStartTick, timeStartFraction);
	PreciseTimeValue timeEnd = PreciseTimeValue(timeEndTick, timeEndFraction);
	bool res = Proceed(	_containerFnPub(),
						timeStart,
						timeEnd,
						_particleSystemFnPub(),
						_particleNodeFnPub(),
						_actionNodeFnPub(),
						(IPFIntegrator*)_integratorFnPub(),
						testResult,
						testTime);
	timeEndTick = timeEnd.tick;
	timeEndFraction = timeEnd.fraction;
	return res;
}
Esempio n. 5
0
File: run.cpp Progetto: bihai/fbide
void MyFrame::OnCompileAndRun (wxCommandEvent& WXUNUSED(event)) {
    if (stc==0)
        return;
    if (ProcessIsRunning)
        return;
    if (Proceed()!=1)
        return;
    FBConsole->DeleteAllItems();
    SetStatusText( "Compiling..." );
    if (Compile( FBNotebook->GetSelection() )==0) {
        SetStatusText( "Compilation Complete." );
        wxString strFile = bufferList[ FBNotebook->GetSelection() ]->GetCompiledFile();
        Run( strFile );
    }
    else
        SetStatusText( "Compilation Failed!" );

    return;
}
void
SocketMessageWatcher::OnFileCanReadWithoutBlocking(int aFd)
{
  BluetoothStatus status;

  switch (mLen) {
    case 0:
      status = RecvMsg1();
      break;
    case MSG1_SIZE:
      status = RecvMsg2();
      break;
    default:
      /* message-size error */
      status = STATUS_FAIL;
      break;
  }

  if (IsComplete() || status != STATUS_SUCCESS) {
    StopWatching();
    Proceed(status);
  }
}
Esempio n. 7
0
void ManSettings()
{
    blit(GainBox, screen, 0, 0, 300, 400, 114,55);
    while (!key[KEY_ESC])
    {
        Letteri= readkey();
        if(key[KEY_ENTER])
            break;
        if(key[KEY_ESC])
            exit(0);
        if(key[KEY_BACKSPACE])
        {
            Letteri=NULL;
            uremove(Gain,-1);
        }
        if(uisdigit(Letteri)!=0)
        {
            Letterj= Letteri;
            strcat(Gain, &Letterj);
        }
        textprintf_ex(screen, font, 320, 415, 0, WHITE, "%s  ", Gain);
    }
    Proceed();
}
Esempio n. 8
0
void ControlType()
{
    textprintf_ex(screen, font, 150, 250, 0, -1, "Tipo de Control:");
    textprintf_ex(screen, font, 210, 280, DARK_GRAY, -1, "*Manual     *Automatico ");

    while (!key[KEY_ESC])
    {
        Letteri= readkey();
        if(key[KEY_ENTER])
            break;
        if(key[KEY_RIGHT])
        {
            textprintf_ex(screen, font, 210, 280, DARK_GRAY, -1, "*Manual     *Automatico ");
            textprintf_ex(screen, font, 372, 280, 0, -1, "*Automatico");
            Option='A';
        }
        if(key[KEY_LEFT])
        {
            textprintf_ex(screen, font, 210, 280, DARK_GRAY, -1, "*Manual     *Automatico ");
            textprintf_ex(screen, font, 210, 280, 0, -1, "*Manual");
            Option='M';
        }
        if(key[KEY_UP])
            CaptureNumber();

    }

    if(Option=='M')
        ManSettings();

    if(Option=='A')
        AutoSettings();

    Proceed();
    return 0;
}
Esempio n. 9
0
void dbFTPProceed ( void )
{
	Proceed ( );
}
Esempio n. 10
0
 // Overridden here so we can hit the barrier if we're still waiting on it
 void OnStop() override {
   Proceed();
 }
Esempio n. 11
0
void AutoSettings()
{
    blit(ModeBox, screen, 0, 0, 100, 400, 114,55);
    while (!key[KEY_ESC])
    {
        Letteri= readkey();
        if(key[KEY_ENTER])
            if ((ustrcmp(Mode,"P")==0) || (ustrcmp(Mode,"PI")==0) || (ustrcmp(Mode,"PID")==0))
                break;
            else
            {
                uremove(Mode,-1);
                uremove(Mode,-1);
                uremove(Mode,-1);
                AutoSettings();
            }
        if(key[KEY_ESC])
            exit(0);
        if(key[KEY_BACKSPACE])
        {
            Letteri=NULL;
            uremove(Mode,-1);
        }
        Letterj= Letteri;
        strcat(Mode, &Letterj);
        ustrupr(Mode);
        textprintf_ex(screen, font, 120, 415, 0, WHITE, "%s  ", Mode);
    }

    if (ustrcmp(Mode,"P")==0)
    {
        blit(GainBox, screen, 0, 0, 300, 400, 114,55);
        while (!key[KEY_ESC])
        {
            Letteri= readkey();
            if(key[KEY_ENTER])
                break;
            if(key[KEY_ESC])
                exit(0);
            if(key[KEY_BACKSPACE])
            {
                Letteri=NULL;
                uremove(Gain,-1);
            }
            Letterj= Letteri;
            strcat(Gain, &Letterj);
            textprintf_ex(screen, font, 320, 415, 0, WHITE, "%s  ", Gain);
        }
        Proceed();
    }
    if (ustrcmp(Mode,"PI")==0)
    {
        blit(GainBox, screen, 0, 0, 300, 400, 114,55);
        while (!key[KEY_ESC])
        {
            Letteri= readkey();
            if(key[KEY_ENTER])
                break;
            if(key[KEY_ESC])
                exit(0);
            if(key[KEY_BACKSPACE])
            {
                Letteri=NULL;
                uremove(Gain,-1);
            }
            Letterj= Letteri;
            strcat(Gain, &Letterj);
            textprintf_ex(screen, font, 320, 415, 0, WHITE, "%s  ", Gain);
        }
        blit(TiBox, screen, 0, 0, 500, 400, 114,55);
        while (!key[KEY_ESC])
        {
            Letteri= readkey();
            if(key[KEY_ENTER])
                break;
            if(key[KEY_ESC])
                exit(0);
            if(key[KEY_BACKSPACE])
            {
                Letteri=NULL;
                uremove(Gain,-1);
            }
            Letterj= Letteri;
            strcat(Ti, &Letterj);
            textprintf_ex(screen, font, 520, 415, 0, WHITE, "%s  ", Ti);
        }
        Proceed();
    }
    if (ustrcmp(Mode,"PID")==0)
    {
        blit(GainBox, screen, 0, 0, 300, 400, 114,55);
        while (!key[KEY_ESC])
        {
            Letteri= readkey();
            if(key[KEY_ENTER])
                break;
            if(key[KEY_ESC])
                exit(0);
            if(key[KEY_BACKSPACE])
            {
                Letteri=NULL;
                uremove(Gain,-1);
            }
            Letterj= Letteri;
            strcat(Gain, &Letterj);
            textprintf_ex(screen, font, 320, 415, 0, WHITE, "%s  ", Gain);
        }
        blit(TiBox, screen, 0, 0, 500, 400, 114,55);
        while (!key[KEY_ESC])
        {
            Letteri= readkey();
            if(key[KEY_ENTER])
                break;
            if(key[KEY_ESC])
                exit(0);
            if(key[KEY_BACKSPACE])
            {
                Letteri=NULL;
                uremove(Ti,-1);
            }
            Letterj= Letteri;
            strcat(Ti, &Letterj);
            textprintf_ex(screen, font, 520, 415, 0, WHITE, "%s  ", Ti);
        }
        blit(TdBox, screen, 0, 0, 700, 400, 114,55);
        while (!key[KEY_ESC])
        {
            Letteri= readkey();
            if(key[KEY_ENTER])
                break;
            if(key[KEY_ESC])
                exit(0);
            if(key[KEY_BACKSPACE])
            {
                Letteri=NULL;
                uremove(Td,-1);
            }
            Letterj= Letteri;
            strcat(Td, &Letterj);
            textprintf_ex(screen, font, 720, 415, 0, WHITE, "%s  ", Td);
        }
        Proceed();
    }
    rest(1000);
    Proceed();
}
Esempio n. 12
0
bool CDocBase::Proceed(const TWtringBuf& src, const CParserOptions* parserOptions)
{
    SDocumentAttribtes docAttrs;
    return Proceed(src, docAttrs, parserOptions);
}