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

Method TryReadUint16LE

src/core/string_consumer.hpp:176–181  ·  view source on GitHub ↗

* Try to read binary uint16, and then advance reader. */

Source from the content-addressed store, hash-verified

174 * Try to read binary uint16, and then advance reader.
175 */
176 [[nodiscard]] std::optional<uint16_t> TryReadUint16LE()
177 {
178 auto value = this->PeekUint16LE();
179 if (value.has_value()) this->SkipUint16LE();
180 return value;
181 }
182 /**
183 * Read binary uint16 using little endian, and advance reader.
184 * @param def Default value to return, if not enough data.

Callers 1

ReadWordMethod · 0.80

Calls 2

PeekUint16LEMethod · 0.95
SkipUint16LEMethod · 0.95

Tested by

no test coverage detected