# Add out-of-sync multiplayer checks.

Change CStr8 serialization to allow \0 in strings.

This was SVN commit r7565.
This commit is contained in:
Ykkrosh
2010-05-22 14:05:56 +00:00
parent 4e661a205d
commit 94e5d88169
8 changed files with 221 additions and 21 deletions
+4 -10
View File
@@ -508,24 +508,18 @@ u8* CStr8::Serialize(u8* buffer) const
size_t i = 0;
for (i = 0; i < len; i++)
buffer[i] = (*this)[i];
buffer[i] = 0;
return buffer+len+1;
return buffer+len;
}
const u8* CStr8::Deserialize(const u8* buffer, const u8* bufferend)
{
const u8 *strend = buffer;
while (strend < bufferend && *strend) strend++;
if (strend >= bufferend) return NULL;
*this = std::string(buffer, strend);
return strend+1;
*this = std::string(buffer, bufferend);
return bufferend;
}
size_t CStr::GetSerializedLength() const
{
return size_t(length() + 1);
return length();
}
#endif // _UNICODE