Simplified entryIndex assignment in StringTable_BitRead

This commit is contained in:
Gabriel Huber 2016-04-25 22:43:08 +02:00
parent 6c4f8e634a
commit 1ca5fbfd2c

View File

@ -21,16 +21,15 @@ static void StringTable_BitRead(NetHandlers::BitRead& bitbuf, SourceGameContext&
{ {
const size_t numEncodeBits = math::log2(data->maxEntries); const size_t numEncodeBits = math::log2(data->maxEntries);
std::vector<StringHistoryEntry> history; std::vector<StringHistoryEntry> history;
int lastEntry = -1; int entryIndex = -1;
for (uint i = 0; i < data->numEntries; ++i) for (uint i = 0; i < data->numEntries; ++i)
{ {
int entryIndex = lastEntry + 1; entryIndex++;
if (bitbuf.ReadOneBit() == 0) if (bitbuf.ReadOneBit() == 0)
{ {
entryIndex = bitbuf.ReadUBitLong(numEncodeBits); entryIndex = bitbuf.ReadUBitLong(numEncodeBits);
} }
lastEntry = entryIndex;
const char *pEntry = NULL; const char *pEntry = NULL;
char entry[1024]; char entry[1024];