コード例 #1
0
void CriminalScreenInterface::ClearClick ( Button *button )
{

	CriminalScreenInterface *csi = (CriminalScreenInterface *) GetInterfaceScreen ( SCREEN_CRIMINALSCREEN );
	UplinkAssert (csi);

	if ( csi->recordindex != -1 ) {

		Computer *comp = game->GetWorld ()->GetComputer ( "Global Criminal Database" );
		UplinkAssert (comp);

		if ( comp->security.IsRunning_Proxy () ) {
			create_msgbox ( "Error", "Denied access by Proxy Server" );
			return;
		}

		Record *rec = comp->recordbank.GetRecord ( csi->recordindex );
		UplinkAssert (rec);
		rec->ChangeField ( "Convictions", "None" );

		csi->UpdateScreen ();

	}

}
コード例 #2
0
void CriminalScreenInterface::AddConvictionClick ( Button *button )
{

	CriminalScreenInterface *csi = (CriminalScreenInterface *) GetInterfaceScreen ( SCREEN_CRIMINALSCREEN );
	UplinkAssert (csi);

	if ( csi->recordindex != -1 ) {

		char *newconviction = EclGetButton ( "criminal_newconvictiontext" )->caption;

		Computer *comp = game->GetWorld ()->GetComputer ( "Global Criminal Database" );
		UplinkAssert (comp);

		if ( comp->security.IsRunning_Proxy () ) {
			create_msgbox ( "Error", "Denied access by Proxy Server" );
			return;
		}

		Record *rec = comp->recordbank.GetRecord ( csi->recordindex );
		UplinkAssert (rec);

		char *existing = rec->GetField ( "Convictions" );
		//UplinkAssert (existing);
		
		if ( existing ) {

			std::ostrstream newconvictions;

			if ( strstr ( existing, "None" ) == NULL )
				newconvictions << existing << "\n";

			newconvictions << newconviction
						   << '\x0';

			rec->ChangeField ( "Convictions", newconvictions.str () );

			newconvictions.rdbuf()->freeze( 0 );
			//delete [] newconvictions.str ();

		}

		EclGetButton ( "criminal_newconvictiontext" )->SetCaption ( "" );

		csi->UpdateScreen ();

	}

}
コード例 #3
0
ファイル: computer.cpp プロジェクト: gene9/uplink-source-code
bool Computer::ChangeSecurityCodes ()
{

	// Change our admin password

	bool changed = false;

    switch ( TYPE ) {

		case COMPUTER_TYPE_INTERNALSERVICESMACHINE :		
		{
			Record *admin = recordbank.GetRecordFromName ( RECORDBANK_ADMIN );
			UplinkAssert (admin);
			admin->ChangeField ( RECORDBANK_PASSWORD, NameGenerator::GenerateComplexPassword () );		
            changed = true;
			break;
		}
		
        case COMPUTER_TYPE_CENTRALMAINFRAME :
        {
			Record *admin = recordbank.GetRecordFromName ( RECORDBANK_ADMIN );
			UplinkAssert (admin);
			admin->ChangeField ( RECORDBANK_PASSWORD, NameGenerator::GenerateComplexPassword () );		
            changed = true;
			break;
        }

        case COMPUTER_TYPE_UNKNOWN :
        {

            if ( strcmp ( ip, IP_SOCIALSECURITYDATABASE ) == 0 ||
                 strcmp ( ip, IP_GLOBALCRIMINALDATABASE ) == 0 ||
                 strcmp ( ip, IP_ACADEMICDATABASE ) == 0 ) {

			    Record *admin = recordbank.GetRecordFromName ( RECORDBANK_ADMIN );
			    UplinkAssert (admin);
			    admin->ChangeField ( RECORDBANK_PASSWORD, NameGenerator::GenerateComplexPassword () );		
                
			    Record *readwrite = recordbank.GetRecordFromName ( RECORDBANK_READWRITE );
			    UplinkAssert (readwrite);
			    readwrite->ChangeField ( RECORDBANK_PASSWORD, NameGenerator::GenerateComplexPassword () );		

  			    Record *readonly = recordbank.GetRecordFromName ( RECORDBANK_READONLY );
			    UplinkAssert (readonly);
			    readonly->ChangeField ( RECORDBANK_PASSWORD, NameGenerator::GenerateComplexPassword () );		

                changed = true;

            }

        }

	}

	// Re-enable all our security

	for ( int i = 0; i < security.NumSystems (); ++i ) 
		if ( security.GetSystem (i) ) 
			security.GetSystem (i)->Enable ();

    return changed;

}