diff options
author | Johannes Schickel | 2009-09-17 12:02:41 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-09-17 12:02:41 +0000 |
commit | f13602f7d24cc3e5308c363039b0495f1a4b1193 (patch) | |
tree | c3c7bfae6c15361665ea00ba815dbd1f8ba690d3 /tools | |
parent | 3374fef61ee1403066a3207e90155cc12abef46f (diff) | |
download | scummvm-rg350-f13602f7d24cc3e5308c363039b0495f1a4b1193.tar.gz scummvm-rg350-f13602f7d24cc3e5308c363039b0495f1a4b1193.tar.bz2 scummvm-rg350-f13602f7d24cc3e5308c363039b0495f1a4b1193.zip |
Cleanup provider access.
svn-id: r44144
Diffstat (limited to 'tools')
-rw-r--r-- | tools/create_kyradat/create_kyradat.cpp | 22 | ||||
-rw-r--r-- | tools/create_kyradat/tables.cpp | 24 | ||||
-rw-r--r-- | tools/create_kyradat/tables.h | 10 |
3 files changed, 34 insertions, 22 deletions
diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index 660dd49a0c..48a14e849a 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -1072,23 +1072,17 @@ bool setupSearch(const int *needList, Search &search, DataIdList &dataIdList) { for (const int *entry = needList; *entry != -1; ++entry) { bool found = false; - for (const ExtractEntry *p = extractProviders; p->id != -1; ++p) { - if (p->id == *entry) { - for (const ExtractEntrySearchData *d = p->providers; d->hint.size != 0; ++d) { - found = true; - - // We will add *all* providers here, regardless of the language and platform! - search.addData(d->hint); - dataIdList.push_back(DataIdEntry(*d, *entry)); - } - - break; - } - } + ExtractEntryList providers = getProvidersForId(*entry); - if (!found) { + if (providers.empty()) { fprintf(stderr, "ERROR: No provider for id %d/%s\n", *entry, getIdString(*entry)); return false; + } else { + for (ExtractEntryList::const_iterator i = providers.begin(); i != providers.end(); ++i) { + // We will add *all* providers here, regardless of the language and platform! + search.addData(i->hint); + dataIdList.push_back(DataIdEntry(*i, *entry)); + } } } diff --git a/tools/create_kyradat/tables.cpp b/tools/create_kyradat/tables.cpp index b83567797b..138eaead6b 100644 --- a/tools/create_kyradat/tables.cpp +++ b/tools/create_kyradat/tables.cpp @@ -22,6 +22,10 @@ #include "tables.h" +#define EXTRACT_END_ENTRY { UNK_LANG, kPlatformUnknown, { 0, 0, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } } + +namespace { + // Id provider tables const ExtractEntrySearchData kForestSeqProvider[] = { @@ -1641,6 +1645,11 @@ const ExtractEntrySearchData kLolHistoryProvider[] = { // Provider tables +struct ExtractEntry { + int id; + const ExtractEntrySearchData *providers; +}; + const ExtractEntry extractProviders[] = { { kForestSeq, kForestSeqProvider }, { kKallakWritingSeq, kKallakWritingSeqProvider }, @@ -1842,3 +1851,18 @@ const ExtractEntry extractProviders[] = { { -1, NULL } }; +} // end of anonymous namespace + +ExtractEntryList getProvidersForId(int id) { + ExtractEntryList list; + + for (const ExtractEntry *p = extractProviders; p->id != -1; ++p) { + if (p->id == id) { + for (const ExtractEntrySearchData *d = p->providers; d->hint.size != 0; ++d) + list.push_back(*d); + } + } + + return list; +} + diff --git a/tools/create_kyradat/tables.h b/tools/create_kyradat/tables.h index 2e02f7b07f..158a014d64 100644 --- a/tools/create_kyradat/tables.h +++ b/tools/create_kyradat/tables.h @@ -32,14 +32,8 @@ struct ExtractEntrySearchData { SearchData hint; }; -#define EXTRACT_END_ENTRY { UNK_LANG, kPlatformUnknown, { 0, 0, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } } - -struct ExtractEntry { - int id; - const ExtractEntrySearchData *providers; -}; - -extern const ExtractEntry extractProviders[]; +typedef std::list<ExtractEntrySearchData> ExtractEntryList; +ExtractEntryList getProvidersForId(int id); #endif |