Example #1
0
void CGameWorld::ToSearchMap()
{
    if(m_pMapSearch != NULL) free(m_pMapSearch);
    m_pMapSearch = new CMapSearch(m_Map.Map);

    if(!m_pMapSearch->Search() && !m_bWin && m_Map.nLeft != 0)
    {
        Engine->Effect_Play(ResortSE);
        Resort();
    }
}
Example #2
0
wxDataViewSortedListModel::wxDataViewSortedListModel( wxDataViewListModel *child ) :
  m_array( wxDataViewIntermediateCmp )
{
    m_child = child;

    m_ascending = true;

    m_notifierOnChild = new wxDataViewSortedListModelNotifier( this );
    m_child->AddNotifier( m_notifierOnChild );

    Resort();
}
Example #3
0
			main()
			{
				LNode *head,*p;
				head = Create(8);
				Resort(head);
				p = head->next;
				while (p)
				{
					printf("%d\n",p->data);
					p = p->next;
				}
			}
void ChannelListView::FilterChannel(const wxString& partial)
{

	for (auto const item : m_realChannelCollection) {
		if ((partial.IsEmpty()) || (item.second->name.Contains(partial))) {
			if (!ContainsItem(*item.second)) {
				AddItem(*item.second);
			}
		} else {
			if (ContainsItem(*item.second)) {
				RemoveItem(*item.second);
			}
		}
	}

	Resort();
	Refresh();
}
void NickDataViewCtrl::DoUsersFilter()
{

	for (auto const item : m_real_users_list) {
		if (checkFilteringConditions(item.second)) {
			//User passed filter. Add him/her to the list.
			if (!ContainsItem(*item.second)) {
				AddItem(*item.second);
			}
		} else {
			//Remove user from the list.
			if (ContainsItem(*item.second)) {
				RemoveItem(*item.second);
			}
		}
	}

	Resort();
	Refresh();
}
Example #6
0
//  call of the read function
BOOL GETCCD(UINT drvno, void* dioden, ULONG fftlines, long fkt, ULONG zadr)	
{	//starts data transfer and gets data in buffer dioden
	//drvno: driver number 1..4; 1 for LSCISA1
	//dioden: pointer to destination array of ULONGs
	//fftlines: vertical lines of FFT sensors: vclks=2 * no of lines
	//fkt:  -1=clrread; 0=init dest array with 0; 1=standard read; 2=add to data
	//zadr: cam address on bus -> for series2000 addressed mode
	//returns true; false on error

  	BOOL fResult=FALSE;
	DWORD   ReturnedLength = 0;
	pArrayT pReadArray = NULL;
	pArrayT pCorArray = NULL;
	pArrayT	pDiodenBase = NULL;
	pArrayT	pDiodenBase2 = NULL;
	ULONG arraylength=0;
	sCCDFkts CCDfkt;
	ULONG i = 0;
	BOOL addalloc=FALSE;
	BOOL coralloc=FALSE;
	BYTE chl = 1;
	BYTE chh = 1;

	if (! aINIT[drvno]) return FALSE;	// return with error if no init

	//set function recs
	CCDfkt.Adrwaits = aXCKDelay[drvno]; // pass wait between XCK and ND
	if (_TI)
		{
		CCDfkt.Waits = 0;  // 6000 only valid for  TI sensors, time of vclks in 0 = 2mu
		CCDfkt.Vclks = fftlines * 4;
		}
	  else
		{
		CCDfkt.Waits = 6000;  // 6000 only valid for  FFT sensors, time of vclks in ns = 6000
		CCDfkt.Vclks = fftlines * 2;
		}
	CCDfkt.Fkt	= fkt;
	CCDfkt.Zadr = zadr;

	pReadArray = (pArrayT)dioden;
//	pReadArray = pReadArray + (db-1) * pixel;
	pDiodenBase = pReadArray;
	arraylength = aPIXEL[drvno] * sizeof(ArrayT); //length in bytes


	
	if (fkt==0) // set array to 0
		{
		for (i=0;i<	_PIXEL;i++)
			*(pReadArray++) = 0;
		return TRUE;
		}


	if  (fkt>2)
		return FALSE;  // function not implemented

	#if (_IR2)
		//alloc array for correction 4 x pixel
		//for IR - need 2. array
		pDiodenBase2 = (pArrayT)dioden + aPIXEL[drvno];
		pCorArray = (pArrayT) calloc(aPIXEL[drvno]*4,sizeof(ArrayT));
		if (pCorArray==0) 		
			{ErrorMsg("alloc Cor Buffer failed");
			return FALSE; }
		coralloc=TRUE;
		pReadArray = pCorArray;
		arraylength *= 4;
		CCDfkt.Fkt = 1;		//make standard read
	#else
		// here normal read
		if (fkt!=1) //read in our local array ladioden - add and clrread
			{
			//alloc local array dioden, so we don't overwrite our DIODEN
			pReadArray = (pArrayT) calloc(aPIXEL[drvno],sizeof(ArrayT)); 
			if (pReadArray==0) 		
				{ErrorMsg("alloc ADD/CLR Buffer failed");
				return FALSE; }
			addalloc=TRUE;
			CCDfkt.Fkt = 1;		//make standard read
			}

	
		if ((_IR) && (!addalloc))
			{
			//alloc local array because it is 2*PIXEL -> has to be resortet later
			pReadArray = (pArrayT) calloc(aPIXEL[drvno],sizeof(ArrayT)); 
			if (pReadArray==0) 		
				{ErrorMsg("alloc IR Buffer failed");
				return FALSE; }
			addalloc=TRUE;
			CCDfkt.Fkt = 1;	
			}

	#endif
	
		
	//read camera data
	fResult = DeviceIoControl(ahCCDDRV[drvno],IOCTL_GetCCD,  
		 					&CCDfkt, sizeof(CCDfkt),
							pReadArray,arraylength,
							&ReturnedLength,NULL);
	
	if ((! fResult) || (ReturnedLength!=arraylength))
		{ErrorMsg("Read DMA Buffer failed");
		if (addalloc) free(pReadArray);
		if (coralloc) free(pCorArray);
		return FALSE; }

	//clrread and add: fkt=-1 and 2 could not be implemented with dma
	//so we do it here after reading
	if (fkt==-1)
	{ // return , nothing else to do
		if (addalloc) free(pReadArray);
		if (coralloc) free(pCorArray);
		return TRUE;
		}
 
	if (_RESORT) Resort(drvno,pReadArray);	

	if ((_IR) && (fkt!=2)) // copy back
			{
			pDiodenBase2=pReadArray;
			for (i=0;i<	_PIXEL;i++)
				* (pDiodenBase++) = * (pDiodenBase2++); 
			}

	if (fkt==2) // we must now add our data to DIODEN for online add
			{
			pDiodenBase2=pReadArray;
			for (i=0;i<	_PIXEL;i++)
				* (pDiodenBase++) += * (pDiodenBase2++); 
			}

	if (addalloc) free(pReadArray);
	if (coralloc) free(pCorArray);
	
#if _IS_C4350
//special for Ha Detector head C4350
	V_On(drvno);  //starts new read sequence to Fifo
	V_Off(drvno);
//special end
#endif



	return TRUE; // no Error, all went fine
	};  // GETCCD
Example #7
0
bool CGameWorld::GameLogicFunc()
{
    //更新GUI
    float dt = Engine->Timer_GetDelta();
    m_nLastGUIID = gui->Update(dt);

    //如果按下的是开始,则开始游戏
    if(m_nLastGUIID == ID_START_BTN)
    {
        GameStart();
    }
    else
    if(m_bGameStarted && m_nLastGUIID == ID_HINT_BTN)                      //如果按下提示
    {
        int ida, idb;
        m_pMapSearch->GetRandomHint(ida, idb);

        m_nSelArr[0] = ida, m_nSelArr[1] = idb;
        m_pElemButtonArr[ida]->m_bSelected = m_pElemButtonArr[idb]->m_bSelected = true;
    }
    else
    if(m_bGameStarted && m_nLastGUIID == ID_RESORT_BTN)                     //如果按下重列
    {
        Resort();
    }
    else
    if(m_bGameStarted && m_nLastGUIID >= ID_ELEM_GUI_START)              //如果按下的是方块且游戏开始,则开始逻辑判断
    {
        if(m_nSelArr[0] != -1 && m_nSelArr[1] != -1)
        {
            MapCoorType a, b;
            a.ToCoor(m_nSelArr[0]);
            b.ToCoor(m_nSelArr[1]);

            if(m_Map.Map[a.y][a.x] == m_Map.Map[b.y][b.x])
            {
                PointPath pp(m_pMapSearch->GetPath(a.y, a.x, b.y, b.x));
                if(pp.bExist)
                {
                    m_thisTime = 0;
                    Engine->Effect_Play(ElecSE);
                    //Engine->Effect_Play(ItemBoomSE);
                    m_bTimeNotified = false;
                    PutAni(pp);

                    m_Map.Map[a.y][a.x] = m_Map.Map[b.y][b.x] = -1;
                    m_pElemButtonArr[m_nSelArr[0]]->ToLeave();
                    m_pElemButtonArr[m_nSelArr[1]]->ToLeave();
                    m_Map.nLeft -= 2;
                    m_nSelArr[0] = m_nSelArr[1] = -1;

                    ToSearchMap();
                }
                else
                {
                    m_nSelArr[0] = m_nSelArr[1];
                    m_nSelArr[1] = -1;
                }
            }
            else
            {
                m_nSelArr[0] = m_nSelArr[1];
                m_nSelArr[1] = -1;
            }
        }
    }
    else
    if(m_bGameStarted) //计时
    {
        m_thisTime += dt;
        //若时间到
        if(m_thisTime > MAX_TIME)
        {
            m_bGameStarted = false;
            m_bLose = true;
            Engine->Effect_Play(EndSE);
        }

        if(MAX_TIME - m_thisTime < 8 && !m_bTimeNotified)
        {
            m_bTimeNotified = true;
            Engine->Effect_Play(LessTimeSE);
        }

        //判断赢
        if(m_Map.nLeft == 0)
        {
            m_bGameStarted = false;
            m_bWin = true;
            Engine->Effect_Play(EndSE);
        }
    }
    else
    if(!m_bGameStarted)             //如果游戏没有开始
    {
        if(Engine->Channel_IsPlaying(BGMChannel))
            Engine->Channel_Stop(BGMChannel);
    }

    return false;
}