MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ShowNetworkContentListWindow

Function ShowNetworkContentListWindow

src/network/network_content_gui.cpp:1117–1142  ·  view source on GitHub ↗

* Show the content list window with a given set of content * @param cv the content to show, or nullptr when it has to search for itself * @param type1 the first type to (only) show or #CONTENT_TYPE_END to show all. * @param type2 the second type to (only) show in addition to type1. If type2 is != #CONTENT_TYPE_END, then also type1 should be != #CONTENT_TYPE_END. * If type2 != #CONTENT_TYPE_E

Source from the content-addressed store, hash-verified

1115 * If type2 != #CONTENT_TYPE_END, then type1 != type2 must be true.
1116 */
1117void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentType type2)
1118{
1119#if defined(WITH_ZLIB)
1120 ContentTypes types{};
1121 _network_content_client.Clear();
1122 if (cv == nullptr) {
1123 assert(type1 != CONTENT_TYPE_END || type2 == CONTENT_TYPE_END);
1124 assert(type1 == CONTENT_TYPE_END || type1 != type2);
1125 _network_content_client.RequestContentList(type1);
1126 if (type2 != CONTENT_TYPE_END) _network_content_client.RequestContentList(type2);
1127
1128 if (type1 != CONTENT_TYPE_END) types.Set(type1);
1129 if (type2 != CONTENT_TYPE_END) types.Set(type2);
1130 } else {
1131 _network_content_client.RequestContentList(cv, true);
1132 }
1133
1134 CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
1135 new NetworkContentListWindow(_network_content_list_desc, cv != nullptr, types);
1136#else
1137 ShowErrorMessage(
1138 GetEncodedString(STR_CONTENT_NO_ZLIB),
1139 GetEncodedString(STR_CONTENT_NO_ZLIB_SUB),
1140 WL_ERROR);
1141#endif /* WITH_ZLIB */
1142}

Callers 6

OnClickMethod · 0.85
OnClickMethod · 0.85
ShowMissingContentWindowFunction · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85

Calls 6

CloseWindowByIdFunction · 0.85
ShowErrorMessageFunction · 0.85
RequestContentListMethod · 0.80
GetEncodedStringFunction · 0.50
ClearMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected