diff options
author | yexo <yexo@openttd.org> | 2011-12-09 21:49:52 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2011-12-09 21:49:52 +0000 |
commit | dcba6c25ea0cad50dc779f8df359bdd45b6def26 (patch) | |
tree | 7d8a220d37c957eaa0f62838e25e06b78772bf27 /src/newgrf_gui.cpp | |
parent | d9b9ac6013eccff386da96a3ef8b97912b994584 (diff) | |
download | openttd-dcba6c25ea0cad50dc779f8df359bdd45b6def26.tar.xz |
(svn r23465) -Feature [FS#4827]: add 'find missing content online' button to 'load savegame' and 'find network game' windows
Diffstat (limited to 'src/newgrf_gui.cpp')
-rw-r--r-- | src/newgrf_gui.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 6607f4ca7..7b3604157 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1196,20 +1196,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback { #if defined(ENABLE_NETWORK) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window - /* Only show the things in the current list, or everything when nothing's selected */ - ContentVector cv; - for (const GRFConfig *c = this->actives; c != NULL; c = c->next) { - if (c->status != GCS_NOT_FOUND && !HasBit(c->flags, GCF_COMPATIBLE)) continue; - - ContentInfo *ci = new ContentInfo(); - ci->type = CONTENT_TYPE_NEWGRF; - ci->state = ContentInfo::DOES_NOT_EXIST; - ttd_strlcpy(ci->name, c->GetName(), lengthof(ci->name)); - ci->unique_id = BSWAP32(c->ident.grfid); - memcpy(ci->md5sum, HasBit(c->flags, GCF_COMPATIBLE) ? c->original_md5sum : c->ident.md5sum, sizeof(ci->md5sum)); - *cv.Append() = ci; - } - ShowNetworkContentListWindow(cv.Length() == 0 ? NULL : &cv, CONTENT_TYPE_NEWGRF); + ShowMissingContentWindow(this->actives); #endif } break; @@ -1506,6 +1493,30 @@ private: } }; +#if defined(ENABLE_NETWORK) +/** + * Show the content list window with all missing grfs from the given list. + * @param list The list of grfs to check for missings / not exactly matching ones. + */ +void ShowMissingContentWindow(const GRFConfig *list) +{ + /* Only show the things in the current list, or everything when nothing's selected */ + ContentVector cv; + for (const GRFConfig *c = list; c != NULL; c = c->next) { + if (c->status != GCS_NOT_FOUND && !HasBit(c->flags, GCF_COMPATIBLE)) continue; + + ContentInfo *ci = new ContentInfo(); + ci->type = CONTENT_TYPE_NEWGRF; + ci->state = ContentInfo::DOES_NOT_EXIST; + ttd_strlcpy(ci->name, c->GetName(), lengthof(ci->name)); + ci->unique_id = BSWAP32(c->ident.grfid); + memcpy(ci->md5sum, HasBit(c->flags, GCF_COMPATIBLE) ? c->original_md5sum : c->ident.md5sum, sizeof(ci->md5sum)); + *cv.Append() = ci; + } + ShowNetworkContentListWindow(cv.Length() == 0 ? NULL : &cv, CONTENT_TYPE_NEWGRF); +} +#endif + Listing NewGRFWindow::last_sorting = {false, 0}; Filtering NewGRFWindow::last_filtering = {false, 0}; |