diff options
Diffstat (limited to 'src/d_iwad.c')
-rw-r--r-- | src/d_iwad.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c index fdec8cb9..a9a1e2bd 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -635,3 +635,40 @@ char *D_FindIWAD(int mask, GameMission_t *mission) return result; } +// Find all IWADs in the IWAD search path matching the given mask. + +iwad_t **D_FindAllIWADs(int mask) +{ + iwad_t **result; + int result_len; + char *filename; + int i; + + result = malloc(sizeof(iwad_t *) * (arrlen(iwads) + 1)); + result_len = 0; + + // Try to find all IWADs + + for (i=0; i<arrlen(iwads); ++i) + { + if (((1 << iwads[i].mission) & mask) == 0) + { + continue; + } + + filename = D_FindWADByName(iwads[i].name); + + if (filename != NULL) + { + result[result_len] = &iwads[i]; + ++result_len; + } + } + + // End of list + + result[result_len] = NULL; + + return result; +} + |