Preparing "allow spectators" flag in network protocol (#215).
This commit is contained in:
+33
@@ -465,6 +465,7 @@ const int NetGameInfo::kPlayerActionTimeoutFieldNumber;
|
||||
const int NetGameInfo::kFirstSmallBlindFieldNumber;
|
||||
const int NetGameInfo::kStartMoneyFieldNumber;
|
||||
const int NetGameInfo::kManualBlindsFieldNumber;
|
||||
const int NetGameInfo::kAllowSpectatorsFieldNumber;
|
||||
#endif // !_MSC_VER
|
||||
|
||||
NetGameInfo::NetGameInfo()
|
||||
@@ -496,6 +497,7 @@ void NetGameInfo::SharedCtor() {
|
||||
playeractiontimeout_ = 0u;
|
||||
firstsmallblind_ = 0u;
|
||||
startmoney_ = 0u;
|
||||
allowspectators_ = true;
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
}
|
||||
|
||||
@@ -556,6 +558,7 @@ void NetGameInfo::Clear() {
|
||||
playeractiontimeout_ = 0u;
|
||||
firstsmallblind_ = 0u;
|
||||
startmoney_ = 0u;
|
||||
allowspectators_ = true;
|
||||
}
|
||||
manualblinds_.Clear();
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
@@ -798,6 +801,22 @@ bool NetGameInfo::MergePartialFromCodedStream(
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
if (input->ExpectTag(120)) goto parse_allowSpectators;
|
||||
break;
|
||||
}
|
||||
|
||||
// optional bool allowSpectators = 15 [default = true];
|
||||
case 15: {
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
||||
parse_allowSpectators:
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
|
||||
input, &allowspectators_)));
|
||||
set_has_allowspectators();
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
if (input->ExpectAtEnd()) return true;
|
||||
break;
|
||||
}
|
||||
@@ -898,6 +917,11 @@ void NetGameInfo::SerializeWithCachedSizes(
|
||||
this->manualblinds(i), output);
|
||||
}
|
||||
|
||||
// optional bool allowSpectators = 15 [default = true];
|
||||
if (has_allowspectators()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteBool(15, this->allowspectators(), output);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int NetGameInfo::ByteSize() const {
|
||||
@@ -994,6 +1018,11 @@ int NetGameInfo::ByteSize() const {
|
||||
this->startmoney());
|
||||
}
|
||||
|
||||
// optional bool allowSpectators = 15 [default = true];
|
||||
if (has_allowspectators()) {
|
||||
total_size += 1 + 1;
|
||||
}
|
||||
|
||||
}
|
||||
// repeated uint32 manualBlinds = 14 [packed = true];
|
||||
{
|
||||
@@ -1068,6 +1097,9 @@ void NetGameInfo::MergeFrom(const NetGameInfo& from) {
|
||||
if (from.has_startmoney()) {
|
||||
set_startmoney(from.startmoney());
|
||||
}
|
||||
if (from.has_allowspectators()) {
|
||||
set_allowspectators(from.allowspectators());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,6 +1131,7 @@ void NetGameInfo::Swap(NetGameInfo* other) {
|
||||
std::swap(firstsmallblind_, other->firstsmallblind_);
|
||||
std::swap(startmoney_, other->startmoney_);
|
||||
manualblinds_.Swap(&other->manualblinds_);
|
||||
std::swap(allowspectators_, other->allowspectators_);
|
||||
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
||||
std::swap(_cached_size_, other->_cached_size_);
|
||||
}
|
||||
|
||||
+33
-1
@@ -746,6 +746,13 @@ class NetGameInfo : public ::google::protobuf::MessageLite {
|
||||
inline ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >*
|
||||
mutable_manualblinds();
|
||||
|
||||
// optional bool allowSpectators = 15 [default = true];
|
||||
inline bool has_allowspectators() const;
|
||||
inline void clear_allowspectators();
|
||||
static const int kAllowSpectatorsFieldNumber = 15;
|
||||
inline bool allowspectators() const;
|
||||
inline void set_allowspectators(bool value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:NetGameInfo)
|
||||
private:
|
||||
inline void set_has_gamename();
|
||||
@@ -774,6 +781,8 @@ class NetGameInfo : public ::google::protobuf::MessageLite {
|
||||
inline void clear_has_firstsmallblind();
|
||||
inline void set_has_startmoney();
|
||||
inline void clear_has_startmoney();
|
||||
inline void set_has_allowspectators();
|
||||
inline void clear_has_allowspectators();
|
||||
|
||||
::std::string* gamename_;
|
||||
int netgametype_;
|
||||
@@ -790,9 +799,10 @@ class NetGameInfo : public ::google::protobuf::MessageLite {
|
||||
::google::protobuf::uint32 startmoney_;
|
||||
::google::protobuf::RepeatedField< ::google::protobuf::uint32 > manualblinds_;
|
||||
mutable int _manualblinds_cached_byte_size_;
|
||||
bool allowspectators_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(14 + 31) / 32];
|
||||
::google::protobuf::uint32 _has_bits_[(15 + 31) / 32];
|
||||
|
||||
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
||||
friend void protobuf_AddDesc_pokerth_2eproto_impl();
|
||||
@@ -11668,6 +11678,28 @@ NetGameInfo::mutable_manualblinds() {
|
||||
return &manualblinds_;
|
||||
}
|
||||
|
||||
// optional bool allowSpectators = 15 [default = true];
|
||||
inline bool NetGameInfo::has_allowspectators() const {
|
||||
return (_has_bits_[0] & 0x00004000u) != 0;
|
||||
}
|
||||
inline void NetGameInfo::set_has_allowspectators() {
|
||||
_has_bits_[0] |= 0x00004000u;
|
||||
}
|
||||
inline void NetGameInfo::clear_has_allowspectators() {
|
||||
_has_bits_[0] &= ~0x00004000u;
|
||||
}
|
||||
inline void NetGameInfo::clear_allowspectators() {
|
||||
allowspectators_ = true;
|
||||
clear_has_allowspectators();
|
||||
}
|
||||
inline bool NetGameInfo::allowspectators() const {
|
||||
return allowspectators_;
|
||||
}
|
||||
inline void NetGameInfo::set_allowspectators(bool value) {
|
||||
set_has_allowspectators();
|
||||
allowspectators_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// PlayerResult
|
||||
|
||||
Reference in New Issue
Block a user