コード例 #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
ファイル: nmm.c プロジェクト: ryanakca/nmm
/*
 * Completely redraw *everything*
 */
void
full_redraw(scrgame *sg)
{
  static char *name = NULL;
  static size_t vers_len;
  static const char *helpstr = "? : help";
  static const size_t helplen = 8;
  if (!name) {
    name = getgname(sg->game);
  }
  /* 10 = strlen(" version ") */
  vers_len = strlen(name) + strlen(VERSION) + 10;
  delwin(sg->board_w);
  delwin(sg->score_w);
  delwin(sg->msg_w);
  clear();
  /* We want the ends of the version string and of
   * helpstr to line up. */
  mvprintw(versrow, helpcol + helplen - vers_len,
	   "%s version %s", name, VERSION);
  mvprintw(helprow, helpcol, helpstr);
  refresh();
  sg->board_w = create_board(sg->game);
  sg->score_w = create_scorebox(sg->game);
  sg->msg_w = create_msgbox();
}
コード例 #3
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 ();

	}

}
コード例 #4
0
void ConsoleScreenInterface::RunCommand_SHUTDOWN ()
{

	Computer *comp = GetComputerScreen ()->GetComputer ();
	UplinkAssert (comp);

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

	if ( deleted_sys ) {

		if ( comp->GetOBJECTID () != OID_LANCOMPUTER )
			GetComputerScreen ()->GetComputer ()->SetIsRunning ( false );

		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_DISCONNECT, NULL, 3000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "System failure - disconnecting remote users...", 2000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "[Failed]", 5000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Loading Kernel...", 4000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Rebooting...", 2000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "System shut down complete.", 500 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Shutting down system...", 500 ) );

	}
	else {

		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Reboot completed.", 2000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Running Console Services...", 2000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Starting User Services...", 2000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Loading Operating System...", 2000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Loading Kernel...", 4000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Rebooting...", 2000 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "System shut down complete.", 500 ) );
		queue.PutDataAtStart ( new ConsoleCommand ( CMDTYPE_TEXT, "Shutting down system...", 500 ) );

	}

}
コード例 #5
0
void HUDInterface::PauseButtonClick  ( Button *button )
{

    game->SetGameSpeed ( GAMESPEED_PAUSED );

    //
    // Create a message 
    // And tie the close button to Play

    create_msgbox ( "Message", "Uplink is paused\nClick Close to continue" );
    EclRegisterButtonCallback ( "msgbox_close", UnPauseClick );
    EclRegisterButtonCallback ( "msgbox_title", UnPauseClick );

    EclDirtyButton ( "hud_speed 0" );
	EclDirtyButton ( "hud_speed 1" );
	EclDirtyButton ( "hud_speed 2" );
	EclDirtyButton ( "hud_speed 3" );

#ifdef CHEATMODES_ENABLED
	EclDirtyButton ( "hud_speed 4" );
#endif
    
}
コード例 #6
0
ファイル: ipmodule.c プロジェクト: HITliuyu/NES15_HEVC
void *dl_ip_thread(
    void *pArgs)
{
    MSGBOX_ID msgboxid;
    BACMSG msg_storage, *bacmsg = NULL;
    MSG_DATA *msg_data;
    ROUTER_PORT *port = (ROUTER_PORT *) pArgs;
    IP_DATA ip_data;    /* port specific parameters */
    BACNET_ADDRESS address = { 0 };
    int status;
    uint8_t shutdown = 0;

    /* initialize router port */
    if (!dl_ip_init(port, &ip_data)) {
        port->state = INIT_FAILED;
        return NULL;
    }

    /* allocate buffer */
    ip_data.max_buff = MAX_BIP_MPDU;
    ip_data.buff = (uint8_t *) malloc(ip_data.max_buff);

    if (ip_data.buff == NULL) {
        port->state = INIT_FAILED;
        return NULL;
    }

    msgboxid = create_msgbox();
    if (msgboxid == INVALID_MSGBOX_ID) {
        PRINT(ERROR, "Error: Failed to create message box");
        port->state = INIT_FAILED;
        return NULL;
    }

    port->port_id = msgboxid;
    port->state = RUNNING;

    while (!shutdown) {

        /* check for incoming messages */
        bacmsg = recv_from_msgbox(port->port_id, &msg_storage);

        if (bacmsg) {
            switch (bacmsg->type) {
                case DATA:{
                        msg_data = (MSG_DATA *) bacmsg->data;
                        memmove(&address.net, &msg_data->dest.net, 2);
                        memmove(&address.mac_len, &msg_data->dest.len, 1);
                        memmove(&address.mac[0], &msg_data->dest.adr[0],
                            MAX_MAC_LEN);

                        dl_ip_send(&ip_data, &address, msg_data->pdu,
                            msg_data->pdu_len);

                        check_data(msg_data);

                        break;
                    }

                case SERVICE:{
                        switch (bacmsg->subtype) {
                            case SHUTDOWN:
                                del_msgbox(port->port_id);
                                shutdown = 1;
                                break;
                            default:
                                break;
                        }
                        break;
                    }

                default:
                    break;
            }
        } else {
            status = dl_ip_recv(&ip_data, &msg_data, &address, 1000);
            if (status > 0) {
                memmove(&msg_data->src.len, &address.mac_len, 1);
                memmove(&msg_data->src.adr[0], &address.mac[0], MAX_MAC_LEN);
                msg_storage.origin = port->port_id;
                msg_storage.type = DATA;
                msg_storage.data = msg_data;

                if (!send_to_msgbox(port->main_id, &msg_storage)) {
                    free_data(msg_data);
                }
            }
        }
    }

    /* cleanup procedure */
    dl_ip_cleanup(&ip_data);
    port->state = FINISHED;
    return NULL;
}
コード例 #7
0
void CriminalScreenInterface::ArrestClick ( 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);

		char *name = rec->GetField ( RECORDBANK_NAME );
		UplinkAssert (name);

		char *convictions = rec->GetField ( "Convictions" );
		//UplinkAssert (convictions);

		// Only do this if the person now has at least 3 convicions
		// AND has broken parole

		int numconvictions = 0;
		bool brokenparole = false;

		if ( convictions ) {

			char *current = strchr ( convictions, '\n' );

			while ( current ) {
				++numconvictions;
				current = strchr ( current+1, '\n' );
			}

			brokenparole = strstr ( convictions, "parole" ) || strstr ( convictions, "Parole" );
		}

		if ( numconvictions >= 2 && brokenparole ) {

			// This person is going down

			Date rundate;
			rundate.SetDate ( &(game->GetWorld ()->date) );
			rundate.AdvanceMinute ( TIME_LEGALACTION );

			ArrestEvent *ae = new ArrestEvent ();
			ae->SetName ( name );
			ae->SetReason ( "breaking parole after 2 previous convictions" );
			ae->SetRunDate ( &rundate );
			game->GetWorld ()->scheduler.ScheduleEvent ( ae );

			rundate.AdvanceMinute ( TIME_LEGALACTION_WARNING * -1 );
			game->GetWorld ()->scheduler.ScheduleWarning ( ae, &rundate );

			char message [128];
			UplinkSnprintf ( message, sizeof ( message ), "Authorisation Accepted\nThis man will be arrested in %d hours.", TIME_LEGALACTION / 60 );

			create_msgbox ( "Arrest Authorised", message );

		}
		else {

			create_msgbox ( "Arrest Not Authorised", "Authorisation rejected\nA suspect must have 2 prior convictions "
													 "and must have broken parole before an arrest can be authorised remotely." );

		}

	}

}