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

Function NetworkReplaceCommandClientId

src/network/network_command.cpp:427–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425
426template <Commands Tcmd>
427static void NetworkReplaceCommandClientId(CommandPacket &cp, ClientID client_id)
428{
429 /* Unpack command parameters. */
430 auto params = EndianBufferReader::ToValue<typename CommandTraits<Tcmd>::Args>(cp.data);
431
432 /* Insert client id. */
433 SetClientIds(params, client_id, std::make_index_sequence<std::tuple_size_v<decltype(params)>>{});
434
435 /* Repack command parameters. */
436 cp.data = EndianBufferWriter<CommandDataBuffer>::FromValue(params);
437}
438
439/**
440 * Insert a client ID into the command data in a command packet.

Callers 1

Calls 1

SetClientIdsFunction · 0.70

Tested by

no test coverage detected