comparison src/yadex.cc @ 75:e6175d0a667b

Get rid of the mostly useless find_level() and associated logic.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 26 Sep 2011 13:44:40 +0300
parents e5cd0f139fc1
children 042b44809e6e
comparison
equal deleted inserted replaced
74:db03e604eea3 75:e6175d0a667b
698 } 698 }
699 else 699 else
700 level_name = 0; 700 level_name = 0;
701 else 701 else
702 { 702 {
703 level_name = find_level(com); 703 if (FindMasterDir(MasterDir, com))
704 if (level_name == error_invalid)
705 {
706 printf("\"%s\" is not a valid level name.\n", com);
707 continue;
708 }
709 else if (level_name == error_none)
710 {
711 printf("Neither E%dM%d nor MAP%02d exist.\n",
712 atoi(com) / 10, atoi(com) % 10, atoi(com));
713 continue;
714 }
715 else if (level_name == error_non_unique)
716 {
717 printf
718 ("Both E%dM%d and MAP%02d exist. Use an unambiguous name.\n",
719 atoi(com) / 10, atoi(com) % 10, atoi(com));
720 continue;
721 }
722 else if (level_name == NULL)
723 { 704 {
724 printf("Level %s not found.", com); 705 printf("Level %s not found.", com);
725 // Hint absent-minded users 706 // Hint absent-minded users
726 if ((tolower(*com) == 'e' && yg_level_name == YGLN_MAP01) || 707 if ((tolower(*com) == 'e' && yg_level_name == YGLN_MAP01) ||
727 (tolower(*com) == 'm' && yg_level_name == YGLN_E1M1)) 708 (tolower(*com) == 'm' && yg_level_name == YGLN_E1M1))
731 putchar('\n'); 712 putchar('\n');
732 continue; 713 continue;
733 } 714 }
734 } 715 }
735 EditLevel(level_name, newlevel); 716 EditLevel(level_name, newlevel);
736 if (level_name)
737 free(level_name);
738 } 717 }
739 718
740 /* user asked to build a new main wad file */ 719 /* user asked to build a new main wad file */
741 else if (strcmp(com, "build") == 0 || strcmp(com, "b") == 0) 720 else if (strcmp(com, "build") == 0 || strcmp(com, "b") == 0)
742 { 721 {