本文整理汇总了C++中BitStream::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::getInt方法的具体用法?C++ BitStream::getInt怎么用?C++ BitStream::getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitStream
的用法示例。
在下文中一共展示了BitStream::getInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Net_cbDataReceived
void Server::Net_cbDataReceived( Net_ConnID _id, BitStream &_data)
{
Network::NetEvents event = (Network::NetEvents) _data.getInt(8);
switch( event ) {
case Network::RConMsg: {
std::string passwordSent = _data.getString();
if ( !gusGame.options.rConPassword.empty() && gusGame.options.rConPassword == passwordSent ) {
//console.addQueueCommand(_data.getStringStatic());
console.parseLine(_data.getString());
}
}
break;
case Network::ConsistencyInfo: {
int clientProtocol = _data.getInt(32);
if(clientProtocol != Network::protocolVersion) {
network.disconnect(_id, Network::IncompatibleProtocol);
}
if(!gusGame.checkCRCs(_data) && network.checkCRC) // We call checkCRC anyway so that the stream is advanced
network.disconnect(_id, Network::IncompatibleData);
}
break;
}
}
示例2: rawFromBits
static std::string rawFromBits(BitStream& bits) {
size_t oldPos = bits.bitPos();
bits.resetPos();
std::string ret;
ret.reserve((bits.bitSize() + 7) / 8);
for(size_t i = 0; i < bits.bitSize() / 8; ++i)
ret += getCharFromBits(bits);
if(bits.bitSize() % 8 != 0)
ret += (char) (unsigned char) bits.getInt(bits.bitSize() % 8);
bits.setBitPos(oldPos);
return ret;
}