equal
deleted
inserted
replaced
645 } |
645 } |
646 } while (FindNextFile(h, &fd)); |
646 } while (FindNextFile(h, &fd)); |
647 FindClose(h); |
647 FindClose(h); |
648 } |
648 } |
649 |
649 |
|
650 { |
|
651 /* XXX ugly global variables ... */ |
|
652 byte order = _savegame_sort_order; |
|
653 _savegame_sort_order = 2; // sort ascending by name |
|
654 qsort(_fios_items, _fios_count, sizeof(FiosItem), compare_FiosItems); |
|
655 _savegame_sort_order = order; |
|
656 } |
|
657 |
650 // this is where to start sorting |
658 // this is where to start sorting |
651 sort_start = _fios_count; |
659 sort_start = _fios_count; |
652 |
660 |
653 /* Show savegame files |
661 /* Show savegame files |
654 * .SAV OpenTTD saved game |
662 * .SAV OpenTTD saved game |
670 fios->mtime = *(uint64*)&fd.ftLastWriteTime; |
678 fios->mtime = *(uint64*)&fd.ftLastWriteTime; |
671 ttd_strlcpy(fios->name, fd.cFileName, lengthof(fios->name)); |
679 ttd_strlcpy(fios->name, fd.cFileName, lengthof(fios->name)); |
672 |
680 |
673 *t = '\0'; // strip extension |
681 *t = '\0'; // strip extension |
674 ttd_strlcpy(fios->title, fd.cFileName, lengthof(fios->title)); |
682 ttd_strlcpy(fios->title, fd.cFileName, lengthof(fios->title)); |
675 |
|
676 } else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO) { |
683 } else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO) { |
677 if (t != NULL && ( |
684 if (t != NULL && ( |
678 strcasecmp(t, ".ss1") == 0 || |
685 strcasecmp(t, ".ss1") == 0 || |
679 strcasecmp(t, ".sv1") == 0 || |
686 strcasecmp(t, ".sv1") == 0 || |
680 strcasecmp(t, ".sv2") == 0 |
687 strcasecmp(t, ".sv2") == 0 |
752 } |
759 } |
753 } while (FindNextFile(h, &fd)); |
760 } while (FindNextFile(h, &fd)); |
754 FindClose(h); |
761 FindClose(h); |
755 } |
762 } |
756 |
763 |
|
764 { |
|
765 /* XXX ugly global variables ... */ |
|
766 byte order = _savegame_sort_order; |
|
767 _savegame_sort_order = 2; // sort ascending by name |
|
768 qsort(_fios_items, _fios_count, sizeof(FiosItem), compare_FiosItems); |
|
769 _savegame_sort_order = order; |
|
770 } |
|
771 |
757 // this is where to start sorting |
772 // this is where to start sorting |
758 sort_start = _fios_count; |
773 sort_start = _fios_count; |
759 |
774 |
760 /* Show scenario files |
775 /* Show scenario files |
761 * .SCN OpenTTD style scenario file |
776 * .SCN OpenTTD style scenario file |
774 fios = FiosAlloc(); |
789 fios = FiosAlloc(); |
775 fios->type = FIOS_TYPE_SCENARIO; |
790 fios->type = FIOS_TYPE_SCENARIO; |
776 fios->mtime = *(uint64*)&fd.ftLastWriteTime; |
791 fios->mtime = *(uint64*)&fd.ftLastWriteTime; |
777 ttd_strlcpy(fios->name, fd.cFileName, lengthof(fios->name)); |
792 ttd_strlcpy(fios->name, fd.cFileName, lengthof(fios->name)); |
778 |
793 |
779 *t = '\0'; // strip extension |
794 *t = '\0'; // strip extension |
780 ttd_strlcpy(fios->title, fd.cFileName, lengthof(fios->title)); |
795 ttd_strlcpy(fios->title, fd.cFileName, lengthof(fios->title)); |
781 |
|
782 } else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO || |
796 } else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO || |
783 mode == SLD_NEW_GAME) { |
797 mode == SLD_NEW_GAME) { |
784 if (t != NULL && ( |
798 if (t != NULL && ( |
785 strcasecmp(t, ".sv0") == 0 || |
799 strcasecmp(t, ".sv0") == 0 || |
786 strcasecmp(t, ".ss0") == 0 |
800 strcasecmp(t, ".ss0") == 0 |
840 sprintf(path, "%c:\\", item->title[0]); |
854 sprintf(path, "%c:\\", item->title[0]); |
841 break; |
855 break; |
842 |
856 |
843 case FIOS_TYPE_PARENT: |
857 case FIOS_TYPE_PARENT: |
844 s = strrchr(path, '\\'); |
858 s = strrchr(path, '\\'); |
845 if (s != NULL) *s = '\0'; |
859 if (s != path + 2) |
846 if (path[2] == '\0' ) strcat(path, "\\"); |
860 s[0] = '\0'; |
|
861 else |
|
862 s[1] = '\0'; |
847 break; |
863 break; |
848 |
864 |
849 case FIOS_TYPE_DIR: |
865 case FIOS_TYPE_DIR: |
850 s = strchr(item->name, '\\'); |
866 if (path[3] != '\0') strcat(path, "\\"); |
851 if (s != NULL) *s = '\0'; |
|
852 if (path[3] != '\0' ) strcat(path, "\\"); |
|
853 strcat(path, item->name); |
867 strcat(path, item->name); |
854 break; |
868 break; |
855 |
869 |
856 case FIOS_TYPE_FILE: |
870 case FIOS_TYPE_FILE: |
857 case FIOS_TYPE_OLDFILE: |
871 case FIOS_TYPE_OLDFILE: |