void DisplayLongText()
{
    Display("This is a long long boring text, indeed so long I am not able to find something interesting to say. So yes it is a long text that should be wrapped by the formatter. Let's see what will happen !");
}
Example #2
0
void CLibraryFrame::RunLocalSearch(CQuerySearch* pSearch)
{
	CWaitCursor pCursor;

	pSearch->BuildWordList( true, true );

	CSingleLock oLock( &Library.m_pSection, TRUE );

	CAlbumFolder* pRoot = Library.GetAlbumRoot();
	if ( ! pRoot ) return;

	CAlbumFolder* pFolder = pRoot->GetFolderByURI( CSchema::uriSearchFolder );
	if ( pFolder == NULL )
	{
		pFolder = pRoot->AddFolder( CSchema::uriSearchFolder, L"Search Results" );
		if ( pFolder->m_pSchema != NULL )
		{
			int nColon = pFolder->m_pSchema->m_sTitle.Find( L':' );
			if ( nColon >= 0 )
				pFolder->m_sName = pFolder->m_pSchema->m_sTitle.Mid( nColon + 1 );
		}
	}
	else
	{
		// Get translated name of the default search folder
		// We will clear it, not others as user may want to keep several folders
		CString strFolderName;
		int nColon = pFolder->m_pSchema->m_sTitle.Find( L':' );
		if ( nColon >= 0 )
			strFolderName = pFolder->m_pSchema->m_sTitle.Mid( nColon + 1 );
		if ( ! strFolderName.IsEmpty() )
			pFolder	= pRoot->GetFolder( strFolderName );

		if ( pFolder == NULL )
		{
			pFolder = pRoot->AddFolder( CSchema::uriSearchFolder, L"Search Results" );
			if ( pFolder->m_pSchema != NULL && ! strFolderName.IsEmpty() )
				pFolder->m_sName = strFolderName;
		}
		else
			pFolder->Clear();
	}

	if ( pFolder->m_pSchema )
	{
		CString strDate, strTime;
		SYSTEMTIME pTime;

		GetLocalTime( &pTime );
		GetDateFormat( LOCALE_USER_DEFAULT, 0, &pTime, L"yyyy-MM-dd", strDate.GetBuffer( 64 ), 64 );
		GetTimeFormat( LOCALE_USER_DEFAULT, 0, &pTime, L"hh:mm tt", strTime.GetBuffer( 64 ), 64 );
		strDate.ReleaseBuffer(); strTime.ReleaseBuffer();

		CXMLElement* pOuter = pFolder->m_pSchema->Instantiate();
		CXMLElement* pInner = pOuter->AddElement( L"searchFolder" );
		pInner->AddAttribute( L"title", pFolder->m_sName );
		pInner->AddAttribute( L"content", pSearch->m_sSearch );
		pInner->AddAttribute( L"date", strDate );
		pInner->AddAttribute( L"time", strTime );
		pFolder->SetMetadata( pOuter );
		delete pOuter;
	}

	if ( CFileList* pFiles = Library.Search( pSearch, 0, TRUE ) )
	{
		for ( POSITION pos = pFiles->GetHeadPosition(); pos; )
		{
			const CLibraryFile* pFile = pFiles->GetNext( pos );

			if ( Settings.Search.SchemaTypes && pSearch->m_pSchema != NULL )
			{
				if ( ! pSearch->m_pSchema->FilterType( pFile->m_sName ) )
					pFile = NULL;
			}

			if ( pFile != NULL && pFile->IsAvailable() )
				pFolder->AddFile( const_cast< CLibraryFile* >( pFile ) );
		}

		delete pFiles;
	}

	oLock.Unlock();

	Update();
	Display( pFolder );
	GetParent()->PostMessage( WM_COMMAND, ID_VIEW_LIBRARY );
}
Example #3
0
	void SetFiles(int32 files)
	{
		totalFiles_ = files;
		Display();
	}
Example #4
0
void FieldNewCalcUniDlg::OnUnaryOperandTmUpdated( wxCommandEvent& event )
{
	InitFieldChoices();
    Display();
}
Example #5
0
// --- cMenuSwitchTimers ----------------------------------------------------------
cMenuSwitchTimers::cMenuSwitchTimers()
:cOsdMenu(tr("Switch list"), 2, 4, 6, 6, 4)
{
    Set();
    Display();
}
Example #6
0
BOOL CLibraryWnd::OnCollection(LPCTSTR pszPath)
{
	CAlbumFolder* pFolder = NULL;
	CLibraryFolder* pLibFolder;
	CCollectionFile pCollection;
	CString strMessage;

	if ( ! pCollection.Open( pszPath ) )	// Verify specified collection is valid
	{
		// User clicked an invalid collection
		strMessage.Format( LoadString( IDS_LIBRARY_COLLECTION_INVALID ), pszPath );
		MsgBox( strMessage, MB_ICONEXCLAMATION );
		return FALSE;
	}

	// Create the collection folder (in case it doesn't exist)
	CreateDirectory( Settings.Downloads.CollectionPath );
	// Add the collection folder to the library (in case it isn't there)
	pLibFolder = LibraryFolders.AddFolder( Settings.Downloads.CollectionPath );
	// Force a scan of it (in case watch library folders is disabled)
	pLibFolder = LibraryFolders.GetFolder( Settings.Downloads.CollectionPath );
	if ( pLibFolder != NULL ) pLibFolder->Scan();

	CSingleLock oLock( &Library.m_pSection, TRUE );
	if ( CLibraryFile* pFile = LibraryMaps.LookupFileByPath( pszPath, FALSE, TRUE ) )
	{
		// Collection IS already in the library

		// Re-mount the collection
		LibraryFolders.MountCollection( pFile->m_oSHA1, &pCollection );
		pFolder = LibraryFolders.GetCollection( pFile->m_oSHA1 );
		oLock.Unlock();
	}
	else	// Collection is not already in the main library
	{
		oLock.Unlock();
		// Check the collection folder
		CString strSource( pszPath ), strTarget;

		const int nName = strSource.ReverseFind( L'\\' );
		if ( nName >= 0 )
		{
			strTarget = Settings.Downloads.CollectionPath + strSource.Mid( nName );
			LibraryBuilder.RequestPriority( strTarget );
		}

		oLock.Lock();
		if ( CLibraryFile* pTargetFile = LibraryMaps.LookupFileByPath( strTarget, FALSE, TRUE ) )
		{
			// Collection is already in the collection folder

			// Re-mount the collection
			LibraryFolders.MountCollection( pTargetFile->m_oSHA1, &pCollection );
			pFolder = LibraryFolders.GetCollection( pTargetFile->m_oSHA1 );
			oLock.Unlock();
		}
		else	// Collection is not already in collection folder
		{
			oLock.Unlock();

			if ( ! strTarget.IsEmpty() && CopyFile( strSource, strTarget, TRUE ) )
			{
				// Collection was copied into the collection folder

				// Force a scan of collection folder (in case watch library folders is disabled)
				if ( pLibFolder != NULL ) pLibFolder->Scan();

				strMessage.Format( LoadString( IDS_LIBRARY_COLLECTION_INSTALLED ), (LPCTSTR)pCollection.GetTitle() );
				MsgBox( strMessage, MB_ICONINFORMATION );

				oLock.Lock();
				if ( CLibraryFolder* pCollectionFolder = LibraryFolders.GetFolder(Settings.Downloads.CollectionPath ) )
				{
					pCollectionFolder->Scan();
				}
				if ( CLibraryFile* pTargetFile1 = LibraryMaps.LookupFileByPath( strTarget, FALSE, TRUE ) )
				{
					// Re-mount the collection
					LibraryFolders.MountCollection( pTargetFile1->m_oSHA1, &pCollection );
					pFolder = LibraryFolders.GetCollection( pTargetFile1->m_oSHA1 );
				}
				oLock.Unlock();
			}
			else if ( GetLastError() == ERROR_FILE_EXISTS )
			{
				// File with this name already exists:
				// We cannot copy the collection because it's already there, but it doesn't appear in the library.
				// The greatest probablility is that the file is there, but hasn't been added yet.
				// Best bet is to pretend everything is okay, since the delay it takes the user to respond may fix everything.

				strMessage.Format( LoadString( IDS_LIBRARY_COLLECTION_INSTALLED ), (LPCTSTR)pCollection.GetTitle() );
				MsgBox( strMessage, MB_ICONINFORMATION );

				oLock.Lock();
				if ( CLibraryFile* pTargetFile1 = LibraryMaps.LookupFileByPath( strTarget, FALSE, TRUE ) )
				{
					// Collection was already there: Re-mount the collection
					LibraryFolders.MountCollection( pTargetFile1->m_oSHA1, &pCollection );
					pFolder = LibraryFolders.GetCollection( pTargetFile1->m_oSHA1 );
					oLock.Unlock();
				}
				else	// File of this name exists in the folder, but does not appear in the library.
				{
					// Most likely cause- Corrupt file in collection folder.
					oLock.Unlock();
					strMessage.Format( LoadString( IDS_LIBRARY_COLLECTION_CANT_INSTALL ), (LPCTSTR)pCollection.GetTitle(), (LPCTSTR)Settings.Downloads.CollectionPath );
					MsgBox( strMessage, MB_ICONEXCLAMATION );
				}
			}
			else	// Was not able to copy collection to the collection folder for Unknown reason -Display an error message
			{
				strMessage.Format( LoadString( IDS_LIBRARY_COLLECTION_CANT_INSTALL ), (LPCTSTR)pCollection.GetTitle(), (LPCTSTR)Settings.Downloads.CollectionPath );
				MsgBox( strMessage, MB_ICONEXCLAMATION );
			}
		}
	}

	if ( pFolder )
		Display( pFolder ); 	// Show the collection

	return ( pFolder != NULL );
}
Example #7
0
void FieldNewCalcUniDlg::InitFieldChoices()
{
	wxString r_str_sel = m_result->GetStringSelection();
	int r_sel = m_result->GetSelection();
	int prev_cnt = m_result->GetCount();
	
	wxString var_val_orig = m_var->GetValue();
	m_result->Clear();
	{
		int sel_temp = m_var_sel;
		m_var->Clear();
		m_var_sel = sel_temp;
	}
	
	table_int->FillNumericColIdMap(col_id_map);
	m_var_str.resize(col_id_map.size());

	wxString r_tm, v_tm;
	if (is_space_time) {
		r_tm << " (" << m_result_tm->GetStringSelection() << ")";
		v_tm << " (" << m_var_tm->GetStringSelection() << ")";
	}
	for (int i=0, iend=col_id_map.size(); i<iend; i++) {
		if (is_space_time &&
			table_int->GetColTimeSteps(col_id_map[i]) > 1) {			
			m_result->Append(table_int->GetColName(col_id_map[i]) + r_tm);
			m_var->Append(table_int->GetColName(col_id_map[i]) + v_tm);
			m_var_str[i] = table_int->GetColName(col_id_map[i]) + v_tm;
		} else {
			m_result->Append(table_int->GetColName(col_id_map[i]));
			m_var->Append(table_int->GetColName(col_id_map[i]));
			m_var_str[i] = table_int->GetColName(col_id_map[i]);
		}
	}
	
	if (m_result->GetCount() == prev_cnt) {
		// only the time field changed
		m_result->SetSelection(r_sel);
	} else {
		// a new variable might have been added, so find old string
		m_result->SetSelection(m_result->FindString(r_str_sel));
	}
	
	if (m_var->GetCount() == prev_cnt) {
		// only the time field changed
		if (m_var_sel != wxNOT_FOUND) {
			m_var->SetSelection(m_var_sel);
		} else {
			m_var->SetValue(var_val_orig);
		}
	} else {
		// a new variable might have been added, so find old string
		if (m_var_sel != wxNOT_FOUND) {
			m_var->SetSelection(m_var->FindString(var_val_orig));
			m_var_sel = m_var->GetSelection();
		} else {
			m_var->SetValue(var_val_orig);
		}
	}
	
	Display();
}
Example #8
0
void EditCharacters(TCampaignSetting * setting)
{
	int done = 0;
	int c = 0;
	int index = 0;
	int xc = 0, yc = 0;
	TBadGuy scrap;
	int x, y, buttons, tag;

	memset(&scrap, 0, sizeof(scrap));
	SetMouseRects(localClicks);

	while (!done) {
		Display(setting, index, xc, yc);

		do {
			GetEvent(&c, &x, &y, &buttons);
			if (buttons) {
				if (XYToCharacterIndex(x, y, &tag)) {
					if (tag >= 0
					    && tag <
					    setting->characterCount)
						index = tag;
					c = DUMMY;
				} else if (GetMouseRectTag(x, y, &tag)) {
					xc = (tag >> 8);
					yc = (tag & 0xFF);
					AdjustYC(&yc);
					AdjustXC(yc, &xc);
					c = (buttons ==
					     1 ? PAGEUP : PAGEDOWN);
				}
			}
		}
		while (!c);

		switch (c) {
		case HOME:
			if (index > 0)
				index--;
			break;

		case END:
			if (index < setting->characterCount - 1)
				index++;
			break;

		case INSERT:
			InsertCharacter(setting, index, NULL);
			fileChanged = 1;
			break;

		case ALT_X:
			scrap = setting->characters[index];

		case DELETE:
			DeleteCharacter(setting, &index);
			fileChanged = 1;
			break;

		case ALT_C:
			scrap = setting->characters[index];
			break;

		case ALT_V:
			InsertCharacter(setting, index, &scrap);
			fileChanged = 1;
			break;

		case ALT_N:
			InsertCharacter(setting, setting->characterCount,
					NULL);
			index = setting->characterCount - 1;
			fileChanged = 1;
			break;

		case ARROW_UP:
			yc--;
			AdjustYC(&yc);
			AdjustXC(yc, &xc);
			break;

		case ARROW_DOWN:
			yc++;
			AdjustYC(&yc);
			AdjustXC(yc, &xc);
			break;

		case ARROW_LEFT:
			xc--;
			AdjustXC(yc, &xc);
			break;

		case ARROW_RIGHT:
			xc++;
			AdjustXC(yc, &xc);
			break;

		case PAGEUP:
			Change(setting, index, yc, xc, 1);
			fileChanged = 1;
			break;

		case PAGEDOWN:
			Change(setting, index, yc, xc, -1);
			fileChanged = 1;
			break;

		case ESCAPE:
			done = 1;
			break;
		}
	}
}
Example #9
0
void CDlgImgShow::Reset()
{
	m_picIndex = 0;
	Display();
}
Example #10
0
void cSatipMenuDeviceStatus::UpdateInfo()
{
  textM = cSatipDevice::GetSatipStatus();
  Display();
  timeoutM.Set(eInfoTimeoutMs);
}
int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        top=0;
        for(int i=0;i<2*n;i++){r_vert[i]=NULL;vert[i]=NULL;}
        for(int i=0;i<n;i++)
        {
            int a1,a2,b1,b2,c;
            scanf("%d:%d %d:%d %d",&a1,&a2,&b1,&b2,&c);
            a1=a1*60+a2;    b1=b1*60+b2;
            start[zeros(i)]=a1; end[zeros(i)]=a1+c;
            start[ones(i)]=b1-c;    end[ones(i)]=b1;
        }
        for(int i=0;i<n;i++)
        {
            for(int j=i+1;j<n;j++)
            {
                int ii=i<<1,jj=j<<1;
                if(intersect(ii,jj))
                {
                    Add_Edge(ii,jj+1);
                    Add_Edge(jj,ii+1);
                }
                if(intersect(ii,jj+1))
                {
                    Add_Edge(ii,jj);
                    Add_Edge(jj+1,ii+1);
                }
                if(intersect(ii+1,jj))
                {
                    Add_Edge(ii+1,jj+1);
                    Add_Edge(jj,ii);
                }
                if(intersect(ii+1,jj+1))
                {
                    Add_Edge(ii+1,jj);
                    Add_Edge(jj+1,ii);
                }
            }
        }
        top=0;
        memset(v,0,sizeof(v));
        for(int i=0;i<2*n;i++)
            if(!v[i])DFS(i);

        memset(v,0,sizeof(v));
        for(int i=top-1;i>=0;i--)
            if(!v[order[i]])DFS_RG(order[i],order[i]);

        bool flag=false;
        for(int i=0;i<n;i++)
            if(id[zeros(i)]==id[ones(i)]){flag=true;   break;}

        if(flag)    puts("NO");
        else{
            puts("YES");
            Display();
        }
    }
    return 0;
}
TBool CAlfExStickersControl::OfferEventL(const TAlfEvent& aEvent)
    {
    //petjarve:This needs to be cleaned up
    TBool visual = EFalse;
    
    //Different user input cases
    //If the event was pointer down event
    if (aEvent.IsPointerEvent() && aEvent.PointerDown())
        {
        iHasBeenDragged = EFalse;
        CAlfVisual* onVisual = aEvent.Visual();
        
        //Find out if sticker (text visual) was interacted
        for (int j = 0; j < KStickerCount; ++j) 
        	{
        	if (aEvent.Visual() == iStickerArray[j]->GetVisual())
        		{
        		iSelectedDeck = iStickerArray[j];
        		visual = ETrue;
        		}
        	}
        
        //Interaction was on a visual
        if (visual)
            {
            iOnVisual = onVisual;
            iPlainLayout->MoveVisualToFront(*iSelectedDeck);

            iDraggingVisual = ETrue;
            }
        
        //Interaction was on background -> move it
        else
            {
            ;
            }   
            
        iStartDisplayPoint = aEvent.PointerEvent().iPosition;
        iStartVisualPos = onVisual->Pos().ValueNow();
            
        Display()->Roster().AddPointerEventObserver(EAlfPointerEventReportDrag, *this);
                
        return ETrue;    
        }
    
    //If the event was a "drag" event
    else if(aEvent.IsPointerEvent() && aEvent.PointerEvent().iType == TPointerEvent::EDrag)
        {
        iHasBeenDragged = ETrue;
        //If we are dragging sticker
        if (iDraggingVisual && iSelectedDeck)
            {
            iDraggedPosition = 
                aEvent.PointerEvent().iPosition
                - iStartDisplayPoint+iViewPos;
            
            iSelectedDeck->SetPos(iDraggedPosition, 50);
            }

        //Else we are dragging the background
        else
            {
            TAlfRealPoint temp = (iStartDisplayPoint-(aEvent.PointerEvent().iPosition));

            if(temp.iX <0) temp.iX=0;
            if(temp.iY <0) temp.iY=0;
            
            if (temp.iY  > iVirtualSize.iHeight - iLayoutsize.iHeight)
	            {
	            temp.iY =iVirtualSize.iHeight- iLayoutsize.iHeight ;
	            }
	            
	        if (temp.iX  > iVirtualSize.iWidth - iLayoutsize.iWidth)
	            {
	            temp.iX=iVirtualSize.iWidth- iLayoutsize.iWidth ;
	            }    
            
            iViewPos=temp;
            iViewPort->SetViewportPos(iViewPos, 0);   
            }    
        
        return ETrue;
        }

    //If the event was simple tap event, ie. not a drag
    else if (aEvent.PointerUp() && iHasBeenDragged == EFalse)
    	{
    	//petjarve: Possibly unneeded check
    	if (iStartDisplayPoint == aEvent.PointerEvent().iPosition && iSelectedDeck)
    		{
    		iSelectedDeck->ChangeStickerSizeL();
    		
	    	return ETrue;
    		}
    	return ETrue;
    	}
    
    else if( aEvent.PointerUp() )
        {
        Display()->Roster().RemovePointerEventObserver(EAlfPointerEventReportDrag, *this);
        iDraggingVisual = EFalse;
        return ETrue;
        }
        
    return EFalse;
    }
Example #13
0
bool HSWDisplay::TickState(ovrHSWDisplayState *hswDisplayState)
{
    bool newlyDisplayed = false;
    const double currentTime = ovr_GetTimeInSeconds();

    // See if we need to be currently displayed. By design we automatically display but don't automatically dismiss.
    if (Displayed)
    {
        if (DismissRequested) // If dismiss was previously requested, see if it can be executed.
            Dismiss();

        if (Displayed) // If not already dismissed above...
        {
            // We currently have the debug behavior that we permit dismiss very soon after launch.
            #if defined(OVR_BUILD_DEBUG)
                if(currentTime >= (StartTime + 2))
                {
                    DismissibleTime = StartTime;
                    //Dismiss();
                }
            #endif
        }

        if (Displayed) // If not already dismissed above...
        {
            const ovrTrackingState ts = ((OVR::CAPI::HMDState*)HMD->Handle)->PredictedTrackingState(currentTime);

            if (ts.StatusFlags & ovrStatus_OrientationTracked) // If the Accelerometer data is valid...
            {
				const OVR::Vector3f v(ts.HeadPose.LinearAcceleration.x, ts.HeadPose.LinearAcceleration.y, ts.HeadPose.LinearAcceleration.z);

                const float minTapMagnitude = 350.0f; // Empirically determined by some testing.

                if (v.LengthSq() > minTapMagnitude)
                    Dismiss(); // This will do nothing if the display is not present.
            }
        }
    }
    else
    {
        if (Enabled && (currentTime >= (LastPollTime + HSWDISPLAY_POLL_INTERVAL)))
        {
            LastPollTime = currentTime;

            // We need to display if any of the following are true:
            //     - The application is just started in Event Mode while the HMD is mounted (warning display would be viewable) and this app was not spawned from a launcher.
            //     - The current user has never seen the display yet while the HMD is mounted (warning display would be viewable).
            //     - The HMD is newly mounted (or the warning display is otherwise newly viewable).
            //     - The warning display hasn't shown in 24 hours (need to verify this as a requirement).
            // Event Mode refers to when the app is being run in a public demo event such as a trade show.

            OVR::CAPI::HMDState* pHMDState = (OVR::CAPI::HMDState*)HMD->Handle;

            if(pHMDState)
            {
                const time_t lastDisplayedTime = HSWDisplay::GetCurrentProfileLastHSWTime();

                // We currently unilaterally set HMDMounted to true because we don't yet have the ability to detect this. To do: Implement this when possible.
                const bool previouslyMounted = HMDMounted;
                HMDMounted = true;
                HMDNewlyMounted = (!previouslyMounted && HMDMounted); // We set this back to false in the Display function or if the HMD is unmounted before then.

                if((lastDisplayedTime == HSWDisplayTimeNever) || HMDNewlyMounted)
                {
                    if(IsDisplayViewable()) // If the HMD is mounted and otherwise being viewed by the user...
                    {
                        Display();
                        newlyDisplayed = true;
                    }
                }
            }
        }
    }

    if(hswDisplayState)
        GetState(hswDisplayState);

    return newlyDisplayed;
}
Example #14
0
int main(int argc, char* argv[])
{
	
	StructIA AIfunctions1, AIfunctions2;
	SGameConfig gameconfig;
	SGameState gamestate, *GSjoueur;
	GSjoueur = malloc(sizeof(SGameState));
	EPlayer player1, player2;
	FILE* fichier = NULL; // Fichier de conservation des scores
	fichier = fopen("resultats.txt", "w");

	// initialisation des structure d'IA
	InitStructIA(&AIfunctions1);
	InitStructIA(&AIfunctions2);
	
	//SGameMode DetectGameMode(int argc, char* argv[], StructIA *AIfunctions1, StructIA *AIfunctions2)
	gameconfig.Mode = DetectGameMode(argc, argv, &AIfunctions1, &AIfunctions2);
	if (gameconfig.Mode == 3) return EXIT_FAILURE;
	
	// EPiece boardInit[4][10]; // Tableau temporaire rempli par les joueurs
	int GameWinner, MatchWinner = 0;
	SMove move;
	//EPiece boardInit1[4][10];
    EPiece boardInit2[4][10];
    EPiece boardInit1[4][10];

	// Init SDL
	if (SDL_Init(SDL_INIT_VIDEO) == -1) // Si erreur :
    {
        fprintf(stderr, "Erreur d'initialisation de la SDL : %s\n", SDL_GetError()); // Écriture de l'erreur
        exit(EXIT_FAILURE); // On quitte le programme
    }

	// Déclarations des var. display + Init
	BoardLayout layout;
	BoardLayout_Init(&layout);
	SDL_Flip(layout.Screen);
	
	//Déclarations des var. event , + Epiece[4][10] à remplir+ entier pour une boucle.
	SDL_Event event;
    int continuer=1;


	//Initialisation du nombre de coups maximal pour les joueurs
	int nbCoups = atoi(argv[1]);

	// Initialisation du nombre de victoires et début du match
	Game_Start(&player1, &player2, &gameconfig);

	// Initialisation des gamestates joueurs et du gamestate général pour le premier jeu
	Game_Begin(&player1, &player2, &gamestate, &gameconfig, nbCoups);

	 // Boucle pour finir le match
		//Premier placement des pions des joueurs
		if((gameconfig.Mode == IA_HUMAN)||(gameconfig.Mode == IA_IA))  // L'IA est le joueur2
		{
			if (gameconfig.Mode == IA_HUMAN)
				Event_InitGameState(&event,&continuer,player1.Color,&layout,boardInit1); 

			AIfunctions1.InitLibrary(gameconfig.Player2Name);
			AIfunctions1.StartGame(player2.Color, boardInit2);
		}
		
		if (gameconfig.Mode == IA_IA)
		{
			AIfunctions2.InitLibrary(gameconfig.Player1Name);
			AIfunctions2.StartGame(player1.Color, boardInit1);
		}

		//Affichage des pieces latérales
		Display_lateralPieces(layout,player1.Color);
		Display_lateralPieces(layout,player2.Color);

		if(player1.Color == ECred)
		{ // Si le premier joueur est rouge alors :
				Game_CpyInitGameState(&gamestate, &player1, boardInit1);
				Game_CpyInitGameState(&gamestate, &player2, boardInit2);

		}
		else // Le joueur 1 est bleu
		{
				Game_CpyInitGameState(&gamestate, &player2, boardInit2);
				Game_CpyInitGameState(&gamestate, &player1, boardInit1);
		}
		
		while(((GameWinner = Game_GotWinner(player1, player2, gamestate, nbCoups)) == 0)&&(continuer)) // tant que le jeu n'a pas de gagnant
		{
			/*jeu*/
			// Le joueur rouge commence
				Display_killedPieces(&layout, player1, gamestate);
				Display_killedPieces(&layout, player2, gamestate);

			if(player1.Color == ECred)
			{
				//joueur 1
				Display(&layout, player1, player2, gamestate, 1);
				if(gameconfig.Mode == IA_HUMAN)
				{
					move=Event_IdMove(&event,player1, &continuer);
				}
				else // IA_IA
				{
					GSjoueur = Game_SwitchGS(gamestate, player1);
					move = AIfunctions2.NextMove(GSjoueur);					
				}
				
				if (continuer)
					Game_DoMove(&gamestate, move, &player1, &player2, &layout, gameconfig, AIfunctions1, AIfunctions2);
				Display(&layout, player1, player2, gamestate, 1);

				if(gameconfig.Mode == IA_IA) pause(&continuer);
				
				if((Game_GotWinner(player1, player2, gamestate, nbCoups)==0)&&(continuer))
				{
					//joueur 2
					Display(&layout, player2, player1, gamestate, 2);
					if((gameconfig.Mode == IA_HUMAN)||(gameconfig.Mode == IA_IA))
					{
						GSjoueur = Game_SwitchGS(gamestate, player2);
						move = AIfunctions1.NextMove(GSjoueur);
					}
					
					if (continuer)
						Game_DoMove(&gamestate, move, &player2, &player1, &layout, gameconfig, AIfunctions1, AIfunctions2);
					Display(&layout, player2, player1, gamestate, 2);
					pause(&continuer);
				}
			}
			else
			{ //joueur 2
				Display(&layout, player2, player1, gamestate, 2);
				if((gameconfig.Mode == IA_HUMAN)||(gameconfig.Mode == IA_IA))
				{
					GSjoueur = Game_SwitchGS(gamestate, player2);
					move = AIfunctions1.NextMove(GSjoueur);
				}
				
				if (continuer)
					Game_DoMove(&gamestate, move, &player2, &player1, &layout, gameconfig, AIfunctions1, AIfunctions2);
				Display(&layout, player2, player1, gamestate, 2);
				pause(&continuer);

				if((Game_GotWinner(player1, player2, gamestate, nbCoups)==0)&&(continuer))
				{
					//joueur 1
					Display(&layout, player1, player2, gamestate, 1);

					if (gameconfig.Mode == IA_HUMAN)
					{
						move=Event_IdMove(&event,player1, &continuer);
					}
					else
					{
						GSjoueur = Game_SwitchGS(gamestate, player1);
						move = AIfunctions2.NextMove(GSjoueur);
					}
					if(gameconfig.Mode == IA_IA) pause(&continuer);

					if (continuer)
						Game_DoMove(&gamestate, move, &player1, &player2, &layout, gameconfig, AIfunctions1, AIfunctions2);
					Display(&layout, player1, player2, gamestate, 1);
				}
			}
		}// while
		
		continuer = 0;

		MatchWinner = Game_EndMatch(player1,  player2, gameconfig, gamestate, nbCoups);

		if (fichier != NULL)
	    {
	    	fprintf(fichier, "Le gagnant du match est le joueur %d\n ", MatchWinner);
	    }

	// Libération de la mémoire occupée par les IA
	
	freeIA(&AIfunctions1);
	if(gameconfig.Mode == IA_IA)
		freeIA(&AIfunctions2);
	fclose(fichier);

	return 0;
}
Example #15
0
void *server(void * arguments){

  struct Node *args=arguments;

  char    buffer[MAXDATALEN],ubuf[50],uname[10];    /* buffer for string the server sends */ 
  char *strp;       
  char     *msg = (char *) malloc(MAXDATALEN);
  int     ts_fd,x,y;
  int     sfd,msglen;
 
  ts_fd = args->port;     /*socket variable passed as arg*/
  strcpy(uname,args->username); 
  addr     a;
 
  /*=sending list of clients online=*/
  a =h ;
  do{
    a = a->next;
    sprintf( ubuf," %s is online\n",a->username );
    send(ts_fd,ubuf,strlen(ubuf),0);
  } while( a->next != NULL );
       

  /*=start chatting=*/
  while(1){

    bzero(buffer,256);
    y=recv(ts_fd,buffer,MAXDATALEN,0);

    if (y==0)
      goto jmp;
                   
    /*=if a client quits=*/
    if ( strncmp( buffer, "quit", 4) == 0 ){
    jmp:    printf("%d ->%s left chat deleting from list\n",ts_fd,uname);
      sprintf(buffer,"%s has left the chat\n",uname);
           
      addr a =  h ;
      do{
	a = a->next;
	sfd = a->port;
	if(sfd == ts_fd)
	  Delete( sfd, h );
	if(sfd != ts_fd)
	  send(sfd,buffer,MAXDATALEN,0);
      }while ( a->next != NULL );
       
      Display( h );
           
      close(ts_fd);
      free(msg);
           
      break;
    }

    /*=sending message to all clients =*/
    printf("%s %s\n",uname,buffer);
    strcpy(msg,uname);
    x=strlen(msg);
    strp = msg;
    strp+= x;
    strcat(strp,buffer);
    msglen=strlen(msg);
         
    addr a = h ;
    do{
      a = a->next;
      sfd = a->port;
      if(sfd != ts_fd)
        send(sfd,msg,msglen,0);

    } while( a->next != NULL );

    Display( h );
    bzero(msg,MAXDATALEN);

  }//end while
  return 0;

}// end server
Example #16
0
void CDlgImgShow::Trigger()
{
	Display();
	++m_picIndex;
}
Example #17
0
void zzz(){
  printf("\rDISPLAYING ONLINE CLIENTS\n\n");
  Display(h);
}
Example #18
0
      //
      // Process
      //
      void Process()
      {
        switch (migration)
        {
          case NORMAL:
          {

            // Sample game speed
            frameRate.Sample(Main::elapTime);

            // Process the client
            Client::Events::Process();

            // Process real time camera things independent of display
            Viewer::GameTimeSim();

            if (Viewer::movie)
            {
              GameTime::Test();
              PERF_S("RenderFlush");
              Vid::RenderFlush();
              PERF_E("RenderFlush");
              return;
            }

            // Should we display or skip this frame
            Bool display = Vid::isStatus.active && GameTime::DisplayCount();
            Bool disPost = *Vid::Var::varRenderPostSim && display;
            U32 displayTime = 0;

            if (display)
            {
              Client::Display::PreRender();

              if (!*Vid::Var::varRenderPostSim)
              {
                PERF_S("Render");
                {
                  U32 start = Clock::Time::UsLwr();
                  Display( TRUE);
                  displayTime += Clock::Time::UsLwr() - start;

                  // Post render parallel code - NON SYNC
                  if (!GameTime::Paused())
                  {
                    Terrain::Simulate( Main::elapSecs);
                  }
                }
                PERF_E("Render");
              }
            }

            // update auto mrm error factor
            //
            //Mesh::Manager::UpdateMRMFactor();

            // Pause when a modal control is active
            if (allowModalPause)
            {
              if (IFace::GetModal())
              {
                if (!GameTime::Paused())
                {
                  GameTime::Pause(FALSE);
                  modalPause = TRUE;
                }
              }
              else
              {
                if (GameTime::Paused() && modalPause)
                {
                  GameTime::Pause(FALSE);
                  modalPause = FALSE;
                }
              }
            }

            // Reset mode BEFORE GameTime::Test
            Utils::FP::Reset();

            // Is it time to do the next game processing
            U32 gameTest = GameTime::Test();

            if (gameTest)
            {
              SYNC_BRUTAL("Mode: " << Utils::FP::GetState() << " Random: " << Random::sync.Raw())

              // Blip an order
              #ifdef SYNC_BRUTAL_ACTIVE
                if (!Missions::ShellActive())
                {
                  Orders::SendBlip();
                }
              #endif

              #ifdef SYNC_BRUTAL_ACTIVE
                SYNC(" === SIM START ===")
                Sync::SyncObjects(TRUE);
                SYNC(" ___ SIM START ___")
              #endif

              PERF_S("Simulation");

              // prepare state0 world matrices and state1 anim targets for this frame
              //
              PERF_S("UpdateMapPos");
              MapObjCtrl::UpdateMapPos();
              PERF_E("UpdateMapPos");

              PERF_S("SimulateInt");
              MapObjCtrl::SimulateInt( GameTime::SimTime());
              PERF_E("SimulateInt");

              SYNC_BRUTAL("Mode: " << Utils::FP::GetState())
            }

            if (disPost)
            {
              PERF_S("Render");
              U32 start = Clock::Time::UsLwr();
              Display( gameTest);
              displayTime += Clock::Time::UsLwr() - start;

              // Post render parallel code - NON SYNC
              if (!GameTime::Paused())
              {
                Terrain::Simulate( Main::elapSecs);
              }
              PERF_E("Render");
            }

            if (gameTest)
            {
              // Reset mode
              Utils::FP::Reset();

              SYNC_BRUTAL("Mode: " << Utils::FP::GetState())

              // Sync vars which should be synced
              SYNC
              (
                Vid::Var::Terrain::shroud
              )

              // Process Environment
              PERF_S("Environment");
              Environment::Process();
              PERF_E("Environment");

              // Perform AI Processing
              PERF_S("AI");
              AI::Process();
              PERF_E("AI");

              // Perform Game Object Thinking
              PERF_S("ObjectThought");
              GameObjCtrl::ProcessObjectThought();
              PERF_E("ObjectThought");

              // FX processing
              // MUST be before particle and mesheffect processing
              // MUST be before GameObjCtrl::DeleteDyingObjects
              // MUST be after ProcessObjectThought
              //
              PERF_S("FX");
              FX::Process();
              PERF_E("FX");

              GameObjCtrl::DeleteDyingObjects();

              // Perform Path Searching
              PERF_S("PathSearching");
              PathSearch::ProcessRequests();
              PERF_E("PathSearching");

              // Movement collision resolution
              PERF_S("Movement::Mediate");
              Movement::Mediator::Process();
              PERF_E("Movement::Mediate");

              // Do all per-cycle object processing
              MapObjCtrl::ProcessObjects();

              // Perform collision fixups
              //
              // this resets the world matrices
              // should be after all object position updates
              //
              PERF_S("Collision Resolve");
              CollisionCtrl::Resolve();
              PERF_E("Collision Resolve");

              // Perform Particle Processing
              PERF_S("ParticleSimulate");
              ParticleSystem::Simulate( GameTime::SimTime());
              ParticleSystem::SimulateInt( Main::elapSecs);
              PERF_E("ParticleSimulate");

              // Perform Team Processing
              PERF_S("Team");
              Team::ProcessAll();
              PERF_E("Team");

              #ifdef SYNC_BRUTAL_ACTIVE
                SYNC(" === SIM END ===")
                Sync::SyncObjects(TRUE);
                SYNC(" ___ SIM END ___")
              #endif

              SYNC_BRUTAL("Mode: " << Utils::FP::GetState())

              // Update line of sight display
              PERF_S("Sight::DetachedList");
              Sight::ProcessDetachedList();
              PERF_E("Sight::DetachedList");

              // Update line of sight display
              PERF_S("Sight Display");
              Sight::UpdateDisplay( Team::GetDisplayTeam());
              PERF_E("Sight Display");

              // Tell game time to recompute the display cycles per game cycle
              GameTime::Compute();

              // NON-SYNC client side processing that is done at the sim rate
              PERF_S("Demo");
              Demo::Process();
              PERF_E("Demo");

              PERF_E("Simulation");
            }
            else 
        
            // Process interpolation
            if (Vid::renderState.status.interpMesh && !GameTime::Paused() && !GameTime::IsStalled())
            {
              PERF_S("Interpolate");
              MapObjCtrl::SimulateInt( Main::elapSecs);
              PERF_E("Interpolate");

              if (disPost)
              {
                PERF_S("Render");

                U32 start = Clock::Time::UsLwr();
                Display( FALSE);
                displayTime += Clock::Time::UsLwr() - start;

                // Post render parallel code - NON SYNC
                if (!GameTime::Paused())
                {
                  Terrain::Simulate( Main::elapSecs);
                }
                PERF_E("Render");
              }

              ParticleSystem::SimulateInt( Main::elapSecs);
            }

            // Main rendering code
            if (display)
            {
              PERF_S("PostRender");

              U32 start = Clock::Time::UsLwr();

              // Finish render
              Vid::RenderEnd();

              PERF_S("RenderFlush");
              Vid::RenderFlush();
              PERF_E("RenderFlush");

              displayTime += Clock::Time::UsLwr() - start;

              PERF_E("PostRender");

              // Notify client that rendering is finished
              Client::Display::PostRender();

              // Report display time to GameTime
              GameTime::DisplaySample(displayTime);

              displayRate.Sample(displayTime / 1000);
              triCount.Sample(Main::triCount);
            }
            break;
          }

          case MIGRATING:

            if (!MultiPlayer::Data::Online())
            {
              migration = NORMAL;
              LOG_DIAG(("Switching to NORMAL"))
              return;
            }

            // Process input events
            if (Main::active)
            {
              IFace::Process();
            }

            if (!MultiPlayer::Data::Online())
            {
              migration = NORMAL;
              LOG_DIAG(("Switching to NORMAL"))
              return;
            }
Example #19
0
BOOL VisibleList::Interact(ListControl& Control)
{
	BOOL Ok = Display(Control);
	Control.Enable();
	return Ok;
}
SharedSurface_ANGLEShareHandle::~SharedSurface_ANGLEShareHandle()
{
    mEGL->fDestroySurface(Display(), mPBuffer);
}
Example #21
0
void FieldNewCalcUniDlg::OnUnaryOperatorUpdated( wxCommandEvent& event )
{
    Display();
}
Example #22
0
void CPDF_ProgressiveReflowPageRender::Continue(IFX_Pause* pPause)
{
    Display(pPause);
}
Example #23
0
bool wxHtmlHelpController::DisplaySection(int sectionNo)
{
    return Display(sectionNo);
}
Example #24
0
bool
ServerAgent::ParseENums (const char *data, const char *sWord)
{
	int num (atoi (sWord));

	switch (num)
	{
		case ZERO:								 // 0
			{
				// wasn't a numeric, or the server is playing tricks on us
			}
			return false;

		case ERR_UNKNOWNCOMMAND:	 // 421
			{
				BString tempString (RestOfString (data, 4)),
								badCmd (GetWord (data, 4));

				if (badCmd == "VISION_LAG_CHECK")
				{
					int32 difference (system_time() - fLagCheck);
					if (difference > 0)
					{
						int32 secs (difference / 1000000);
						int32 milli (difference / 1000 - secs * 1000);
						char lag[15] = "";
						sprintf (lag, "%0" B_PRId32 ".%03" B_PRId32, secs, milli);
						fMyLag = lag;
						fLagCount = 0;
						fCheckingLag = false;
						fMsgr.SendMessage (M_LAG_CHANGED);
					}
				}
				else
				{
					tempString.RemoveFirst (":");
					tempString.Append ("\n");
					Display (tempString.String());
				}
			}
			return true;


		case RPL_WELCOME:					// 001
		case RPL_YOURHOST:				 // 002
		case RPL_CREATED:					// 003
		case RPL_MYINFO:					 // 004
			{
				fConnected = true;
				fIsConnecting = false;
				fInitialMotd = true;
				fRetry = 0;

				if (num == RPL_WELCOME)
				{
					BString message = B_TRANSLATE("Established");
					message.Prepend("[@] ").Append("\n");
					Display(message.String(), C_ERROR, C_BACKGROUND, F_SERVER);
				}

				if (fNetworkData.FindBool ("lagCheck"))
				{
					fMyLag = "0.000";
					fMsgr.SendMessage (M_LAG_CHANGED);
				}
				BString theNick (GetWord (data, 3));
				fMyNick = theNick;

				if (!IsHidden())
					vision_app->pClientWin()->pStatusView()->SetItemValue (STATUS_NICK,
						theNick.String());

				BString theMsg (RestOfString (data, 4));
				theMsg.RemoveFirst (":");
				theMsg.Prepend ("* ");
				theMsg.Append ("\n");
				Display (theMsg.String());


				if (num == RPL_MYINFO)
				{
					// set "real" hostname
					fServerHostName = (GetWord (data, 1));
					fServerHostName.RemoveFirst (":");
					BString hostName (fId.String());
					hostName += " - [";
					hostName += fServerHostName.String();
					hostName += "]";
					fAgentWinItem->SetName (hostName.String());

					// detect IRCd
					fIrcdtype = IRCD_STANDARD;

					if (theMsg.FindFirst("hybrid") > 0)
						fIrcdtype = IRCD_HYBRID;
					// ultimate and unreal share the same numerics, so treat them with the same
					// identifier for now
					else if ((theMsg.FindFirst("UltimateIRCd") > 0) || (theMsg.FindFirst("Unreal") > 0))
						fIrcdtype = IRCD_ULTIMATE;
					else if (theMsg.FindFirst("comstud") > 0)
						fIrcdtype = IRCD_COMSTUD;
					else if (theMsg.FindFirst("u2.") > 0)
						fIrcdtype = IRCD_UNDERNET;
					else if (theMsg.FindFirst("PTlink") > 0)
						fIrcdtype = IRCD_PTLINK;
					else if (theMsg.FindFirst ("CR") > 0)
						fIrcdtype = IRCD_CONFERENCEROOM;
					else if (theMsg.FindFirst ("nn-") > 0)
						fIrcdtype = IRCD_NEWNET;
				}
			}
			return true;


		case RPL_PROTOCTL:				 // 005
			{
				// this numeric also serves as RPL_NNMAP on Newnet

				BString theMsg (RestOfString (data, 4));
				theMsg.RemoveFirst (":");
				theMsg.Append ("\n");

				switch (fIrcdtype)
				{
					case IRCD_NEWNET:
						{
							// RPL_NNMAP
							Display (theMsg.String());
						}
						break;

					default:
						{
							// RPL_PROTOCTL
							theMsg.Prepend ("* ");
							Display (theMsg.String());
						}
				}
			}
			return true;



		case RPL_LUSERHIGHESTCONN: // 250
		case RPL_LUSERCLIENT:			// 251
		case RPL_LUSEROP:					// 252
		case RPL_LUSERUNKNOWN:		 // 253
		case RPL_LUSERCHANNELS:		// 254
		case RPL_LUSERME:					// 255
		case RPL_LUSERLOCAL:			 // 265
		case RPL_LUSERGLOBAL:			// 266
			{
				BString theMsg (RestOfString (data, 4));
				theMsg.RemoveFirst (":");
				theMsg.Prepend ("* ");
				theMsg.Append ("\n");
				Display (theMsg.String());
			}
			return true;


		/// strip and send to server agent	///
		case RPL_ULMAP:						 // 006
		case RPL_ULMAPEND:					// 007
		case RPL_U2MAP:						 // 015
		case RPL_U2MAPEND:					// 017
		case RPL_TRACELINK:				 // 200
		case RPL_TRACECONNECTING:	 // 201
		case RPL_TRACEHANDSHAKE:		// 202
		case RPL_TRACEUNKNOWN:			// 203
		case RPL_TRACEOPERATOR:		 // 204
		case RPL_TRACEUSER:				 // 205
		case RPL_TRACESERVER:			 // 206
		case RPL_TRACENEWTYPE:			// 208
		case RPL_TRACECLASS:				// 209
		case RPL_STATSLINKINFO:		 // 211
		case RPL_STATSCOMMANDS:		 // 212
		case RPL_STATSCLINE:				// 213
		case RPL_STATSNLINE:				// 214
		case RPL_STATSILINE:				// 215
		case RPL_STATSKLINE:				// 216
		case RPL_STATSQLINE:				// 217
		case RPL_STATSYLINE:				// 218
		case RPL_ENDOFSTATS:				// 219
		case RPL_STATSBLINE:				// 220
		case RPL_DALSTATSE:				 // 223
		case RPL_DALSTATSF:				 // 224
		case RPL_DALSTATSZ:				 // 225
		case RPL_DALSTATSN:				 // 226
		case RPL_DALSTATSG:				 // 227
		case RPL_STATSLLINE:				// 241
		case RPL_STATSUPTIME:			 // 242
		case RPL_STATSOLINE:				// 243
		case RPL_STATSHLINE:				// 244
		case RPL_STATSSLINE:				// 245
		case RPL_DALSTATSX:				 // 246
		case RPL_STATSXLINE:				// 247
		case RPL_STATSPLINE:				// 249
		case RPL_ADMINME:					 // 256
		case RPL_ADMINLOC1:				 // 257
		case RPL_ADMINLOC2:				 // 258
		case RPL_ADMINEMAIL:				// 259
		case RPL_TRACELOG:					// 261
		case RPL_ENDOFTRACE:				// 262
		case RPL_SILELIST:					// 271
		case RPL_ENDOFSILELIST:		 // 272
		case RPL_ENDOFWHO:					// 315
		case RPL_CHANSERVURL:			 // 328
		case RPL_COMMANDSYNTAX:		 // 334
		case RPL_VERSION:					 // 351
		case RPL_WHOREPLY:					// 352
		case RPL_BANLIST:					 // 367
		case RPL_ENDOFBANLIST:			// 368
		case RPL_INFO:							// 371
		case RPL_ENDOFINFO:				 // 374
		case RPL_YOUREOPER:				 // 381
		case RPL_REHASHING:				 // 382
		case RPL_TIME:							// 391
		case ERR_NOORIGIN:					// 409
		case ERR_NOTEXTTOSEND:			// 412
		case ERR_TOOMANYAWAY:			 // 429
		case ERR_NICKCHANGETOOFAST: // 438
		case ERR_TARGETCHANGETOOFAST: // 439
		case ERR_SUMMONDISABLED:		// 445
		case ERR_USERSDISABLED:		 // 446
		case ERR_NOTREGISTERED:		 // 451
		case ERR_NEEDMOREPARMS:		 // 461
		case ERR_PASSWDMISMATCH:		// 464
		case ERR_YOUREBANNEDCREEP:	// 465
		case ERR_NOPRIVILEGES:			// 481
		case ERR_NOOPERHOST:				// 491
		case ERR_USERSDONTMATCH:		// 502
		case ERR_SILELISTFULL:			// 511
		case ERR_TOOMANYWATCH:			// 512
		case ERR_TOOMANYDCC:				// 514
		case ERR_CANTINVITE:				// 518
		case ERR_LISTSYNTAX:				// 521
		case ERR_WHOSYNTAX:				 // 522
		case ERR_WHOLIMEXCEED:			// 523
		case RPL_LOGON:						 // 600
		case RPL_LOGOFF:						// 601
		case RPL_WATCHOFF:					// 602
		case RPL_WATCHSTAT:				 // 603
		case RPL_NOWON:						 // 604
		case RPL_NOWOFF:						// 605
		case RPL_WATCHLIST:				 // 606
		case RPL_ENDOFWATCHLIST:		// 607
		case RPL_DCCALLOWLIST:			// 618
		case RPL_DCCALLOWEND:			 // 619
		case RPL_DCCALLOW:					// 620
			{
				BString tempString (RestOfString (data, 4));
				tempString.RemoveFirst (":");
				tempString.Append ("\n");
				Display (tempString.String());
			}
			return true;

		case RPL_UMODEIS:					 // 221
			{
				BString theMode (GetWord (data, 4));

				BString tempString = B_TRANSLATE("Your current mode is %1");
				tempString.ReplaceFirst("%1", theMode);
				tempString += '\n';

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_WHOIS);
				PostActive (&msg);
			}
			return true;

		/// strip and send to active agent	///
		case RPL_TRYAGAIN:					// 263
		case RPL_UNAWAY:						// 305
		case RPL_NOWAWAY:					 // 306
		case ERR_NOSUCHNICK:				// 401
		case ERR_NOSUCHSERVER:			// 402
		case ERR_NOSUCHCHANNEL:		 // 403
		case ERR_CANNOTSENDTOCHAN:	// 404
		case ERR_TOOMANYCHANNELS:	 // 405
		case ERR_WASNOSUCHNICK:		 // 406
		case ERR_TOOMANYTARGETS:		// 407
		case ERR_NOCOLORSONCHAN:		// 408
		case ERR_YOUCANTDOTHAT:		 // 460
		case ERR_CHANOPRIVSNEEDED:	// 482
			{
				BString tempString ("[x] ");
				if (num == ERR_CHANOPRIVSNEEDED)
					tempString += RestOfString (data, 5);
				else
					tempString += RestOfString (data, 4);
				tempString.RemoveFirst (":");
				tempString.Append ("\n");

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
			}
			return true;

		case RPL_AWAY:						 // 301
			{
				BString theNick (GetWord(data, 4));
				BString tempString ("[x] "),
							theReason (RestOfString(data, 5));
				theReason.RemoveFirst(":");
				tempString += "Away: ";
				tempString += theReason;
				tempString += '\n';

				if (fRemoteAwayMessages.find(theNick) != fRemoteAwayMessages.end())
				{
					if (fRemoteAwayMessages[theNick] == theReason)
					{
						return true;
					}
				}
				fRemoteAwayMessages[theNick] = theReason;
				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
			}
			return true;

		case RPL_USERHOST:				// 302
			{
				BString theHost (GetWord (data, 4)),
								theHostname (GetAddress (theHost.String()));
				theHost.RemoveFirst (":");

				BString tempString (RestOfString (data, 4));
				tempString.RemoveFirst (":");
				tempString.Append ("\n");
				Display (tempString.String());

				if (fGetLocalIP && (tempString.IFindFirst (fMyNick.String()) == 0))
				{
					fGetLocalIP = false;
					struct addrinfo *info;
					struct addrinfo hints;
					memset(&hints, 0, sizeof(addrinfo));
					hints.ai_family = AF_UNSPEC;
					hints.ai_socktype = SOCK_STREAM;
					hints.ai_protocol = IPPROTO_TCP;
					int result = getaddrinfo(theHostname.String(), NULL, &hints, &info);
					if (result == 0)
					{
						char addr_buf[INET6_ADDRSTRLEN];
						getnameinfo(info->ai_addr, info->ai_addrlen, addr_buf, sizeof(addr_buf),
						NULL, 0, NI_NUMERICHOST);
						fLocalip = addr_buf;
						printf("Got address: %s\n", fLocalip.String());
						freeaddrinfo(info);
						return true;
					}
				}
			}
			return true;

		case RPL_ISON:					 // 303
			{
				BString nicks (RestOfString (data, 4));
				BString onlined, offlined;

				nicks.RemoveFirst (":");

				int hasChanged (0);

				BMessage msg (M_NOTIFYLIST_UPDATE);

				for (int32 i = 0; i < fNotifyNicks.CountItems(); i++)
				{
					NotifyListItem *item (((NotifyListItem *)fNotifyNicks.ItemAt(i)));

					int32 nickidx (nicks.IFindFirst(item->Text()));

					// make sure that the nick isn't a partial match.
					if ((nickidx >= 0) &&
						((nicks[nickidx + strlen(item->Text())] == ' ') || (nicks[nickidx + strlen(item->Text())] == '\0')))
					{
						if (item->GetState() != true)
						{
							item->SetState (true);
							hasChanged = 1;

							if (onlined.Length())
								onlined << ", ";
							onlined << item->Text();
#ifdef USE_INFOPOPPER
							if (be_roster->IsRunning(InfoPopperAppSig) == true) {
								entry_ref ref = vision_app->AppRef();
								BMessage infoMsg(InfoPopper::AddMessage);
								infoMsg.AddString("appTitle", S_INFOPOPPER_TITLE);
								infoMsg.AddString("title", fId.String());
								infoMsg.AddInt8("type", (int8)InfoPopper::Information);

								infoMsg.AddInt32("iconType", InfoPopper::Attribute);
								infoMsg.AddRef("iconRef", &ref);

								BString content;
								content << item->Text() << " is online";
								infoMsg.AddString("content", content);

								BMessenger(InfoPopperAppSig).SendMessage(&infoMsg);
							};
#endif

						}
					}
					else
					{
						if (item->GetState() == true)
						{
							item->SetState (false);
							hasChanged = 2;

							if (offlined.Length())
								offlined << ", ";
							offlined << item->Text();
#ifdef USE_INFOPOPPER
							if (be_roster->IsRunning(InfoPopperAppSig) == true) {
				entry_ref ref = vision_app->AppRef();
								BMessage infoMsg(InfoPopper::AddMessage);
								infoMsg.AddString("appTitle", S_INFOPOPPER_TITLE);
								infoMsg.AddString("title", fId.String());
								infoMsg.AddInt8("type", (int8)InfoPopper::Information);

								infoMsg.AddInt32("iconType", InfoPopper::Attribute);
								infoMsg.AddRef("iconRef", &ref);

								BString content;
								content << item->Text() << " is offline";
								infoMsg.AddString("content", content);

								BMessenger(InfoPopperAppSig).SendMessage(&infoMsg);
							};
#endif

						}
					}
#ifdef __HAIKU__
					if (offlined.Length())
					{
						BNotification notification(B_INFORMATION_NOTIFICATION);
						notification.SetGroup(BString("Vision"));
						entry_ref ref = vision_app->AppRef();
						notification.SetOnClickFile(&ref);
						notification.SetTitle(fServerName.String());
						BString content;
						content << offlined;
						if (offlined.FindFirst(' ') > -1)
							content << " are offline";
						else
							content << " is offline";


						notification.SetContent(content);
						notification.Send();
					}
					if (onlined.Length())
					{
						BNotification notification(B_INFORMATION_NOTIFICATION);
						notification.SetGroup(BString("Vision"));
						entry_ref ref = vision_app->AppRef();
						notification.SetOnClickFile(&ref);
						notification.SetTitle(fServerName.String());
						BString content;
						content << onlined;
						if (onlined.FindFirst(' ') > -1)
							content << " are online";
						else
							content << " is online";


						notification.SetContent(content);
						notification.Send();
					}
#endif
				}
				fNotifyNicks.SortItems(SortNotifyItems);
				msg.AddPointer ("list", &fNotifyNicks);
				msg.AddPointer ("source", this);
				msg.AddInt32 ("change", hasChanged);
				Window()->PostMessage (&msg);
			}
			return true;

		case RPL_WHOISIDENTIFIED:	 // 307
			{
				BString theInfo (RestOfString (data, 5));
				theInfo.RemoveFirst (":");

				if (theInfo == "-9z99")
				{
					// USERIP reply? (RPL_U2USERIP)
					BString tempString (RestOfString (data, 4));
					tempString.RemoveFirst (":");
					tempString.Append ("\n");
					Display (tempString.String());
					return true;
				}

				BMessage display (M_DISPLAY);
				BString buffer;

				buffer += "[x] ";
				buffer += theInfo;
				buffer += "\n";
				PackDisplay (&display, buffer.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&display);
			}
			return true;

		case RPL_WHOISADMIN:					// 308
		case RPL_WHOISSERVICESADMIN:	// 309
		case RPL_WHOISHELPOP:				 // 310
		case RPL_WHOISOPERATOR:			 // 313
		case RPL_WHOISREGNICK:				// 320
		case RPL_WHOISACTUALLY:			 // 338
		case RPL_WHOISMASK:					 // 550
		case RPL_WHOWASIP:						// 612
		case RPL_WHOISUSERMODESALT:	 // 614
		case RPL_WHOISUSERMODES:			// 615
		case RPL_WHOISREALHOSTNAME:	 // 616
			{
				BString theInfo (RestOfString (data, 5));
				theInfo.RemoveFirst (":");

				BMessage display (M_DISPLAY);
				BString buffer;

				buffer += "[x] ";
				buffer += theInfo;
				buffer += "\n";
				PackDisplay (&display, buffer.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&display);
			}
			return true;

		case RPL_WHOISUSER:				// 311
			{
				BString theNick (GetWord (data, 4)),
								theIdent (GetWord (data, 5)),
								theAddress (GetWord (data, 6)),
								theName (RestOfString (data, 8));
				theName.RemoveFirst (":");

				BMessage display (M_DISPLAY);
				BString buffer;

				buffer += "[x] ";
				buffer += theNick;
				buffer += " (";
				buffer += theIdent;
				buffer += "@";
				buffer += theAddress;
				buffer += ")\n";
				buffer += "[x] ";
				buffer += theName;
				buffer += "\n";

				PackDisplay (&display, buffer.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&display);
			}
		return true;

		case RPL_WHOISSERVER:	 // 312
			{
				BString theNick (GetWord (data, 4)),
								theServer (GetWord (data, 5)),
								theInfo (RestOfString (data, 6));
				theInfo.RemoveFirst (":");

				BMessage display (M_DISPLAY);
				BString buffer;

				buffer += "[x] Server: ";
				buffer += theServer;
				buffer += " (";
				buffer += theInfo;
				buffer += ")\n";
				PackDisplay (&display, buffer.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&display);
			}
			return true;

		case RPL_WHOWASUSER:		 // 314
			{
				BString theNick (GetWord (data, 4)),
								theIdent (GetWord (data, 5)),
								theAddress (GetWord (data, 6)),
								theName (RestOfString (data, 8)),
								tempString ("[x] ");
				theName.RemoveFirst (":");
				tempString += B_TRANSLATE("%1 was (%2)");
				tempString.ReplaceFirst("%1", theNick);
				BString nickString = theIdent << "@" << theAddress;
				tempString.ReplaceFirst("%2", nickString.String());
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
			}
			return true;

		case RPL_WHOISIDLE:			 // 317
			{
				BString theNick (GetWord (data, 4)),
								tempString ("[x] "),
								tempString2 ("[x] "),
								theTime (GetWord (data, 5)),
								signOnTime (GetWord (data, 6));

				int64 idleTime (strtoul(theTime.String(), NULL, 0));
				tempString += B_TRANSLATE("Idle");
				tempString += ": ";
				tempString += DurationString(idleTime * 1000 * 1000);
				tempString += "\n";

				int32 serverTime = strtoul(signOnTime.String(), NULL, 0);
				struct tm ptr;
				time_t st;
				char str[80];
				st = serverTime;
				localtime_r (&st, &ptr);
				strftime (str,80,"%A %b %d %Y %I:%M %p %Z", &ptr);
				BString signOnTimeParsed (str);
				signOnTimeParsed.RemoveAll ("\n");

				tempString2 += B_TRANSLATE("Signon");
				tempString2 += ": ";
				tempString2 += signOnTimeParsed;
				tempString2 += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
				PackDisplay (&msg, tempString2.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
			}
			return true;

		case RPL_ENDOFWHOIS:	 // 318
		case RPL_ENDOFNAMES:	 // 366
		case RPL_ENDOFWHOWAS:	// 369
			{
				// nothing
			}
			return true;

		case RPL_WHOISCHANNELS:	 // 319
			{
				BString theChannels (RestOfString (data, 5));
				theChannels.RemoveFirst(":");

				BMessage display (M_DISPLAY);
				BString buffer = "[x] ";

				buffer += B_TRANSLATE("Channels");
				buffer += ": ";
				buffer += theChannels;
				buffer += "\n";
				PackDisplay (&display, buffer.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
				PostActive (&display);
			}
			return true;

		case RPL_LISTSTART:			 // 321
			{
				BMessage msg (M_LIST_BEGIN);
				if (fListAgent)
					vision_app->pClientWin()->DispatchMessage(&msg, (BView *)fListAgent);
			}
			return true;

		case RPL_LIST:						// 322
			{
				BMessage msg (M_LIST_EVENT);
				BString channel (GetWord (data, 4)),
								users (GetWord (data, 5)),
								topic (RestOfString (data, 6));
				topic.RemoveFirst (":");

				msg.AddString ("channel", channel.String());
				msg.AddString ("users", users.String());
				msg.AddString ("topic", topic.String());

				if (fListAgent)
					vision_app->pClientWin()->DispatchMessage(&msg, (BView *)fListAgent);
			}
			return true;

		case RPL_LISTEND:				 // 323
			{
				BMessage msg (M_LIST_DONE);

				if (fListAgent)
					vision_app->pClientWin()->DispatchMessage(&msg, (BView *)fListAgent);
			}
			return true;

		case RPL_CHANNELMODEIS:	 // 324
			{
				BString theChan (GetWord (data, 4)),
								theMode (GetWord (data, 5)),
								tempStuff (RestOfString (data, 6));

				if (tempStuff != "-9z99")
				{
					theMode.Append(" ");
					theMode.Append(tempStuff); // avoid extra space w/o params
				}

				ClientAgent *aClient (ActiveClient()),
										*theClient (Client (theChan.String()));

				BString tempString("*** ");
				tempString += B_TRANSLATE("Channel mode for %1: %2");
				tempString.ReplaceFirst("%1", theChan.String());
				tempString.ReplaceFirst("%2", theMode.String());
				tempString += '\n';

				BMessage msg (M_CHANNEL_MODES);

				msg.AddString ("msgz", tempString.String());
				msg.AddString ("chan", theChan.String());
				msg.AddString ("mode", theMode.String());

				if (theClient)
					theClient->fMsgr.SendMessage (&msg);
				else if (aClient)
					aClient->fMsgr.SendMessage (&msg);
				else
					Display (tempString.String(), C_OP);
			}
			return true;

		case RPL_CHANNELMLOCK:		// 325
			{
				BString theChan (GetWord (data, 4)),
								mLock (GetWord (data, 8)),
								lockMessage ("*** ");
				lockMessage += B_TRANSLATE("Channel mode lock for %1: %2");
				lockMessage.ReplaceFirst("%1", theChan);
				lockMessage.ReplaceFirst("%2", mLock);
				lockMessage += "\n";

				BMessage display (M_DISPLAY);

				PackDisplay (&display, lockMessage.String(), C_OP, C_BACKGROUND, F_TEXT);
				ClientAgent *theClient (Client (theChan.String()));
				if (theClient)
					theClient->fMsgr.SendMessage (&display);
				else
					fMsgr.SendMessage (&display);
			}
			return true;

		case RPL_CHANNELCREATED:			 // 329
			{
				BString theChan (GetWord (data, 4)),
								theTime (GetWord (data, 5)),
								tempString;

				int32 serverTime (strtoul(theTime.String(), NULL, 0));
				struct tm ptr;
				time_t st;
				char str[80];
				st = serverTime;
				localtime_r (&st, &ptr);
				strftime (str,80,"%a %b %d %Y %I:%M %p %Z",&ptr);
				BString theTimeParsed (str);
				theTimeParsed.RemoveAll ("\n");

			tempString = B_TRANSLATE("Channel %1 was created at %2");
			tempString.ReplaceFirst("%1", theChan);
			tempString.ReplaceFirst("%2", theTimeParsed);
				tempString += '\n';
				Display (tempString.String());
			}
			return true;

		case RPL_NOTOPIC:						 // 331
			{
				BString theChan (GetWord (data, 4)),
								tempString ("[x] ");
				tempString += B_TRANSLATE("No topic set in %1");
				tempString.ReplaceFirst("%1", theChan);
				tempString += '\n';

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_ERROR);
				PostActive (&msg);
			}
			return true;

		case RPL_TOPIC:							 // 332
			{
				BString theChannel (GetWord (data, 4)),
								theTopic (RestOfString (data, 5));
				ClientAgent *client (Client (theChannel.String()));

				theTopic.RemoveFirst (":");

				if (client)
				{
					BMessage display (M_DISPLAY);
					BString buffer;

					buffer += "*** ";
					buffer += B_TRANSLATE("Topic: %1");
					buffer.ReplaceFirst("%1", theTopic);
					buffer += '\n';
					PackDisplay (&display, buffer.String(), C_WHOIS);

					BMessage msg (M_CHANNEL_TOPIC);
					msg.AddString ("topic", theTopic.String());
					msg.AddMessage ("display", &display);

					if (client->fMsgr.IsValid())
						client->fMsgr.SendMessage (&msg);
				}
			}
			return true;

		case RPL_TOPICSET:						// 333
			{
				BString channel (GetWord (data, 4)),
								user (GetWord (data, 5)),
								theTime (GetWord (data, 6));

				int32 serverTime (strtoul(theTime.String(), NULL, 0));
				struct tm ptr;
				time_t st;
				char str[80];
				st = serverTime;
				localtime_r (&st, &ptr);
				strftime (str,80,"%A %b %d %Y %I:%M %p %Z",&ptr);
				BString theTimeParsed (str);
				theTimeParsed.RemoveAll ("\n");

				ClientAgent *client (Client (channel.String()));

				if (client)
				{
					BMessage display (M_DISPLAY);
					BString buffer = "*** ";

					buffer += B_TRANSLATE("Topic set by %1 at %2");
					buffer.ReplaceFirst("%1", user);
					buffer.ReplaceFirst("%2", theTimeParsed);
					buffer += '\n';
					PackDisplay (&display, buffer.String(), C_WHOIS);
					if (client->fMsgr.IsValid())
						client->fMsgr.SendMessage (&display);
				}
			}
			return true;

		case RPL_INVITING:						 // 341
			{
				BString channel (GetWord (data, 5)),
								theNick (GetWord (data, 4)),
								tempString;

				tempString += "*** ";
				tempString += B_TRANSLATE("%1 has been invited to %2.");
				tempString.ReplaceFirst("%1", theNick);
				tempString.ReplaceFirst("%2", channel);
				tempString += "\n";

				BMessage display (M_DISPLAY);

				PackDisplay (&display, tempString.String(), C_WHOIS);
				PostActive (&display);
			}
			return true;


		case RPL_NAMEREPLY:						 // 353
			{
				BString channel (GetWord (data, 5)),
								names (RestOfString (data, 6));
				ClientAgent *client (Client (channel.String()));
				names.RemoveFirst (":");

					BString tempString ("*** ");
					tempString += B_TRANSLATE("Users in %1: %2");
					tempString.ReplaceFirst("%1", channel);
					tempString.ReplaceFirst("%2", names);
					tempString += '\n';
					Display (tempString.String(), C_TEXT);

				if (client) // in the channel
				{
					BMessage msg (M_CHANNEL_NAMES);
					BString nick;
					int32 place (1);

					while ((nick = GetWord (names.String(), place)) != "-9z99")
					{
						const char *sNick (nick.String());
						bool founder (false),
								 protect (false),
								 op (false),
								 voice (false),
								 helper (false),
							 ignored;

						if (nick[0] == '*')
						{
							++sNick;
							founder = true;
						}
						else if (nick[0] == '!')
						{
							++sNick;
							protect = true;
						}
						else if (nick[0] == '@')
						{
							++sNick;
							op = true;
						}
						else if (nick[0] == '+')
						{
							++sNick;
							voice = true;
						}
						else if (nick[0] == '%')
						{
							++sNick;
							helper = true;
						}

						ignored = false;
						// BMessage aMsg (M_IS_IGNORED), reply;
						// aMsg.AddString ("server", fServerName.String());
						// aMsg.AddString ("nick", sNick);

						// be_app_messenger.SendMessage (&aMsg, &reply);
						// reply.FindBool ("ignored", &ignored);

						msg.AddString ("nick", nick.String());
						msg.AddBool ("founder", founder);
						msg.AddBool ("protect", protect);
						msg.AddBool ("op", op);
						msg.AddBool ("voice", voice);
						msg.AddBool ("helper", helper);
						msg.AddBool ("ignored", ignored);
						++place;
					}

					if (client->fMsgr.IsValid())
						client->fMsgr.SendMessage (&msg);
				}
			}
			return true;

		case RPL_MOTD:						// 372
		case RPL_MOTDALT:				 // 378
		case RPL_OPERMOTDSTART:	 // 609
		case RPL_OPERMOTD:				// 610
		case RPL_OPERENDOFMOTD:	 // 611
			{
				BString tempString (RestOfString(data, 4));
				tempString.RemoveFirst (":");
				tempString.Append ("\n");
				Display (tempString.String(), C_SERVER, C_BACKGROUND, F_SERVER);
			}
			return true;

		case RPL_MOTDSTART:				// 375
			{

				BString tempString ("- ");
				tempString += B_TRANSLATE("Server Message Of the Day");
				tempString += ":\n";
				Display (tempString.String(), C_SERVER, C_BACKGROUND, F_SERVER);
			}
			return true;

		case RPL_ENDOFMOTD:				// 376
		case ERR_NOMOTD:					 // 422
			{
				BString tempString (RestOfString (data, 4));
			tempString.RemoveFirst (":");
			tempString.Append ("\n");

				Display (tempString.String(), C_SERVER, C_BACKGROUND, F_SERVER);

				if (fInitialMotd && fCmds.Length())
				{
					BMessage msg (M_SUBMIT_INPUT);
					const char *place (fCmds.String()), *eol;

					msg.AddInt32 ("which", PASTE_MULTI_NODELAY);

					while ((eol = strchr (place, '\n')) != 0)
					{
						BString line;

						line.Append (place, eol - place);
						msg.AddString ("data", line.String());
						ParseAutoexecChans (line);
						place = eol + 1;
					}

					if (*place)
					{
						// check in case this was the only line
						ParseAutoexecChans (BString(place));
						msg.AddString ("data", place);
					}

					msg.AddInt32 ("which", 3);
					msg.AddBool ("autoexec", true);
					fMsgr.SendMessage (&msg);
				}

				BString IPCommand ("/userhost ");
				IPCommand += fMyNick;
				ParseCmd (IPCommand.String());

				if (fReconnecting)
				{
					BString reString = "[@] ";
					reString += B_TRANSLATE("Successful reconnect");
					reString += "\n";
					Display (reString.String(), C_ERROR);
					DisplayAll (reString.String(), C_ERROR, C_BACKGROUND, F_SERVER);
					fMsgr.SendMessage (M_REJOIN_ALL);
					fReconnecting = false;
				}

				fInitialMotd = false;
			}
			return true;

		case RPL_USERSSTART:			 // 392
			{
				// empty for now
		}
			return true;

		case RPL_USERS:						// 393
			{
				// empty for now
			}
			return true;

		case ERR_ERRONEOUSNICKNAME:		// 432
		case ERR_NICKNAMEINUSE:				// 433
		case ERR_RESOURCEUNAVAILABLE:	// 437
			{
				BString theNick (GetWord (data, 4));

				if (fIsConnecting)
				{
					BString nextNick (GetNextNick());
					if (nextNick != "")
					{
						BString tempString = "* ";
						tempString += B_TRANSLATE("Nickname \"%1\" in use or unavailable, trying \"%2\"");
						tempString.ReplaceFirst("%1", theNick.String());
						tempString.ReplaceFirst("%2", nextNick.String());
						tempString += "\n";
						Display (tempString.String());

						tempString = "NICK ";
						tempString += nextNick;
						SendData (tempString.String());
						return true;
					}
					else
					{
						BString tempString = "* ";
						tempString += B_TRANSLATE("All your pre-selected nicknames are in use.");
						tempString += "\n";
						Display (tempString.String());
						tempString = "* ";
						tempString += B_TRANSLATE("Please type /NICK <NEWNICK> to try another.");
						tempString += "\n";
						Display (tempString.String());
						return true;
					}
				}
				BString tempString = "[x] ";
				tempString += B_TRANSLATE("Nickname/Channel \"%1\" is already in use or unavailable.");
				tempString.ReplaceFirst("%1", theNick);
				tempString += "\n";

				BMessage display (M_DISPLAY);
				PackDisplay (&display, tempString.String(), C_NICK);
				PostActive (&display);
			}
			return true;

		case ERR_USERNOTINCHANNEL:		// 441
			{
				BString theChannel (GetWord (data, 5)),
								theNick (GetWord (data, 4)),
								tempString ("[x] ");
				tempString += B_TRANSLATE("%1 not in %2.");
				tempString.ReplaceFirst("%1", theNick);
				tempString.ReplaceFirst("%2", theChannel);
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_ERROR);
				PostActive (&msg);
			}
			return true;

		case ERR_NOTONCHANNEL:			 // 442
			{
				BString theChannel (GetWord (data, 4)),
								tempString ("[x] ");
				tempString += B_TRANSLATE("You're not in %1.");
				tempString.ReplaceFirst("%1", theChannel);
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_ERROR);
				PostActive (&msg);
			}
			return true;

		case ERR_USERONCHANNEL:		 // 443
			{
				BString theChannel (GetWord (data, 5)),
								theNick (GetWord (data, 4)),
				tempString ("[x] ");
				tempString += B_TRANSLATE("%1 is already in %2.");
				tempString.ReplaceFirst("%1", theNick);
				tempString.ReplaceFirst("%2", theChannel);
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_ERROR);
				PostActive (&msg);
			}
			return true;

		case ERR_KEYSET:						// 467
			{
				BString theChannel (GetWord (data, 4)),
								tempString ("[x] ");
				tempString += B_TRANSLATE("Channel key already set in %1.");
				tempString.ReplaceFirst("%1", theChannel);
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_ERROR);
				PostActive (&msg);
			}
			return true;

		case ERR_UNKNOWNMODE:				// 472
			{
				BString theMode (GetWord (data, 4)),
								tempString ("[x] ");
				tempString += B_TRANSLATE("Unknown channel mode: '%1'.");
				tempString.ReplaceFirst("%1", theMode);
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_QUIT);
				PostActive (&msg);
			}
			return true;

		case ERR_INVITEONLYCHAN:		 // 473
			{
				BString theChan (GetWord (data, 4)),
								tempString ("[x] "),
								theReason (RestOfString (data, 5));
				theReason.RemoveFirst(":");
				theReason.ReplaceLast("channel", theChan.String());
				tempString << theReason < " ";
				tempString += B_TRANSLATE("(invite only)");
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_QUIT, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
				RemoveAutoexecChan (theChan);
			}
			return true;

		case ERR_BANNEDFROMCHAN:		 // 474
			{
				BString theChan (GetWord (data, 4)),
								tempString ("[x] "),
								theReason (RestOfString (data, 5));
				theReason.RemoveFirst(":");
				theReason.ReplaceLast("channel", theChan.String());

				tempString << theReason < " ";
				tempString += B_TRANSLATE("(you're banned)");
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_QUIT, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
				RemoveAutoexecChan (theChan);
			}
			return true;

		case ERR_BADCHANNELKEY:			// 475
			{
				BString theChan (GetWord(data, 4)),
								theReason (RestOfString(data, 5)),
								tempString("[x] ");
				theReason.RemoveFirst(":");
				theReason.ReplaceLast("channel", theChan.String());
				tempString << theReason << " ";
				tempString += B_TRANSLATE("(bad channel key)");
				tempString += "\n";

				BMessage msg (M_DISPLAY);
				PackDisplay (&msg, tempString.String(), C_QUIT, C_BACKGROUND, F_SERVER);
				PostActive (&msg);
				RemoveAutoexecChan (theChan);
			}
			return true;

		case ERR_UMODEUNKNOWNFLAG:		// 501
			{
				BMessage msg (M_DISPLAY);
				BString buffer = "[x] ";

		buffer += B_TRANSLATE("Unknown mode flag.");
				buffer += "\n";
				PackDisplay (&msg, buffer.String(), C_QUIT);
				PostActive (&msg);
			}
			return true;

		// not sure what these numerics are,
		// but they are usually on-connect messages
		case RPL_290:								 // 290
		case RPL_291:								 // 291
		case RPL_292:								 // 292
			{
				BString tempString (RestOfString(data, 4));
				tempString.RemoveFirst (":");
				tempString.Append ("\n");
				tempString.Prepend ("- ");
				Display (tempString.String());
			}
			return true;

		case RPL_WHOISREGISTEREDBOT:	// 617
			{
				// conflicts with RPL_DCCALLOWCHANGE
				BString theNick (GetWord (data, 4)),
								theMessage (RestOfString (data, 5)),
								tempString;
				theNick.RemoveFirst (":");
				theMessage.RemoveFirst (":");
				theMessage.Append ("\n");

				switch (fIrcdtype)
				{
					case IRCD_ULTIMATE:
						{
							tempString += "[@] ";
							tempString += theMessage;
							BMessage msg (M_DISPLAY);
							PackDisplay (&msg, tempString.String(), C_WHOIS, C_BACKGROUND, F_SERVER);
							PostActive (&msg);
						}
						break;

					default:
						{
							tempString += theNick;
							tempString += " ";
							tempString += theMessage;
							Display (tempString.String());
						}
				}
			}
			return true;

		default:
			break;
	}

	return false;
}
Example #25
0
File: patch.c Project: fielder/NWT
/*
void Print(int x,int y,char h,char v,char string[]);
void ScreenAufbau(void);
void DisplayPatch(void);
void GetPatch(void);
void Choose64(void);
void PatchData(void);
void PatchSuchen();
*/
void Patches(void)
{
  long L,l,n,ll;
/*  int i,k,pepe,k2,k3,Arg; */
  int i,pepe,k2,k3;
  unsigned char Taste;

  Texes=1;
  Print(18,10,5,15," ����������������������������������������Ŀ ");
  Print(18,11,5,15," �      Reading Texture Resources...      � ");
  Print(18,12,5,15," ������������������������������������������ ");

  Print(27,22,0,15,"          ");
  for (i=0;i<PNames;i++) PName[i].UsedInTex=999;

  l=Entry->RStart;
  fseek(f,l,0); _read(fileno(f),&n,4); TEntries=(int)n;
  for (L=0;L<n;L++) {
    i=(int)L;
    _read(fileno(f),&ll,4);
    TEntry[i].TStart=ll+l;
  }
  for (i=0;i<TEntries;i++) {
    fseek(f,TEntry[i].TStart,0);
    _read(fileno(f),&TEntry[i].TName,8); TEntry[i].TName[8]=0;
    _read(fileno(f),Puffer,12); _read(fileno(f),&pepe,2);
    _read(fileno(f),Puffer,4);
    for (k2=0;k2<pepe;k2++) {
      _read(fileno(f),&k3,2); _read(fileno(f),Puffer,8);
      PName[k3].UsedInTex=i;
	 }
  }
  ScreenAufbau(); DisplayPatch();
  for(;;) {
	 Taste=getch();
    if (Taste==27) break;
    if (Taste==73) { TPos-=21; if (TPos<0) { TPos=0; TCPos=2; } DisplayPatch(); Taste=0; }
	 if (Taste==81) { TPos+=21; if (TPos>n-22) { TPos=(int)n-22; TCPos=23; } DisplayPatch(); Taste=0; }
    if (Taste==72 && TCPos==2 && TPos>0) { TPos--; DisplayPatch(); Taste=0; }
	 if (Taste==80 && TCPos==23) { TPos++; if (TPos>n-22) TPos=(int)n-22; DisplayPatch(); Taste=0; }
    if (Taste==72 && TCPos==2 && TPos==0) Taste=0;
    if (Taste==80) { TCPos++; DisplayPatch(); Taste=0; }
    if (Taste==72) { TCPos--; DisplayPatch(); Taste=0; }
	 if (Taste==79) { TPos=(int)n-22; TCPos=23; DisplayPatch(); }
    if (Taste==71) { TPos=0; TCPos=2; DisplayPatch(); }
	 if (Taste==13) GetPatch();
	 if (Taste==60) Choose64();
	 if (Taste==59) PatchData();
    if ( ((Taste>94 && Taste<123) || (Taste>32 && Taste<58)) && SPos<8) {
      SuchStr[SPos]=Taste; SuchStr[SPos+1]=0;
		Print(27,22,0,15,"           "); Print(27,22,0,15,SuchStr);
		SPos++; if (SPos>0) PatchSuchen();
    }
	 if (Taste==8 && SPos>0) {
      SPos--; SuchStr[SPos]=0;
      Print(27,22,0,15,"           "); Print(27,22,0,15,SuchStr);
      if (SPos>0) PatchSuchen();
    }
  }
  SuchStr[0]=0; SPos=0;
  Texes=0; ScreenAufbau(); Display();
}
Example #26
0
		void pagebase::display()
		{
			Display();
			set_help_keys();
		}
Example #27
0
void Snapshot
( const Matrix<Int>& preimage,
  const Matrix<Real>& estimates,
  const Matrix<Int>& itCounts,
        Int numIts,
        bool deflate,
        SnapshotCtrl& snapCtrl )
{
    EL_DEBUG_CSE
    auto logMap = []( const Real& alpha ) { return Log(alpha); };
    if( snapCtrl.realSize != 0 && snapCtrl.imagSize != 0 )
    {
        const bool numSave =
            ( snapCtrl.numSaveFreq > 0 &&
              snapCtrl.numSaveCount >= snapCtrl.numSaveFreq );
        const bool imgSave =
            ( snapCtrl.imgSaveFreq > 0 &&
              snapCtrl.imgSaveCount >= snapCtrl.imgSaveFreq );
        const bool imgDisp =
            ( snapCtrl.imgDispFreq > 0 &&
              snapCtrl.imgDispCount >= snapCtrl.imgDispFreq );
        Matrix<Real> invNorms, estMap;
        Matrix<Int> itCountsReord, itCountMap;
        if( numSave || imgSave || imgDisp )
        {
            invNorms = estimates;
            if( deflate )
                RestoreOrdering( preimage, invNorms );
            ReshapeIntoGrid
            ( snapCtrl.realSize, snapCtrl.imagSize, invNorms, estMap );
            if( snapCtrl.itCounts )
            {
                itCountsReord = itCounts;
                if( deflate )
                    RestoreOrdering( preimage, itCountsReord );
                ReshapeIntoGrid
                ( snapCtrl.realSize, snapCtrl.imagSize, itCountsReord,
                  itCountMap );
            }
        }
        if( numSave )
        {
            auto title = BuildString( snapCtrl.numBase, "_", numIts );
            Write( estMap, title, snapCtrl.numFormat );
            if( snapCtrl.itCounts )
                Write( itCountMap, title+"_counts", snapCtrl.numFormat );
            snapCtrl.numSaveCount = 0;
        }
        if( imgSave || imgDisp )
            EntrywiseMap( estMap, MakeFunction(logMap) );
        if( imgSave )
        {
            auto title = BuildString( snapCtrl.imgBase, "_", numIts );
            Write( estMap, title, snapCtrl.imgFormat );
            if( snapCtrl.itCounts )
                Write( itCountMap, title+"_counts", snapCtrl.imgFormat );
            auto colorMap = GetColorMap();
            SetColorMap( GRAYSCALE_DISCRETE );
            Write( estMap, title+"_discrete", snapCtrl.imgFormat );
            SetColorMap( colorMap );
            snapCtrl.imgSaveCount = 0;
        }
        if( imgDisp )
        {
            auto title = BuildString( snapCtrl.imgBase, "_", numIts );
            Display( estMap, title );
            if( snapCtrl.itCounts )
                Display( itCountMap, title+"_counts" );
            auto colorMap = GetColorMap();
            SetColorMap( GRAYSCALE_DISCRETE );
            Display( estMap, title+"_discrete" );
            SetColorMap( colorMap );
            snapCtrl.imgDispCount = 0;
        }
    }
}
Example #28
0
inline void
Snapshot
( const Matrix<Int>& preimage, const Matrix<Real>& estimates, 
  const Matrix<Int>& itCounts,
  Int numIts, bool deflate, SnapshotCtrl& snapCtrl )
{
    DEBUG_ONLY(CallStackEntry cse("pspec::Snapshot"));
    if( snapCtrl.realSize != 0 && snapCtrl.imagSize != 0 )
    {
        const bool numSave = 
            ( snapCtrl.numSaveFreq > 0 && 
              snapCtrl.numSaveCount >= snapCtrl.numSaveFreq );
        const bool imgSave = 
            ( snapCtrl.imgSaveFreq > 0 && 
              snapCtrl.imgSaveCount >= snapCtrl.imgSaveFreq );
        const bool imgDisp = 
            ( snapCtrl.imgDispFreq > 0 &&
              snapCtrl.imgDispCount >= snapCtrl.imgDispFreq );
        Matrix<Real> invNorms, estMap;
        Matrix<Int> itCountsReord, itCountMap;
        if( numSave || imgSave || imgDisp )
        {
            invNorms = estimates;
            if( deflate )
                RestoreOrdering( preimage, invNorms );
            ReshapeIntoGrid
            ( snapCtrl.realSize, snapCtrl.imagSize, invNorms, estMap );
            if( snapCtrl.itCounts )
            {
                itCountsReord = itCounts;
                if( deflate )
                    RestoreOrdering( preimage, itCountsReord );
                ReshapeIntoGrid
                ( snapCtrl.realSize, snapCtrl.imagSize, itCountsReord, 
                  itCountMap );
            }
        }
        if( numSave )
        {
            std::ostringstream os;
            os << snapCtrl.numBase << "-" << numIts;
            Write( estMap, os.str(), snapCtrl.numFormat );
            if( snapCtrl.itCounts )
                Write( itCountMap, os.str()+"-counts", snapCtrl.numFormat );
            snapCtrl.numSaveCount = 0;
        }
        if( imgSave || imgDisp )
            EntrywiseMap( estMap, []( Real alpha ) { return Log(alpha); } );
        if( imgSave )
        {
            std::ostringstream os;
            os << snapCtrl.imgBase << "-" << numIts;
            Write( estMap, os.str(), snapCtrl.imgFormat );
            if( snapCtrl.itCounts )
                Write( itCountMap, os.str()+"-counts", snapCtrl.imgFormat );
            auto colorMap = GetColorMap();
            SetColorMap( GRAYSCALE_DISCRETE );
            Write( estMap, os.str()+"-discrete", snapCtrl.imgFormat );
            SetColorMap( colorMap );
            snapCtrl.imgSaveCount = 0;
        }
        if( imgDisp )
        {
            std::ostringstream os;
            os << snapCtrl.imgBase << "-" << numIts;
            Display( estMap, os.str() );       
            if( snapCtrl.itCounts )
                Display( itCountMap, os.str()+"-counts" );
            auto colorMap = GetColorMap();
            SetColorMap( GRAYSCALE_DISCRETE );
            Display( estMap, os.str()+"-discrete" );
            SetColorMap( colorMap );
            snapCtrl.imgDispCount = 0;
        }
    }
}
Example #29
0
	void SetDirs(int32 dirs)
	{
		totalDirs_ = dirs;
		Display();
	}
Example #30
0
cBook::cBook(const cBook & copy)
	: m_title(copy.m_title), m_id(copy.m_id), m_checkedIn(copy.m_checkedIn)
{
	cout << "Book Copy CTOR: ";
	Display();
}