author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 9730 | ae89a033cf1f |
child 10039 | 1f236afd6cd1 |
permissions | -rw-r--r-- |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
1 |
/* $Id$ */ |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
2 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
3 |
/** @file fios.h Declarations for savegames operations */ |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
4 |
|
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
5 |
#ifndef FIOS_H |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
6 |
#define FIOS_H |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
7 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8152
diff
changeset
|
8 |
#include "strings_type.h" |
9555
68e7c84b2d19
(svn r13575) -Codechange: Move small vector to core since it fits better in there
skidd13
parents:
9442
diff
changeset
|
9 |
#include "core/smallvec_type.hpp" |
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8152
diff
changeset
|
10 |
|
7805
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
11 |
enum { |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
12 |
/** |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
13 |
* Slot used for the GRF scanning and such. This slot cannot be reused |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
14 |
* as it will otherwise cause issues when pressing "rescan directories". |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
15 |
* It can furthermore not be larger than LAST_GRF_SLOT as that complicates |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
16 |
* the testing for "too much NewGRFs". |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
17 |
*/ |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
18 |
CONFIG_SLOT = 0, |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
19 |
/** Slot for the sound. */ |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
20 |
SOUND_SLOT = 1, |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
21 |
/** First slot useable for (New)GRFs used during the game. */ |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
22 |
FIRST_GRF_SLOT = 2, |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
23 |
/** Last slot useable for (New)GRFs used during the game. */ |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
24 |
LAST_GRF_SLOT = 63, |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
25 |
/** Maximum number of slots. */ |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
26 |
MAX_FILE_SLOTS = 64 |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
27 |
}; |
7ab20f94cc80
(svn r11355) -Fix [FS#1377]: loading too many GRFs was not handled gracefully causing crashes and such.
rubidium
parents:
6251
diff
changeset
|
28 |
|
8149
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
29 |
enum SaveLoadDialogMode{ |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
30 |
SLD_LOAD_GAME, |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
31 |
SLD_LOAD_SCENARIO, |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
32 |
SLD_SAVE_GAME, |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
33 |
SLD_SAVE_SCENARIO, |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
34 |
SLD_LOAD_HEIGHTMAP, |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
35 |
SLD_NEW_GAME, |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
36 |
}; |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
37 |
|
8152
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
38 |
/* The different types of files been handled by the system */ |
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
39 |
enum FileType { |
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
40 |
FT_NONE, ///< nothing to do |
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
41 |
FT_SAVEGAME, ///< old or new savegame |
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
42 |
FT_SCENARIO, ///< old or new scenario |
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
43 |
FT_HEIGHTMAP, ///< heightmap file |
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
44 |
}; |
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
45 |
|
9031
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
46 |
enum FiosType { |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
47 |
FIOS_TYPE_DRIVE, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
48 |
FIOS_TYPE_PARENT, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
49 |
FIOS_TYPE_DIR, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
50 |
FIOS_TYPE_FILE, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
51 |
FIOS_TYPE_OLDFILE, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
52 |
FIOS_TYPE_SCENARIO, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
53 |
FIOS_TYPE_OLD_SCENARIO, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
54 |
FIOS_TYPE_DIRECT, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
55 |
FIOS_TYPE_PNG, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
56 |
FIOS_TYPE_BMP, |
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
57 |
FIOS_TYPE_INVALID = 255, |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
58 |
}; |
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
59 |
|
8151
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
60 |
/* Deals with finding savegames */ |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
61 |
struct FiosItem { |
9031
445046ca06af
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
8264
diff
changeset
|
62 |
FiosType type; |
8151
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
63 |
uint64 mtime; |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
64 |
char title[64]; |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
65 |
char name[256 - 12 - 64]; |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
66 |
}; |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
67 |
|
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
68 |
/* Deals with the type of the savegame, independent of extension */ |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
69 |
struct SmallFiosItem { |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
70 |
int mode; ///< savegame/scenario type (old, new) |
8152
ab21de45f8ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8151
diff
changeset
|
71 |
FileType filetype; ///< what type of file are we dealing with |
8151
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
72 |
char name[MAX_PATH]; ///< name |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
73 |
char title[255]; ///< internal name of the game |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
74 |
}; |
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
75 |
|
9409
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
76 |
enum { |
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
77 |
SORT_ASCENDING = 0, |
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
78 |
SORT_DESCENDING = 1, |
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
79 |
SORT_BY_DATE = 0, |
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
80 |
SORT_BY_NAME = 2 |
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
81 |
}; |
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
82 |
|
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
83 |
/* Variables to display file lists */ |
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9409
diff
changeset
|
84 |
extern SmallVector<FiosItem, 32> _fios_items; ///< defined in fios.cpp |
8151
4cefeef74c28
(svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas
parents:
8149
diff
changeset
|
85 |
extern SmallFiosItem _file_to_saveload; |
8149
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
86 |
extern SaveLoadDialogMode _saveload_mode; ///< defined in misc_gui.cpp |
9409
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9031
diff
changeset
|
87 |
extern byte _savegame_sort_order; |
8149
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
88 |
|
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
89 |
/* Launch save/load dialog */ |
1b1390cb0844
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
7805
diff
changeset
|
90 |
void ShowSaveLoadDialog(SaveLoadDialogMode mode); |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
91 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
92 |
/* Get a list of savegames */ |
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9409
diff
changeset
|
93 |
void FiosGetSavegameList(SaveLoadDialogMode mode); |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
94 |
/* Get a list of scenarios */ |
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9409
diff
changeset
|
95 |
void FiosGetScenarioList(SaveLoadDialogMode mode); |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
96 |
/* Get a list of Heightmaps */ |
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9409
diff
changeset
|
97 |
void FiosGetHeightmapList(SaveLoadDialogMode mode); |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
98 |
/* Free the list of savegames */ |
6247 | 99 |
void FiosFreeSavegameList(); |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
100 |
/* Browse to. Returns a filename w/path if we reached a file. */ |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
101 |
char *FiosBrowseTo(const FiosItem *item); |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
102 |
/* Return path, free space and stringID */ |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
103 |
StringID FiosGetDescText(const char **path, uint32 *total_free); |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
104 |
/* Delete a name */ |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
105 |
bool FiosDelete(const char *name); |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
106 |
/* Make a filename from a name */ |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
107 |
void FiosMakeSavegameName(char *buf, const char *name, size_t size); |
9730
ae89a033cf1f
(svn r13859) -Fix: loading of TTD(Patch) savegames from the command line didn't work
smatz
parents:
9555
diff
changeset
|
108 |
/* Determines type of savegame (or tells it is not a savegame) */ |
ae89a033cf1f
(svn r13859) -Fix: loading of TTD(Patch) savegames from the command line didn't work
smatz
parents:
9555
diff
changeset
|
109 |
FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title); |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
110 |
|
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
111 |
int CDECL compare_FiosItems(const void *a, const void *b); |
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4218
diff
changeset
|
112 |
|
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
113 |
/* Implementation of opendir/readdir/closedir for Windows */ |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
114 |
#if defined(WIN32) |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
115 |
#include <windows.h> |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
116 |
struct DIR; |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
117 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
118 |
struct dirent { // XXX - only d_name implemented |
6251
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6248
diff
changeset
|
119 |
TCHAR *d_name; // name of found file |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
120 |
/* little hack which will point to parent DIR struct which will |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
121 |
* save us a call to GetFileAttributes if we want information |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6088
diff
changeset
|
122 |
* about the file (for example in function fio_bla) */ |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
123 |
DIR *dir; |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
124 |
}; |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
125 |
|
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
126 |
struct DIR { |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
127 |
HANDLE hFind; |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
128 |
/* the dirent returned by readdir. |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
129 |
* note: having only one global instance is not possible because |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
130 |
* multiple independent opendir/readdir sequences must be supported. */ |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
131 |
dirent ent; |
6251
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6248
diff
changeset
|
132 |
WIN32_FIND_DATA fd; |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
133 |
/* since opendir calls FindFirstFile, we need a means of telling the |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
134 |
* first call to readdir that we already have a file. |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
135 |
* that's the case iff this is true */ |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
136 |
bool at_first_entry; |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
137 |
}; |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
138 |
|
6251
2ad87f850eb9
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6248
diff
changeset
|
139 |
DIR *opendir(const TCHAR *path); |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
140 |
struct dirent *readdir(DIR *d); |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
141 |
int closedir(DIR *d); |
6088
f1149b4ff932
(svn r8823) -Fix (r8821): wrapping opendir to ottd-specific function failed on non-windows because this wrapper was only active for win32 (thx Rubidium)
Darkvater
parents:
6086
diff
changeset
|
142 |
#else |
f1149b4ff932
(svn r8823) -Fix (r8821): wrapping opendir to ottd-specific function failed on non-windows because this wrapper was only active for win32 (thx Rubidium)
Darkvater
parents:
6086
diff
changeset
|
143 |
/* Use system-supplied opendir/readdir/closedir functions */ |
f1149b4ff932
(svn r8823) -Fix (r8821): wrapping opendir to ottd-specific function failed on non-windows because this wrapper was only active for win32 (thx Rubidium)
Darkvater
parents:
6086
diff
changeset
|
144 |
# include <sys/types.h> |
f1149b4ff932
(svn r8823) -Fix (r8821): wrapping opendir to ottd-specific function failed on non-windows because this wrapper was only active for win32 (thx Rubidium)
Darkvater
parents:
6086
diff
changeset
|
145 |
# include <dirent.h> |
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
146 |
#endif /* defined(WIN32) */ |
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
147 |
|
6086
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
148 |
/** |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
149 |
* A wrapper around opendir() which will convert the string from |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
150 |
* OPENTTD encoding to that of the filesystem. For all purposes this |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
151 |
* function behaves the same as the original opendir function |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
152 |
* @param path string to open directory of |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
153 |
* @return DIR pointer |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
154 |
*/ |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
155 |
static inline DIR *ttd_opendir(const char *path) |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
156 |
{ |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
157 |
return opendir(OTTD2FS(path)); |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
158 |
} |
37ea367a54e6
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Darkvater
parents:
5475
diff
changeset
|
159 |
|
4218
4033c207d304
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
Darkvater
parents:
diff
changeset
|
160 |
#endif /* FIOS_H */ |