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

Method CanWriteToPacket

src/network/core/packet.cpp:90–93  ·  view source on GitHub ↗

* Is it safe to write to the packet, i.e. didn't we run over the buffer? * @param bytes_to_write The amount of bytes we want to try to write. * @return True iff the given amount of bytes can be written to the packet. */

Source from the content-addressed store, hash-verified

88 * @return True iff the given amount of bytes can be written to the packet.
89 */
90bool Packet::CanWriteToPacket(size_t bytes_to_write)
91{
92 return this->Size() + bytes_to_write <= this->limit;
93}
94
95/*
96 * The next couple of functions make sure we can send

Callers 9

PacketMethod · 0.95
Send_uint8Method · 0.95
Send_uint16Method · 0.95
Send_uint32Method · 0.95
Send_uint64Method · 0.95
Send_stringMethod · 0.95
Send_bufferMethod · 0.95
SendCmdNamesMethod · 0.80
WriteMethod · 0.80

Calls 1

SizeMethod · 0.95

Tested by

no test coverage detected