コード例 #1
0
void menu_inserisci_strade(rotonda rot) {
    CLEARSCR;
    printf("\n[8] Inserisci Strade\n\n");
    int strade, brum;
    if (rot == NULL) {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
        return;
    }
    stampa_rotonda(rot);
    printf("\nNumero strade da inserire: ");
    scanf("%d",&strade);
    press_enter();
    strade = strade%(DIM - get_numero_strade(rot));
    int i;
    for(i=0; i < strade; i++) {
        CLEARSCR;
        printf("\n[8] Inserisci Strade\n\n");
        stampa_rotonda(rot);
        printf("\nPosizione: ");
        scanf("%d",&brum);
        press_enter();
        if(!inserisci_strada(rot, brum)) {
            printf("C'e' gia' una strada li'");
            press_enter();
            i--;
        }
    }
    CLEARSCR;
    printf("\n[8] Inserisci Strade\n\n");
    stampa_rotonda(rot);
    printf("\nFatto");
    press_enter();
}
コード例 #2
0
void menu_cancella_auto(rotonda rot) {
    clear_screen();
    printf("\n[14] Cancella Auto\n");
    if(rot==NULL) {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
        return;
    }
    stampa_rotonda(rot);
    int ID;
    printf("\nID auto da cancellare: ");
    scanf("%d",&ID);
    press_enter();
    if(cancella_auto_rotonda(rot,ID-1))
    {
        clear_screen();
        printf("\n[14] Cancella Auto\n");
        stampa_rotonda(rot);
        printf("\nAuto cancellata!");
        press_enter();
        clear_screen();
    }
    else
    {
        printf("\nAuto non cancellata");
        press_enter();
    }

}
コード例 #3
0
void menu_stampa_rotonda(rotonda rot) {
    CLEARSCR;
    printf("\n[3] Stampa Rotonda\n\n");
    if (rot != NULL) {
        stampa_rotonda(rot);
        press_enter();
    }
    else {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
    }
}
コード例 #4
0
ファイル: get_key.c プロジェクト: adevbungert/42-Projects
int				get_key(t_env *env_list, t_cmd_path *cmds,
		t_hist *history, char *key)
{
	t_hist		*tmp;
	int			i;

	i = 0;
	while (read(0, key, 15))
	{
		if (is_arrow(key))
			i = press_arrow(key[2], history, &tmp, i);
		else if (is_enter(key))
		{
			history = press_enter(env_list, history);
			tmp = history->next;
			i = 0;
		}
		else if (is_delete(key))
			press_delete();
		else if (key[0] > 30)
			print_letter(key);
		else if (key[0] == 9 && key[1] == 0 && key[2] == 0)
			autocomplete(cmds);
		else
			is_special_action(key);
		ft_bzero(key, 15);
	}
	return (0);
}
コード例 #5
0
ファイル: change.c プロジェクト: maccasoft/lora2
void ansi_change()
{
        if(rate < speed_graphics)
		return;
        if(usr.ansi)
                change_attr(LGREY|_BLACK);

        usr.ansi^=1;

        if(!usr.ansi) {
                usr.use_lore = 1;
                usr.color = 0;
	}
        else {
                usr.avatar = 0;
                usr.color = 1;
        }

        if (function_active == 1)
                f1_status();

        if (usr.ansi)
                m_print(bbstxt[B_ANSI_USED]);
        else {
                m_print(bbstxt[B_ANSI_NOT_USED]);
                if (usr.use_lore)
                        m_print(bbstxt[B_FULL_NOT_USED2]);
        }
        m_print(bbstxt[B_TWO_CR]);
        press_enter ();
}
コード例 #6
0
ファイル: change.c プロジェクト: maccasoft/lora2
void avatar_change()
{
        if(usr.avatar)                  
                change_attr(LGREY|_BLACK);
        usr.avatar^=1;

        if(!usr.avatar) {
                usr.use_lore = 1;
                usr.color = 0;
	}                           
        else {
                usr.ansi = 0;
                usr.color = 1;
        }

        if (function_active == 1)
                f1_status();

        if (usr.avatar)
                m_print(bbstxt[B_AVATAR_USED]);
        else {
                m_print(bbstxt[B_AVATAR_NOT_USED]);
                if (usr.use_lore)
                        m_print(bbstxt[B_FULL_NOT_USED2]);
        }
        m_print(bbstxt[B_TWO_CR]);
        press_enter ();
}
コード例 #7
0
// Calls report and captures user input for options selection.
int report_main_menu()
{
	int selection = 0;
	int error = NO_ERROR;

	// Exits when the user enters 2.
	while (selection != EXIT_REPORT)
	{
		clear_screen();
		selection = report_menu();
		switch (selection)
		{
		case REPORT_DISPLAY:
		{
			error = report_data();
			if (error)
				printf("File error: Check name\n");
			press_enter();
			break;
		}
		}
	}
	clear_screen();
	return error;
}
コード例 #8
0
rotonda menu_nuova_rotonda_vuota(rotonda rot) {
    CLEARSCR;
    printf("\n[1] Nuova Rotonda Vuota\n\n");
    if (rot != NULL) cancella_rotonda(rot);
    rot = nuova_rotonda();
    printf("La rotonda e' stata creata\n");
    press_enter();
    return rot;
}
コード例 #9
0
rotonda menu_carica_rotonda(rotonda rot) {
    char nomeF[DIM];
    rotonda tmp;
    CLEARSCR;
    printf("\n[6] Carica Rotonda (da file)\n\n");
    printf("\nInserisci il nome del file: ");
    scanf("%s", nomeF);
    press_enter();
    tmp = fleggi_rotatoria(nomeF);
    if (!tmp) {
        CLEARSCR;
        printf("\n[6] Carica Rotonda (da file)\n\n");
        printf("\nFile non trovato\n");
        press_enter();
        return rot;
    }
    if (rot != NULL) cancella_rotonda(rot);
    return tmp;
}
コード例 #10
0
ファイル: change.c プロジェクト: maccasoft/lora2
void fullread_change()
{
        usr.full_read^=1;

        if (usr.full_read)
                m_print(bbstxt[B_FULLREAD_USED]);
        else
                m_print(bbstxt[B_FULLREAD_NOT_USED]);
        press_enter ();
}
コード例 #11
0
void menu_simula_10_step(rotonda rot) {
    CLEARSCR;
    printf("\n[4] Simula 10 step\n\n");
    if (rot != NULL) {
        int i;
        for(i=0; i<10; i++) {
            CLEARSCR;
            printf("\n[4] Simula 10 step\n\n");
            printf("Numero Step: %d\n", i+1);
            stampa_rotonda(rot);
            step_rotonda(rot, 2);
        }
        press_enter();
    }
    else {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
    }
}
コード例 #12
0
void menu_inserisci_strade_random(rotonda rot) {
    CLEARSCR;
    printf("\n[8] Inserisci Strade\n\n");
    int strade;
    if (rot == NULL) {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
        return;
    }
    stampa_rotonda(rot);
    printf("\nNumero strade da inserire: ");
    scanf("%d",&strade);
    press_enter();
    strade = strade%(DIM - get_numero_strade(rot));
    while(strade) if (inserisci_strada(rot, rand()%DIM)) strade--;
    CLEARSCR;
    printf("\n[8] Inserisci Strade\n\n");
    stampa_rotonda(rot);
    printf("\nFatto");
    press_enter();
}
コード例 #13
0
ファイル: servo_cal.c プロジェクト: CNCBASHER/Firmware
/****************************************************************************
 * Public Functions
 ****************************************************************************/
int servo_cal(int argc, char *argv[])
{
	//	pthread_attr_t servo_loop_attr;
	//	pthread_attr_init(&servo_loop_attr);
	//	pthread_attr_setstacksize(&servo_loop_attr, 1024);
	pthread_create(&servo_calib_thread, NULL, servo_loop, NULL);
	pthread_join(servo_calib_thread, NULL);

	printf("The servo calibration routine assumes you already did the channel\n");
	printf("assignment with 'calibration channels'\n");
	printf("This routine chooses the minimum, maximum and middle\n");
	printf("value for each channel separately. The ROLL, PITCH and YAW function\n");
	printf("get their middle value from the RC direct, for the rest it is\n");
	printf("calculated out of the min and max values.\n");
	press_enter();

	printf("Hold both sticks in lower left corner and continue\n ");
	press_enter();
	usleep(500000);

	while (get_value_s());

	printf("Hold both sticks in upper right corner and continue\n");
	press_enter();
	usleep(500000);

	while (get_value_s());

	printf("Set the trim to 0 and leave the sticks in the neutral position\n");
	press_enter();

	//Loop until successfull
	while (set_mid_s());

	//write the values to global_data_rc_channels
	write_data_s();

	return 0;

}
コード例 #14
0
void menu_modifica_auto(rotonda rot) {
    CLEARSCR;
    printf("\n[13] Modifica Auto\n\n");
    if (rot == NULL) {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
        return;
    }
    stampa_rotonda(rot);
    /*------------------------------------------*/
    int id, dest;
    printf("\nAuto Numero: ");
    scanf("%d",&id);
    press_enter();
    automobile car = cerca_auto(rot, id-1);
    if(car) {
        printf("\nNuovo Numero Auto (ID): ");
        scanf("%d",&id);
        press_enter();
        printf("\nNuova Destinazione Auto (Numero uscita): ");
        scanf("%d",&dest);
        press_enter();
        set_id_auto(car, id-1);
        set_dest_auto(car,dest-1);
        CLEARSCR;
        printf("\n[13] Modifica Auto\n\n");
        stampa_rotonda(rot);
        printf("\nFatto!\n");
        press_enter();
    }
    else {
        printf("\nAuto non trovata\n");
        press_enter();
    }
}
コード例 #15
0
void menu_inserisci_auto_random(rotonda rot) {
    CLEARSCR;
    printf("\n[12] Inserisci Auto Random\n\n");
    if (rot == NULL) {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
        return;
    }
    stampa_rotonda(rot);
    /*------------------------------------------*/
    int num;
    printf("\nNumero auto da inserire: ");
    scanf("%d",&num);
    press_enter();
    int ok = accoda_auto_rotonda_random(rot, num);
    CLEARSCR;
    printf("\n[10] Cancella Strada\n\n");
    stampa_rotonda(rot);
    if (!ok) printf("\nNessuna strada non trovata\n");
    else printf("\nFatto!\n");
    press_enter();
}
コード例 #16
0
void menu_salva_rotonda(rotonda rot) {
    char nomeF[DIM];
    CLEARSCR;
    printf("\n[7]Salva Rotonda su file\n\n");
    if (rot == NULL) {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
        return;
    }
    printf("\nInserisci il nome del file: ");
    scanf("%s",nomeF);
    fout_rotatoria(rot,nomeF);
}
コード例 #17
0
ファイル: change.c プロジェクト: maccasoft/lora2
void fullscreen_change (void)
{
   if (!usr.ansi && !usr.avatar)
      return;

   usr.use_lore ^= 1;

   if (usr.use_lore)
      m_print (bbstxt[B_FULL_NOT_USED]);
   else
      m_print (bbstxt[B_FULL_USED]);

   press_enter ();
}
コード例 #18
0
void menu_cancella_strada(rotonda rot) {
    CLEARSCR;
    printf("\n[10] Cancella Strada\n\n");
    if (rot == NULL) {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
        return;
    }
    stampa_rotonda(rot);
    char brum;
    int ok;
    printf("\nLettera Strada (Maiuscolo): ");
    scanf("%c",&brum);
    press_enter();
    ok = cancella_strada_rotonda(rot, brum);
    CLEARSCR;
    printf("\n[10] Cancella Strada\n\n");
    stampa_rotonda(rot);
    if (!ok) printf("\nStrada non trovata\n");
    else printf("\nFatto!\n");
    press_enter();

}
コード例 #19
0
void menu_inserisci_auto(rotonda rot) {
    CLEARSCR;
    printf("\n[11] Inserisci Auto\n\n");
    if (rot == NULL || !get_numero_strade(rot)) {
        printf("Devi prima una Rotonda con delle strade\n");
        press_enter();
        return;
    }
    stampa_rotonda(rot);
    char lett;
    int i, num, id, dest;

    printf("\nNumero auto da inserire: ");
    scanf("%d",&num);
    press_enter();
    for(i=0; i<num; i++) {
        CLEARSCR;
        printf("\n[11] Inserisci Auto\n\n");
        stampa_rotonda(rot);
        id = rotonda_nextval(rot);
        printf("\nDestinazione Auto Numero %d: ", id+1);
        scanf("%d",&dest);
        press_enter();
        automobile car = nuova_auto(dest-1, id);
        do {
            printf("\nLettera Strada (Maiuscolo): ");
            scanf("%c",&lett);
            press_enter();
        } while (!inserisci_auto_strada(rot,car, lett));
    }
    CLEARSCR;
    printf("\n[11] Inserisci Auto\n\n");
    stampa_rotonda(rot);
    printf("\nFatto!\n");
    press_enter();
}
コード例 #20
0
ファイル: change.c プロジェクト: maccasoft/lora2
void color_change()
{
        if(rate < speed_graphics || (!usr.ansi && !usr.avatar))
        return;
        if(usr.color)
                change_attr(LGREY|_BLACK);
        usr.color^=1;
        if (function_active == 1)
                f1_status();

        if (usr.color)
                m_print(bbstxt[B_COLOR_USED]);
        else
                m_print(bbstxt[B_COLOR_NOT_USED]);
        press_enter ();
}
コード例 #21
0
void menu_simula_N_step(rotonda rot) {
    CLEARSCR;
    printf("\n[5] Simula N step\n\n");
    int step, secondi, i;
    if (rot != NULL) {
        printf("Numero step (0 = svuotamento): ");
        scanf("%d",&step);
        press_enter();
        printf("Secondi per step (0 = manuale): ");
        scanf("%d",&secondi);
        press_enter();
        for(i=0; i<step; i++) {
            CLEARSCR;
            printf("\n[5] Simula N step\n\n");
            printf("Numero Step: %d\n", i+1);
            stampa_rotonda(rot);
            step_rotonda(rot, secondi);
            if (!secondi) press_enter();
        }
        if (!step) {
            i=0;
            while(!rotonda_vuota(rot)) {
                CLEARSCR;
                printf("\n[5] Simula N step\n\n");
                printf("Numero Step: %d\n", i+1);
                stampa_rotonda(rot);
                step_rotonda(rot, secondi);
                if (!secondi) press_enter();
                i++;
            }
        }
        CLEARSCR;
        printf("\n[5] Simula N step\n\n");
        printf("Finito!\n");
        stampa_rotonda(rot);
        press_enter();
    }
    else {
        printf("Devi prima averla una Rotonda\n");
        press_enter();
    }
}
コード例 #22
0
ファイル: readmail.c プロジェクト: maccasoft/lora2
int scan_mailbox()
{
   int i, z, *area_msg, *area_num, maxareas, line;
   char filename[80];
   struct _sys tsys;

   sprintf (filename, SYSMSG_PATH, config->sys_path);
   if ((i = sh_open (filename, SH_DENYNONE, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE)) == -1)
      return (0);

   z = (int)(filelength (i) / SIZEOF_MSGAREA);

   if ((area_msg = (int *)malloc (z * sizeof (int))) == NULL)
      return (0);

   if ((area_num = (int *)malloc (z * sizeof (int))) == NULL) {
      free (area_msg);
      return (0);
   }

   z = 0;
   while (read (i, &tsys, SIZEOF_MSGAREA) == SIZEOF_MSGAREA)
      area_num[z++] = tsys.msg_num;
   maxareas = z;

   close (i);

   memset (area_msg, 0, sizeof (int) * z);
   z = 1;

   if (msg_list != NULL)
      free (msg_list);

   if ((msg_list = (struct _msg_list *)malloc (MAX_PRIV_MAIL * sizeof (struct _msg_list))) == NULL)
      return (0);

   m_print (bbstxt[B_CHECK_MAIL]);

   rotatepos = 0;
   m_print (" \b%c", rotate[rotatepos]);
   rotatepos = (rotatepos + 1) % 4;

   z = fido_index (z, area_msg, area_num, maxareas);
   z = quick_index (z, area_msg, area_num, maxareas);
   z = gold_index (z, area_msg, area_num, maxareas);
   z = pipbase_index (z, area_msg, area_num, maxareas);
   z = squish_index (z, area_msg, area_num, maxareas);

   max_priv_mail = z - 1;
   last_mail = 0;
   last_read_system = 0;

   if (z == 1) {
      free (area_num);
      free (area_msg);

      m_print(bbstxt[B_NO_MAIL_TODAY]);
      press_enter();

      return (0);
   }

   num_msg = last_msg = max_priv_mail;
   first_msg = 0;

   m_print(bbstxt[B_THIS_MAIL]);
   m_print(bbstxt[B_THIS_MAIL_UNDERLINE]);
   line = 3;

   for (i = 0; i < maxareas; i++) {
      if (!area_msg[i] || !read_system2 (area_num[i], 1, &tsys))
         continue;

      m_print (bbstxt[B_MAIL_LIST_FORMAT], tsys.msg_name, area_msg[i]);
      if ((line = more_question (line)) == 0)
         break;
   }

   free (area_num);
   free (area_msg);

   m_print (bbstxt[B_READ_MAIL_NOW]);
   i = yesno_question (DEF_YES);

   m_print (bbstxt[B_ONE_CR]);
   return (i);
}
コード例 #23
0
int main(){
    srand(time(NULL));

    int num_city, source, dest, scelta = -1, id=0, i;
    char yes, nomeF[50];
    double tempo=0, costo=0, dist=0;
    mappa map = NULL;
    grafo graph = NULL, voli = NULL, ferrovie = NULL, autostrade = NULL, strade = NULL;
    while(scelta != 0){
        clear_screen();
        printf("\n [1] Genera Mappa Random\n");
        printf("\n [2] Stampa Mappa\n");
        printf("\n [3] Trova percorso ottimo in base al tempo\n");
        printf("\n [4] Trova percorso ottimo in base al costo\n");
        printf("\n [5] Rimuovi Collegamento\n");
        printf("\n [6] Rimuovi citta' dalla mappa\n");
        printf("\n [7] Esporta mappa su file\n");
        printf("\n [8] Importa mappa da file\n");
        printf("\n [9] Aggiungi Collegamento\n");
        printf("\n [10] Aggiungi citta' alla mappa\n");
        printf("\n [11] Stampa Grafo\n");
        printf("\n [0] Esci\n\n");
        printf("Scegli: ");
        scanf("%d",&scelta);
        press_enter();
        switch (scelta) {
            case 1:
                printf("\nInserisci numero di citta' \n");
                scanf("%d",&num_city);
                mappa_cancella(map);
                map = mappa_nuova_hardcode(num_city);
            break;
        case 2:
            if(map){
                mappa_StampaCitta(map);
                printf("\n\n");
            }
            else printf("devi prima avere una mappa!\n");
            press_enter();
            break;
        case 3:
            if(map){
                mappa_StampaCitta(map);
                printf("\n\n");
                lista grafi = lista_grafi();
                voli = grafo_getVoli(map);
                ferrovie = grafo_getFerrovie(map);
                autostrade = grafo_getAutostrade(map);
                strade = grafo_getStrade(map);

                printf("Puoi prendere l'aereo? (s/n): ");
                scanf("%c", &yes);
                press_enter();
                if (yes == 's' || yes == 'S'){
                    printf("Per tutte le citta'?(s/n): ");
                    scanf("%c", &yes);
                    press_enter();
                    if (yes != 's' && yes != 'S'){
                        printf("Quante citta' vuoi ingorare?: ");
                        scanf("%d", &dest);
                        press_enter();
                        if (dest) printf("Inserisci le %d citta: ", dest);
                        for(i=0; i<dest; i++){
                            scanf("%d", &id);
                            if(id >= 0 && id < voli->nv) voli->ignore[id] = 1;
                        }
                        press_enter();

                    }
                    list_append(grafi, &(voli));
                }
                printf("Puoi prendere il treno? (s/n): ");
                scanf("%c", &yes);
                press_enter();
                if (yes == 's' || yes == 'S'){
                    printf("Per tutte le citta'?(s/n): ");
                    scanf("%c", &yes);
                    press_enter();
                    if (yes != 's' && yes != 'S'){
                        printf("Quante citta' vuoi ingorare?: ");
                        scanf("%d", &dest);
                        press_enter();
                        if (dest) printf("Inserisci le %d citta: ", dest);
                        for(i=0; i<dest; i++){
                            scanf("%d", &id);
                            if(id >= 0 && id < ferrovie->nv) ferrovie->ignore[id] = 1;
                        }
                        press_enter();

                    }
                    list_append(grafi, &(ferrovie));
                }
                printf("Puoi prendere strade a pedaggio? (s/n): ");
                scanf("%c", &yes);
                press_enter();
                if (yes == 's' || yes == 'S'){
                    printf("Per tutte le citta'?(s/n): ");
                    scanf("%c", &yes);
                    press_enter();
                    if (yes != 's' && yes != 'S'){
                        printf("Quante citta' vuoi ingorare?: ");
                        scanf("%d", &dest);
                        press_enter();
                        if (dest) printf("Inserisci le %d citta: ", dest);
                        for(i=0; i<dest; i++){
                            scanf("%d", &id);
                            if(id >= 0 && id < autostrade->nv) autostrade->ignore[id] = 1;
                        }
                        press_enter();

                    }
                    list_append(grafi, &(autostrade));
                }
                list_append(grafi, &(strade));

                printf("Da dove parti? (ID): ");
                scanf("%d",&source);
                press_enter();
                printf("Da dove vorresti arrivare? (ID): ");
                scanf("%d",&dest);
                press_enter();
                printf("Da %s a %s\n\n", mappa_getNomeCitta(map, source), mappa_getNomeCitta(map,dest));

                lista ord = lista_interi();
                lista mez = lista_stringhe();
                if(!grafo_getPathM(grafi, source, dest, 0, &ord, &mez)){
                    list_head(grafi, &graph, FALSE);
                    printf("Ti ci vorranno %.1f Ore\n", graph->dist[dest][0]);
                    printf("Ma dovrai spendere %.1f Euro\n", graph->dist[dest][1]);
                }
		        mappa_stampaPercorso(map, ord, mez);

                for(i=0; i< strade->nv; i++){
                    strade->ignore[id] = 0;
                    autostrade->ignore[id] = 0;
                    ferrovie->ignore[id] = 0;
                    voli->ignore[id] = 0;
                }
		        lista_cancella(&ord);
		        lista_cancella(&mez);
		        lista_cancella(&grafi);
            }
            else printf("devi prima avere uno scenario iniziale!\n");
            press_enter();
            break;
        case 4:
            if(map){
                mappa_StampaCitta(map);
                printf("\n\n");
                lista grafi = lista_grafi();
                voli = grafo_getVoli(map);
                ferrovie = grafo_getFerrovie(map);
                autostrade = grafo_getAutostrade(map);
                strade = grafo_getStrade(map);

                printf("Puoi prendere l'aereo? (s/n): ");
                scanf("%c", &yes);
                press_enter();
                if (yes == 's' || yes == 'S'){
                    printf("Per tutte le citta'?(s/n): ");
                    scanf("%c", &yes);
                    press_enter();
                    if (yes != 's' && yes != 'S'){
                        printf("Quante citta' vuoi ingorare?: ");
                        scanf("%d", &dest);
                        press_enter();
                        if (dest) printf("Inserisci le %d citta: ", dest);
                        for(i=0; i<dest; i++){
                            scanf("%d", &id);
                            if(id >= 0 && id < voli->nv) voli->ignore[id] = 1;
                        }
                        press_enter();

                    }
                    list_append(grafi, &(voli));
                }
                printf("Puoi prendere il treno? (s/n): ");
                scanf("%c", &yes);
                press_enter();
                if (yes == 's' || yes == 'S'){
                    printf("Per tutte le citta'?(s/n): ");
                    scanf("%c", &yes);
                    press_enter();
                    if (yes != 's' && yes != 'S'){
                        printf("Quante citta' vuoi ingorare?: ");
                        scanf("%d", &dest);
                        press_enter();
                        if (dest) printf("Inserisci le %d citta: ", dest);
                        for(i=0; i<dest; i++){
                            scanf("%d", &id);
                            if(id >= 0 && id < ferrovie->nv) ferrovie->ignore[id] = 1;
                        }
                        press_enter();

                    }
                    list_append(grafi, &(ferrovie));
                }
                printf("Puoi prendere strade a pedaggio? (s/n): ");
                scanf("%c", &yes);
                press_enter();
                if (yes == 's' || yes == 'S'){
                    printf("Per tutte le citta'?(s/n): ");
                    scanf("%c", &yes);
                    press_enter();
                    if (yes != 's' && yes != 'S'){
                        printf("Quante citta' vuoi ingorare?: ");
                        scanf("%d", &dest);
                        press_enter();
                        if (dest) printf("Inserisci le %d citta: ", dest);
                        for(i=0; i<dest; i++){
                            scanf("%d", &id);
                            if(id >= 0 && id < autostrade->nv) autostrade->ignore[id] = 1;
                        }
                        press_enter();

                    }
                    list_append(grafi, &(autostrade));
                }
                list_append(grafi, &(strade));

                printf("Da dove parti? (ID): ");
                scanf("%d",&source);
                press_enter();
                printf("Da dove vorresti arrivare? (ID): ");
                scanf("%d",&dest);
                press_enter();
                printf("Da %s a %s\n\n", mappa_getNomeCitta(map, source), mappa_getNomeCitta(map,dest));

                lista ord = lista_interi();
                lista mez = lista_stringhe();
                if(!grafo_getPathM(grafi, source, dest, 1, &ord, &mez)){
                    list_head(grafi, &graph, FALSE);
                    printf("Dovrai spendere %.1f Euro\n", graph->dist[dest][1]);
                    printf("Ma ci vorranno %.1f Ore\n", graph->dist[dest][0]);
                }
		        mappa_stampaPercorso(map, ord, mez);

                for(i=0; i< strade->nv; i++){
                    strade->ignore[id] = 0;
                    autostrade->ignore[id] = 0;
                    ferrovie->ignore[id] = 0;
                    voli->ignore[id] = 0;
                }
		        lista_cancella(&ord);
		        lista_cancella(&mez);
		        lista_cancella(&grafi);
            }
            else printf("devi prima avere uno scenario iniziale!\n");
            press_enter();
            break;
        case 5:
            if(map)
            {
                printf("\nSelezionare il tipo di collegamento\n");
                printf("\n[1] Aereo\n");
                printf("\n[2] Ferroviario\n");
                printf("\n[3] Autostradale\n");
                printf("\n[4] Stradale\n");
                scanf("%d",&scelta);
                graph=NULL;
                switch (scelta)
                {
                    case 1:
                        graph=grafo_getVoli(map);
                        break;
                    case 2:
                        graph=grafo_getFerrovie(map);
                        break;
                    case 3:
                        graph=grafo_getAutostrade(map);
                        break;
                    case 4:
                        graph=grafo_getStrade(map);
                        break;
                }
                if(graph!=NULL)
                {
                    printf("Inserire Sorgente e Destinazione\n");
                    scanf("%d %d", &source, &dest);
                    grafo_RimuoviArco(graph, source, dest);
                }
            }
            else printf("devi prima avere una mappa!\n");
            press_enter();
            break;
        case 6:
            if(map)
            {
                clear_screen();
                mappa_StampaCitta(map);
                printf("Inserire ID della città da eliminare %p\n", map->Voli);
                scanf("%d", &id);
                mappa_CancellaCitta(map, id);
                clear_screen();
                mappa_StampaCitta(map);
                printf("Fatto\n");
                press_enter();
            }
            else printf("devi prima avere una mappa!\n");
            press_enter();
            break;
        case 7:
            if(map)
            {
                printf("Inserire il nome del file\n");
                scanf("%s",nomeF);
                if( mappa_mapToFile(map, nomeF))
                    printf("Scrittura avvenuta con successo.\n");
                else printf("Scrittura fallita.\n");
            }
            else printf("devi prima avere una mappa!\n");
            press_enter();
            break;
        case 8:
            printf("Inserire il nome del file\n");
            scanf("%s",nomeF);
            mappa_cancella(map);
            map = mappa_mapFromFile(nomeF);
            if(map)
                printf("Import avvenuto con successo.\n");
            else printf("Import fallito\n");
            break;
        case 9:
            if(map)
            {
                do{
                    printf("Inserire Sorgente e Destinazione\n");
                    scanf("%d %d", &source, &dest);
                } while(source < 0 || dest < 0 || source >= map->NumCitta || dest >= map->NumCitta);
                press_enter();
                printf("\nSelezionare il tipo di collegamento\n");
                printf("\n[1] Aereo\n");
                printf("\n[2] Ferroviario\n");
                printf("\n[3] Autostradale\n");
                printf("\n[4] Stradale\n");
                scanf("%d",&scelta);
                graph = NULL;
                dist = (double)citta_Distanza(map->cities[source], map->cities[dest]);
                switch (scelta)
                {
                    case 1:
                        graph = grafo_getVoli(map);
                        tempo = (dist/map->Vel_Aereo);
                        costo = (dist*map->Costo_Aereo);
                        break;
                    case 2:
                        graph = grafo_getFerrovie(map);
                        tempo = (dist/map->Vel_Treno);
                        costo = (dist*map->Costo_Treno);
                        break;
                    case 3:
                        graph = grafo_getAutostrade(map);
                        tempo = (dist/map->Vel_Autostrade);
                        costo = (dist*(map->Costo_Pedaggio + map->Costo_Benzina));
                        break;
                    case 4:
                        graph = grafo_getStrade(map);
                        tempo = dist/map->Vel_Strade;
                        costo = dist*map->Costo_Pedaggio;
                        break;
                }
                if(graph!=NULL)
                {
                    grafo_AggiungiArco(graph, source, dest, 2, tempo, costo);
                    grafo_AggiungiArco(graph, dest, source, 2, tempo, costo);
                }
            }
            else printf("devi prima avere una mappa!\n");
            press_enter();
            break;
        case 10:
            if(map)
            {
                clear_screen();
                mappa_StampaCitta(map);
                printf("\n\nInserire il nome della città da aggiungere: ");
                scanf("%s",nomeF);
                printf("Inserire la coppia di coordinate: ");
                scanf("%d %d", &source, &dest);
                source = source%WORLD_SIZE;
                dest = dest%WORLD_SIZE;
                printf("Inserire il livello: ");
                scanf("%d", &id);
                mappa_AggiungiCitta(map, nomeF, source, dest, id);
                clear_screen();
                mappa_StampaCitta(map);
                printf("Fatto\n");
                press_enter();
            }
            else printf("devi prima avere una mappa!\n");
            press_enter();
            break;
         case 11:
            if(map){
                printf("\nSelezionare il grafo\n");
                printf("\n[1] Aereo\n");
                printf("\n[2] Ferroviario\n");
                printf("\n[3] Autostradale\n");
                printf("\n[4] Stradale\n");
                scanf("%d",&scelta);
                graph = NULL;
                switch (scelta)
                {
                    case 1:
                        graph = grafo_getVoli(map);
                        break;
                    case 2:
                        graph = grafo_getFerrovie(map);
                        break;
                    case 3:
                        graph = grafo_getAutostrade(map);
                        break;
                    default:
                        graph = grafo_getStrade(map);
                        break;
                }
                printf("\n\n");
                grafo_Stampa(graph);
                printf("\n\n");
                press_enter();
            }
            else printf("devi prima avere una mappa!\n");
            press_enter();
            break;
        case 0:
            clear_screen();
            printf("[0] Esci\n\n");
            printf("Arrivederci!\n");
            press_enter();
            break;
        default:
            clear_screen();
            feature_segreta();
            press_enter();
            break;
        }
    }
    return 0;
}