Core/PacketIO: Added WriteString method to ByteBuffer allowing to write strings without null-terminating them

This commit is contained in:
Shauren
2012-08-10 16:55:06 +02:00
parent 55171001ee
commit 3488077946
2 changed files with 8 additions and 1 deletions

View File

@@ -152,8 +152,8 @@ namespace Movement
inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;}
inline void MoveSplineInit::SetTransportEnter() { args.flags.EnableTransportEnter(); }
inline void MoveSplineInit::SetTransportExit() { args.flags.EnableTransportExit(); }
inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable; }
inline void MoveSplineInit::SetFall()
{
args.flags.EnableFalling();

View File

@@ -452,6 +452,13 @@ class ByteBuffer
return retval;
}
//! Method for writing strings that have their length sent separately in packet
//! without null-terminating the string
void WriteString(std::string const& str)
{
append(str.c_str(), str.length());
}
const uint8 *contents() const { return &_storage[0]; }
size_t size() const { return _storage.size(); }