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

Method RequestContentList

src/network/network_content.cpp:175–211  ·  view source on GitHub ↗

* Request the content list for the given type. * @param type The content type to request the list for. */

Source from the content-addressed store, hash-verified

173 * @param type The content type to request the list for.
174 */
175void ClientNetworkContentSocketHandler::RequestContentList(ContentType type)
176{
177 if (type == CONTENT_TYPE_END) {
178 this->RequestContentList(CONTENT_TYPE_BASE_GRAPHICS);
179 this->RequestContentList(CONTENT_TYPE_BASE_MUSIC);
180 this->RequestContentList(CONTENT_TYPE_BASE_SOUNDS);
181 this->RequestContentList(CONTENT_TYPE_SCENARIO);
182 this->RequestContentList(CONTENT_TYPE_HEIGHTMAP);
183 this->RequestContentList(CONTENT_TYPE_AI);
184 this->RequestContentList(CONTENT_TYPE_AI_LIBRARY);
185 this->RequestContentList(CONTENT_TYPE_GAME);
186 this->RequestContentList(CONTENT_TYPE_GAME_LIBRARY);
187 this->RequestContentList(CONTENT_TYPE_NEWGRF);
188 return;
189 }
190
191 this->Connect();
192
193 auto p = std::make_unique<Packet>(this, PACKET_CONTENT_CLIENT_INFO_LIST);
194 p->Send_uint8 ((uint8_t)type);
195 p->Send_uint32(0xffffffff);
196 p->Send_uint8 (1);
197 p->Send_string("vanilla");
198 p->Send_string(_openttd_content_version);
199
200 /* Patchpacks can extend the list with one. In BaNaNaS metadata you can
201 * add a branch in the 'compatibility' list, to filter on this. If you want
202 * your patchpack to be mentioned in the BaNaNaS web-interface, create an
203 * issue on https://github.com/OpenTTD/bananas-api asking for this.
204
205 p->Send_string("patchpack"); // Or what-ever the name of your patchpack is.
206 p->Send_string(_openttd_content_version_patchpack);
207
208 */
209
210 this->SendPacket(std::move(p));
211}
212
213/**
214 * Request the content list for a given number of content IDs.

Callers 5

OnConnectMethod · 0.80
OnConnectMethod · 0.80
ConContentFunction · 0.80

Calls 12

ConnectMethod · 0.95
Send_uint32Method · 0.80
Send_stringMethod · 0.80
Send_uint16Method · 0.80
Send_bytesMethod · 0.80
push_backMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
Send_uint8Method · 0.45
SendPacketMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected