More work on spectator mode.

This commit is contained in:
lotodore
2013-06-16 10:43:13 +02:00
parent 6e55351389
commit 00543b7560
13 changed files with 271 additions and 45 deletions
+33
View File
@@ -8012,6 +8012,7 @@ void RejoinExistingGameMessage::Swap(RejoinExistingGameMessage* other) {
const int JoinGameAckMessage::kGameIdFieldNumber;
const int JoinGameAckMessage::kAreYouGameAdminFieldNumber;
const int JoinGameAckMessage::kGameInfoFieldNumber;
const int JoinGameAckMessage::kSpectateOnlyFieldNumber;
#endif // !_MSC_VER
JoinGameAckMessage::JoinGameAckMessage()
@@ -8039,6 +8040,7 @@ void JoinGameAckMessage::SharedCtor() {
gameid_ = 0u;
areyougameadmin_ = false;
gameinfo_ = NULL;
spectateonly_ = false;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@@ -8083,6 +8085,7 @@ void JoinGameAckMessage::Clear() {
if (has_gameinfo()) {
if (gameinfo_ != NULL) gameinfo_->::NetGameInfo::Clear();
}
spectateonly_ = false;
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@@ -8134,6 +8137,22 @@ bool JoinGameAckMessage::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(32)) goto parse_spectateOnly;
break;
}
// optional bool spectateOnly = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_spectateOnly:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &spectateonly_)));
set_has_spectateonly();
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
@@ -8171,6 +8190,11 @@ void JoinGameAckMessage::SerializeWithCachedSizes(
3, this->gameinfo(), output);
}
// optional bool spectateOnly = 4;
if (has_spectateonly()) {
::google::protobuf::internal::WireFormatLite::WriteBool(4, this->spectateonly(), output);
}
}
int JoinGameAckMessage::ByteSize() const {
@@ -8196,6 +8220,11 @@ int JoinGameAckMessage::ByteSize() const {
this->gameinfo());
}
// optional bool spectateOnly = 4;
if (has_spectateonly()) {
total_size += 1 + 1;
}
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
@@ -8220,6 +8249,9 @@ void JoinGameAckMessage::MergeFrom(const JoinGameAckMessage& from) {
if (from.has_gameinfo()) {
mutable_gameinfo()->::NetGameInfo::MergeFrom(from.gameinfo());
}
if (from.has_spectateonly()) {
set_spectateonly(from.spectateonly());
}
}
}
@@ -8243,6 +8275,7 @@ void JoinGameAckMessage::Swap(JoinGameAckMessage* other) {
std::swap(gameid_, other->gameid_);
std::swap(areyougameadmin_, other->areyougameadmin_);
std::swap(gameinfo_, other->gameinfo_);
std::swap(spectateonly_, other->spectateonly_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
std::swap(_cached_size_, other->_cached_size_);
}
+33 -1
View File
@@ -3950,6 +3950,13 @@ class JoinGameAckMessage : public ::google::protobuf::MessageLite {
inline ::NetGameInfo* release_gameinfo();
inline void set_allocated_gameinfo(::NetGameInfo* gameinfo);
// optional bool spectateOnly = 4;
inline bool has_spectateonly() const;
inline void clear_spectateonly();
static const int kSpectateOnlyFieldNumber = 4;
inline bool spectateonly() const;
inline void set_spectateonly(bool value);
// @@protoc_insertion_point(class_scope:JoinGameAckMessage)
private:
inline void set_has_gameid();
@@ -3958,13 +3965,16 @@ class JoinGameAckMessage : public ::google::protobuf::MessageLite {
inline void clear_has_areyougameadmin();
inline void set_has_gameinfo();
inline void clear_has_gameinfo();
inline void set_has_spectateonly();
inline void clear_has_spectateonly();
::google::protobuf::uint32 gameid_;
bool areyougameadmin_;
bool spectateonly_;
::NetGameInfo* gameinfo_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
friend void protobuf_AddDesc_pokerth_2eproto_impl();
@@ -14528,6 +14538,28 @@ inline void JoinGameAckMessage::set_allocated_gameinfo(::NetGameInfo* gameinfo)
}
}
// optional bool spectateOnly = 4;
inline bool JoinGameAckMessage::has_spectateonly() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
inline void JoinGameAckMessage::set_has_spectateonly() {
_has_bits_[0] |= 0x00000008u;
}
inline void JoinGameAckMessage::clear_has_spectateonly() {
_has_bits_[0] &= ~0x00000008u;
}
inline void JoinGameAckMessage::clear_spectateonly() {
spectateonly_ = false;
clear_has_spectateonly();
}
inline bool JoinGameAckMessage::spectateonly() const {
return spectateonly_;
}
inline void JoinGameAckMessage::set_spectateonly(bool value) {
set_has_spectateonly();
spectateonly_ = value;
}
// -------------------------------------------------------------------
// JoinGameFailedMessage