diff options
| -rw-r--r-- | pacman-c++/client.cpp | 2 | ||||
| -rw-r--r-- | pacman-c++/constants.h | 1 | ||||
| -rw-r--r-- | pacman-c++/pacman.pb.cc | 552 | ||||
| -rw-r--r-- | pacman-c++/pacman.pb.h | 276 | ||||
| -rw-r--r-- | pacman-c++/pacman.pro | 9 | ||||
| -rw-r--r-- | pacman-c++/pacman.proto | 7 | ||||
| -rw-r--r-- | pacman-c++/pacman.server.pro | 9 | ||||
| -rw-r--r-- | pacman-c++/sceneholder.cpp | 2 | ||||
| -rw-r--r-- | pacman-c++/server.cpp | 3 |
9 files changed, 854 insertions, 7 deletions
diff --git a/pacman-c++/client.cpp b/pacman-c++/client.cpp index 2142278..d4324b7 100644 --- a/pacman-c++/client.cpp +++ b/pacman-c++/client.cpp | |||
| @@ -30,7 +30,7 @@ void Client::createMenu() | |||
| 30 | QImage img(muted ? ":/soundoff" : ":/soundon"); | 30 | QImage img(muted ? ":/soundoff" : ":/soundon"); |
| 31 | img.setColor(1, menuBar()->palette().color( | 31 | img.setColor(1, menuBar()->palette().color( |
| 32 | muted ? QPalette::Disabled : QPalette::Active, | 32 | muted ? QPalette::Disabled : QPalette::Active, |
| 33 | dQPalette::ButtonText).rgba()); | 33 | QPalette::ButtonText).rgba()); |
| 34 | toggleSound->setPixmap(QPixmap::fromImage(img)); | 34 | toggleSound->setPixmap(QPixmap::fromImage(img)); |
| 35 | 35 | ||
| 36 | if (sound) | 36 | if (sound) |
diff --git a/pacman-c++/constants.h b/pacman-c++/constants.h index 8977b08..44999f7 100644 --- a/pacman-c++/constants.h +++ b/pacman-c++/constants.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #ifndef CONSTANTS_H | 1 | #ifndef CONSTANTS_H |
| 2 | #define CONSTANTS_H | 2 | #define CONSTANTS_H |
| 3 | #include <sys/types.h> | ||
| 3 | 4 | ||
| 4 | namespace Constants { | 5 | namespace Constants { |
| 5 | const struct | 6 | const struct |
diff --git a/pacman-c++/pacman.pb.cc b/pacman-c++/pacman.pb.cc new file mode 100644 index 0000000..8777326 --- /dev/null +++ b/pacman-c++/pacman.pb.cc | |||
| @@ -0,0 +1,552 @@ | |||
| 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! | ||
| 2 | |||
| 3 | #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION | ||
| 4 | #include "pacman.pb.h" | ||
| 5 | |||
| 6 | #include <algorithm> | ||
| 7 | |||
| 8 | #include <google/protobuf/stubs/once.h> | ||
| 9 | #include <google/protobuf/io/coded_stream.h> | ||
| 10 | #include <google/protobuf/wire_format_lite_inl.h> | ||
| 11 | #include <google/protobuf/descriptor.h> | ||
| 12 | #include <google/protobuf/reflection_ops.h> | ||
| 13 | #include <google/protobuf/wire_format.h> | ||
| 14 | // @@protoc_insertion_point(includes) | ||
| 15 | |||
| 16 | namespace { | ||
| 17 | |||
| 18 | const ::google::protobuf::Descriptor* KeyPressUpdate_descriptor_ = NULL; | ||
| 19 | const ::google::protobuf::internal::GeneratedMessageReflection* | ||
| 20 | KeyPressUpdate_reflection_ = NULL; | ||
| 21 | const ::google::protobuf::Descriptor* MapUpdate_descriptor_ = NULL; | ||
| 22 | const ::google::protobuf::internal::GeneratedMessageReflection* | ||
| 23 | MapUpdate_reflection_ = NULL; | ||
| 24 | |||
| 25 | } // namespace | ||
| 26 | |||
| 27 | |||
| 28 | void protobuf_AssignDesc_pacman_2eproto() { | ||
| 29 | protobuf_AddDesc_pacman_2eproto(); | ||
| 30 | const ::google::protobuf::FileDescriptor* file = | ||
| 31 | ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( | ||
| 32 | "pacman.proto"); | ||
| 33 | GOOGLE_CHECK(file != NULL); | ||
| 34 | KeyPressUpdate_descriptor_ = file->message_type(0); | ||
| 35 | static const int KeyPressUpdate_offsets_[1] = { | ||
| 36 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(KeyPressUpdate, newkey_), | ||
| 37 | }; | ||
| 38 | KeyPressUpdate_reflection_ = | ||
| 39 | new ::google::protobuf::internal::GeneratedMessageReflection( | ||
| 40 | KeyPressUpdate_descriptor_, | ||
| 41 | KeyPressUpdate::default_instance_, | ||
| 42 | KeyPressUpdate_offsets_, | ||
| 43 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(KeyPressUpdate, _has_bits_[0]), | ||
| 44 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(KeyPressUpdate, _unknown_fields_), | ||
| 45 | -1, | ||
| 46 | ::google::protobuf::DescriptorPool::generated_pool(), | ||
| 47 | ::google::protobuf::MessageFactory::generated_factory(), | ||
| 48 | sizeof(KeyPressUpdate)); | ||
| 49 | MapUpdate_descriptor_ = file->message_type(1); | ||
| 50 | static const int MapUpdate_offsets_[1] = { | ||
| 51 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapUpdate, field_), | ||
| 52 | }; | ||
| 53 | MapUpdate_reflection_ = | ||
| 54 | new ::google::protobuf::internal::GeneratedMessageReflection( | ||
| 55 | MapUpdate_descriptor_, | ||
| 56 | MapUpdate::default_instance_, | ||
| 57 | MapUpdate_offsets_, | ||
| 58 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapUpdate, _has_bits_[0]), | ||
| 59 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapUpdate, _unknown_fields_), | ||
| 60 | -1, | ||
| 61 | ::google::protobuf::DescriptorPool::generated_pool(), | ||
| 62 | ::google::protobuf::MessageFactory::generated_factory(), | ||
| 63 | sizeof(MapUpdate)); | ||
| 64 | } | ||
| 65 | |||
| 66 | namespace { | ||
| 67 | |||
| 68 | GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); | ||
| 69 | inline void protobuf_AssignDescriptorsOnce() { | ||
| 70 | ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, | ||
| 71 | &protobuf_AssignDesc_pacman_2eproto); | ||
| 72 | } | ||
| 73 | |||
| 74 | void protobuf_RegisterTypes(const ::std::string&) { | ||
| 75 | protobuf_AssignDescriptorsOnce(); | ||
| 76 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( | ||
| 77 | KeyPressUpdate_descriptor_, &KeyPressUpdate::default_instance()); | ||
| 78 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( | ||
| 79 | MapUpdate_descriptor_, &MapUpdate::default_instance()); | ||
| 80 | } | ||
| 81 | |||
| 82 | } // namespace | ||
| 83 | |||
| 84 | void protobuf_ShutdownFile_pacman_2eproto() { | ||
| 85 | delete KeyPressUpdate::default_instance_; | ||
| 86 | delete KeyPressUpdate_reflection_; | ||
| 87 | delete MapUpdate::default_instance_; | ||
| 88 | delete MapUpdate_reflection_; | ||
| 89 | } | ||
| 90 | |||
| 91 | void protobuf_AddDesc_pacman_2eproto() { | ||
| 92 | static bool already_here = false; | ||
| 93 | if (already_here) return; | ||
| 94 | already_here = true; | ||
| 95 | GOOGLE_PROTOBUF_VERIFY_VERSION; | ||
| 96 | |||
| 97 | ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( | ||
| 98 | "\n\014pacman.proto\" \n\016KeyPressUpdate\022\016\n\006newK" | ||
| 99 | "ey\030\001 \002(\r\"\036\n\tMapUpdate\022\021\n\005field\030\001 \003(\rB\002\020\001", 80); | ||
| 100 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( | ||
| 101 | "pacman.proto", &protobuf_RegisterTypes); | ||
| 102 | KeyPressUpdate::default_instance_ = new KeyPressUpdate(); | ||
| 103 | MapUpdate::default_instance_ = new MapUpdate(); | ||
| 104 | KeyPressUpdate::default_instance_->InitAsDefaultInstance(); | ||
| 105 | MapUpdate::default_instance_->InitAsDefaultInstance(); | ||
| 106 | ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_pacman_2eproto); | ||
| 107 | } | ||
| 108 | |||
| 109 | // Force AddDescriptors() to be called at static initialization time. | ||
| 110 | struct StaticDescriptorInitializer_pacman_2eproto { | ||
| 111 | StaticDescriptorInitializer_pacman_2eproto() { | ||
| 112 | protobuf_AddDesc_pacman_2eproto(); | ||
| 113 | } | ||
| 114 | } static_descriptor_initializer_pacman_2eproto_; | ||
| 115 | |||
| 116 | |||
| 117 | // =================================================================== | ||
| 118 | |||
| 119 | #ifndef _MSC_VER | ||
| 120 | const int KeyPressUpdate::kNewKeyFieldNumber; | ||
| 121 | #endif // !_MSC_VER | ||
| 122 | |||
| 123 | KeyPressUpdate::KeyPressUpdate() | ||
| 124 | : ::google::protobuf::Message() { | ||
| 125 | SharedCtor(); | ||
| 126 | } | ||
| 127 | |||
| 128 | void KeyPressUpdate::InitAsDefaultInstance() { | ||
| 129 | } | ||
| 130 | |||
| 131 | KeyPressUpdate::KeyPressUpdate(const KeyPressUpdate& from) | ||
| 132 | : ::google::protobuf::Message() { | ||
| 133 | SharedCtor(); | ||
| 134 | MergeFrom(from); | ||
| 135 | } | ||
| 136 | |||
| 137 | void KeyPressUpdate::SharedCtor() { | ||
| 138 | _cached_size_ = 0; | ||
| 139 | newkey_ = 0u; | ||
| 140 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); | ||
| 141 | } | ||
| 142 | |||
| 143 | KeyPressUpdate::~KeyPressUpdate() { | ||
| 144 | SharedDtor(); | ||
| 145 | } | ||
| 146 | |||
| 147 | void KeyPressUpdate::SharedDtor() { | ||
| 148 | if (this != default_instance_) { | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | void KeyPressUpdate::SetCachedSize(int size) const { | ||
| 153 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | ||
| 154 | _cached_size_ = size; | ||
| 155 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); | ||
| 156 | } | ||
| 157 | const ::google::protobuf::Descriptor* KeyPressUpdate::descriptor() { | ||
| 158 | protobuf_AssignDescriptorsOnce(); | ||
| 159 | return KeyPressUpdate_descriptor_; | ||
| 160 | } | ||
| 161 | |||
| 162 | const KeyPressUpdate& KeyPressUpdate::default_instance() { | ||
| 163 | if (default_instance_ == NULL) protobuf_AddDesc_pacman_2eproto(); return *default_instance_; | ||
| 164 | } | ||
| 165 | |||
| 166 | KeyPressUpdate* KeyPressUpdate::default_instance_ = NULL; | ||
| 167 | |||
| 168 | KeyPressUpdate* KeyPressUpdate::New() const { | ||
| 169 | return new KeyPressUpdate; | ||
| 170 | } | ||
| 171 | |||
| 172 | void KeyPressUpdate::Clear() { | ||
| 173 | if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { | ||
| 174 | newkey_ = 0u; | ||
| 175 | } | ||
| 176 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); | ||
| 177 | mutable_unknown_fields()->Clear(); | ||
| 178 | } | ||
| 179 | |||
| 180 | bool KeyPressUpdate::MergePartialFromCodedStream( | ||
| 181 | ::google::protobuf::io::CodedInputStream* input) { | ||
| 182 | #define DO_(EXPRESSION) if (!(EXPRESSION)) return false | ||
| 183 | ::google::protobuf::uint32 tag; | ||
| 184 | while ((tag = input->ReadTag()) != 0) { | ||
| 185 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { | ||
| 186 | // required uint32 newKey = 1; | ||
| 187 | case 1: { | ||
| 188 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | ||
| 189 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { | ||
| 190 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< | ||
| 191 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( | ||
| 192 | input, &newkey_))); | ||
| 193 | set_has_newkey(); | ||
| 194 | } else { | ||
| 195 | goto handle_uninterpreted; | ||
| 196 | } | ||
| 197 | if (input->ExpectAtEnd()) return true; | ||
| 198 | break; | ||
| 199 | } | ||
| 200 | |||
| 201 | default: { | ||
| 202 | handle_uninterpreted: | ||
| 203 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | ||
| 204 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { | ||
| 205 | return true; | ||
| 206 | } | ||
| 207 | DO_(::google::protobuf::internal::WireFormat::SkipField( | ||
| 208 | input, tag, mutable_unknown_fields())); | ||
| 209 | break; | ||
| 210 | } | ||
| 211 | } | ||
| 212 | } | ||
| 213 | return true; | ||
| 214 | #undef DO_ | ||
| 215 | } | ||
| 216 | |||
| 217 | void KeyPressUpdate::SerializeWithCachedSizes( | ||
| 218 | ::google::protobuf::io::CodedOutputStream* output) const { | ||
| 219 | // required uint32 newKey = 1; | ||
| 220 | if (has_newkey()) { | ||
| 221 | ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->newkey(), output); | ||
| 222 | } | ||
| 223 | |||
| 224 | if (!unknown_fields().empty()) { | ||
| 225 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( | ||
| 226 | unknown_fields(), output); | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 230 | ::google::protobuf::uint8* KeyPressUpdate::SerializeWithCachedSizesToArray( | ||
| 231 | ::google::protobuf::uint8* target) const { | ||
| 232 | // required uint32 newKey = 1; | ||
| 233 | if (has_newkey()) { | ||
| 234 | target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->newkey(), target); | ||
| 235 | } | ||
| 236 | |||
| 237 | if (!unknown_fields().empty()) { | ||
| 238 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( | ||
| 239 | unknown_fields(), target); | ||
| 240 | } | ||
| 241 | return target; | ||
| 242 | } | ||
| 243 | |||
| 244 | int KeyPressUpdate::ByteSize() const { | ||
| 245 | int total_size = 0; | ||
| 246 | |||
| 247 | if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { | ||
| 248 | // required uint32 newKey = 1; | ||
| 249 | if (has_newkey()) { | ||
| 250 | total_size += 1 + | ||
| 251 | ::google::protobuf::internal::WireFormatLite::UInt32Size( | ||
| 252 | this->newkey()); | ||
| 253 | } | ||
| 254 | |||
| 255 | } | ||
| 256 | if (!unknown_fields().empty()) { | ||
| 257 | total_size += | ||
| 258 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( | ||
| 259 | unknown_fields()); | ||
| 260 | } | ||
| 261 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | ||
| 262 | _cached_size_ = total_size; | ||
| 263 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); | ||
| 264 | return total_size; | ||
| 265 | } | ||
| 266 | |||
| 267 | void KeyPressUpdate::MergeFrom(const ::google::protobuf::Message& from) { | ||
| 268 | GOOGLE_CHECK_NE(&from, this); | ||
| 269 | const KeyPressUpdate* source = | ||
| 270 | ::google::protobuf::internal::dynamic_cast_if_available<const KeyPressUpdate*>( | ||
| 271 | &from); | ||
| 272 | if (source == NULL) { | ||
| 273 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); | ||
| 274 | } else { | ||
| 275 | MergeFrom(*source); | ||
| 276 | } | ||
| 277 | } | ||
| 278 | |||
| 279 | void KeyPressUpdate::MergeFrom(const KeyPressUpdate& from) { | ||
| 280 | GOOGLE_CHECK_NE(&from, this); | ||
| 281 | if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { | ||
| 282 | if (from.has_newkey()) { | ||
| 283 | set_newkey(from.newkey()); | ||
| 284 | } | ||
| 285 | } | ||
| 286 | mutable_unknown_fields()->MergeFrom(from.unknown_fields()); | ||
| 287 | } | ||
| 288 | |||
| 289 | void KeyPressUpdate::CopyFrom(const ::google::protobuf::Message& from) { | ||
| 290 | if (&from == this) return; | ||
| 291 | Clear(); | ||
| 292 | MergeFrom(from); | ||
| 293 | } | ||
| 294 | |||
| 295 | void KeyPressUpdate::CopyFrom(const KeyPressUpdate& from) { | ||
| 296 | if (&from == this) return; | ||
| 297 | Clear(); | ||
| 298 | MergeFrom(from); | ||
| 299 | } | ||
| 300 | |||
| 301 | bool KeyPressUpdate::IsInitialized() const { | ||
| 302 | if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; | ||
| 303 | |||
| 304 | return true; | ||
| 305 | } | ||
| 306 | |||
| 307 | void KeyPressUpdate::Swap(KeyPressUpdate* other) { | ||
| 308 | if (other != this) { | ||
| 309 | std::swap(newkey_, other->newkey_); | ||
| 310 | std::swap(_has_bits_[0], other->_has_bits_[0]); | ||
| 311 | _unknown_fields_.Swap(&other->_unknown_fields_); | ||
| 312 | std::swap(_cached_size_, other->_cached_size_); | ||
| 313 | } | ||
| 314 | } | ||
| 315 | |||
| 316 | ::google::protobuf::Metadata KeyPressUpdate::GetMetadata() const { | ||
| 317 | protobuf_AssignDescriptorsOnce(); | ||
| 318 | ::google::protobuf::Metadata metadata; | ||
| 319 | metadata.descriptor = KeyPressUpdate_descriptor_; | ||
| 320 | metadata.reflection = KeyPressUpdate_reflection_; | ||
| 321 | return metadata; | ||
| 322 | } | ||
| 323 | |||
| 324 | |||
| 325 | // =================================================================== | ||
| 326 | |||
| 327 | #ifndef _MSC_VER | ||
| 328 | const int MapUpdate::kFieldFieldNumber; | ||
| 329 | #endif // !_MSC_VER | ||
| 330 | |||
| 331 | MapUpdate::MapUpdate() | ||
| 332 | : ::google::protobuf::Message() { | ||
| 333 | SharedCtor(); | ||
| 334 | } | ||
| 335 | |||
| 336 | void MapUpdate::InitAsDefaultInstance() { | ||
| 337 | } | ||
| 338 | |||
| 339 | MapUpdate::MapUpdate(const MapUpdate& from) | ||
| 340 | : ::google::protobuf::Message() { | ||
| 341 | SharedCtor(); | ||
| 342 | MergeFrom(from); | ||
| 343 | } | ||
| 344 | |||
| 345 | void MapUpdate::SharedCtor() { | ||
| 346 | _cached_size_ = 0; | ||
| 347 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); | ||
| 348 | } | ||
| 349 | |||
| 350 | MapUpdate::~MapUpdate() { | ||
| 351 | SharedDtor(); | ||
| 352 | } | ||
| 353 | |||
| 354 | void MapUpdate::SharedDtor() { | ||
| 355 | if (this != default_instance_) { | ||
| 356 | } | ||
| 357 | } | ||
| 358 | |||
| 359 | void MapUpdate::SetCachedSize(int size) const { | ||
| 360 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | ||
| 361 | _cached_size_ = size; | ||
| 362 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); | ||
| 363 | } | ||
| 364 | const ::google::protobuf::Descriptor* MapUpdate::descriptor() { | ||
| 365 | protobuf_AssignDescriptorsOnce(); | ||
| 366 | return MapUpdate_descriptor_; | ||
| 367 | } | ||
| 368 | |||
| 369 | const MapUpdate& MapUpdate::default_instance() { | ||
| 370 | if (default_instance_ == NULL) protobuf_AddDesc_pacman_2eproto(); return *default_instance_; | ||
| 371 | } | ||
| 372 | |||
| 373 | MapUpdate* MapUpdate::default_instance_ = NULL; | ||
| 374 | |||
| 375 | MapUpdate* MapUpdate::New() const { | ||
| 376 | return new MapUpdate; | ||
| 377 | } | ||
| 378 | |||
| 379 | void MapUpdate::Clear() { | ||
| 380 | field_.Clear(); | ||
| 381 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); | ||
| 382 | mutable_unknown_fields()->Clear(); | ||
| 383 | } | ||
| 384 | |||
| 385 | bool MapUpdate::MergePartialFromCodedStream( | ||
| 386 | ::google::protobuf::io::CodedInputStream* input) { | ||
| 387 | #define DO_(EXPRESSION) if (!(EXPRESSION)) return false | ||
| 388 | ::google::protobuf::uint32 tag; | ||
| 389 | while ((tag = input->ReadTag()) != 0) { | ||
| 390 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { | ||
| 391 | // repeated uint32 field = 1 [packed = true]; | ||
| 392 | case 1: { | ||
| 393 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | ||
| 394 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | ||
| 395 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | ||
| 396 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( | ||
| 397 | input, this->mutable_field()))); | ||
| 398 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | ||
| 399 | == ::google::protobuf::internal::WireFormatLite:: | ||
| 400 | WIRETYPE_VARINT) { | ||
| 401 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | ||
| 402 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( | ||
| 403 | 1, 10, input, this->mutable_field()))); | ||
| 404 | } else { | ||
| 405 | goto handle_uninterpreted; | ||
| 406 | } | ||
| 407 | if (input->ExpectAtEnd()) return true; | ||
| 408 | break; | ||
| 409 | } | ||
| 410 | |||
| 411 | default: { | ||
| 412 | handle_uninterpreted: | ||
| 413 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | ||
| 414 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { | ||
| 415 | return true; | ||
| 416 | } | ||
| 417 | DO_(::google::protobuf::internal::WireFormat::SkipField( | ||
| 418 | input, tag, mutable_unknown_fields())); | ||
| 419 | break; | ||
| 420 | } | ||
| 421 | } | ||
| 422 | } | ||
| 423 | return true; | ||
| 424 | #undef DO_ | ||
| 425 | } | ||
| 426 | |||
| 427 | void MapUpdate::SerializeWithCachedSizes( | ||
| 428 | ::google::protobuf::io::CodedOutputStream* output) const { | ||
| 429 | // repeated uint32 field = 1 [packed = true]; | ||
| 430 | if (this->field_size() > 0) { | ||
| 431 | ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | ||
| 432 | output->WriteVarint32(_field_cached_byte_size_); | ||
| 433 | } | ||
| 434 | for (int i = 0; i < this->field_size(); i++) { | ||
| 435 | ::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag( | ||
| 436 | this->field(i), output); | ||
| 437 | } | ||
| 438 | |||
| 439 | if (!unknown_fields().empty()) { | ||
| 440 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( | ||
| 441 | unknown_fields(), output); | ||
| 442 | } | ||
| 443 | } | ||
| 444 | |||
| 445 | ::google::protobuf::uint8* MapUpdate::SerializeWithCachedSizesToArray( | ||
| 446 | ::google::protobuf::uint8* target) const { | ||
| 447 | // repeated uint32 field = 1 [packed = true]; | ||
| 448 | if (this->field_size() > 0) { | ||
| 449 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | ||
| 450 | 1, | ||
| 451 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | ||
| 452 | target); | ||
| 453 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | ||
| 454 | _field_cached_byte_size_, target); | ||
| 455 | } | ||
| 456 | for (int i = 0; i < this->field_size(); i++) { | ||
| 457 | target = ::google::protobuf::internal::WireFormatLite:: | ||
| 458 | WriteUInt32NoTagToArray(this->field(i), target); | ||
| 459 | } | ||
| 460 | |||
| 461 | if (!unknown_fields().empty()) { | ||
| 462 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( | ||
| 463 | unknown_fields(), target); | ||
| 464 | } | ||
| 465 | return target; | ||
| 466 | } | ||
| 467 | |||
| 468 | int MapUpdate::ByteSize() const { | ||
| 469 | int total_size = 0; | ||
| 470 | |||
| 471 | // repeated uint32 field = 1 [packed = true]; | ||
| 472 | { | ||
| 473 | int data_size = 0; | ||
| 474 | for (int i = 0; i < this->field_size(); i++) { | ||
| 475 | data_size += ::google::protobuf::internal::WireFormatLite:: | ||
| 476 | UInt32Size(this->field(i)); | ||
| 477 | } | ||
| 478 | if (data_size > 0) { | ||
| 479 | total_size += 1 + | ||
| 480 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | ||
| 481 | } | ||
| 482 | _field_cached_byte_size_ = data_size; | ||
| 483 | total_size += data_size; | ||
| 484 | } | ||
| 485 | |||
| 486 | if (!unknown_fields().empty()) { | ||
| 487 | total_size += | ||
| 488 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( | ||
| 489 | unknown_fields()); | ||
| 490 | } | ||
| 491 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | ||
| 492 | _cached_size_ = total_size; | ||
| 493 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); | ||
| 494 | return total_size; | ||
| 495 | } | ||
| 496 | |||
| 497 | void MapUpdate::MergeFrom(const ::google::protobuf::Message& from) { | ||
| 498 | GOOGLE_CHECK_NE(&from, this); | ||
| 499 | const MapUpdate* source = | ||
| 500 | ::google::protobuf::internal::dynamic_cast_if_available<const MapUpdate*>( | ||
| 501 | &from); | ||
| 502 | if (source == NULL) { | ||
| 503 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); | ||
| 504 | } else { | ||
| 505 | MergeFrom(*source); | ||
| 506 | } | ||
| 507 | } | ||
| 508 | |||
| 509 | void MapUpdate::MergeFrom(const MapUpdate& from) { | ||
| 510 | GOOGLE_CHECK_NE(&from, this); | ||
| 511 | field_.MergeFrom(from.field_); | ||
| 512 | mutable_unknown_fields()->MergeFrom(from.unknown_fields()); | ||
| 513 | } | ||
| 514 | |||
| 515 | void MapUpdate::CopyFrom(const ::google::protobuf::Message& from) { | ||
| 516 | if (&from == this) return; | ||
| 517 | Clear(); | ||
| 518 | MergeFrom(from); | ||
| 519 | } | ||
| 520 | |||
| 521 | void MapUpdate::CopyFrom(const MapUpdate& from) { | ||
| 522 | if (&from == this) return; | ||
| 523 | Clear(); | ||
| 524 | MergeFrom(from); | ||
| 525 | } | ||
| 526 | |||
| 527 | bool MapUpdate::IsInitialized() const { | ||
| 528 | |||
| 529 | return true; | ||
| 530 | } | ||
| 531 | |||
| 532 | void MapUpdate::Swap(MapUpdate* other) { | ||
| 533 | if (other != this) { | ||
| 534 | field_.Swap(&other->field_); | ||
| 535 | std::swap(_has_bits_[0], other->_has_bits_[0]); | ||
| 536 | _unknown_fields_.Swap(&other->_unknown_fields_); | ||
| 537 | std::swap(_cached_size_, other->_cached_size_); | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | ::google::protobuf::Metadata MapUpdate::GetMetadata() const { | ||
| 542 | protobuf_AssignDescriptorsOnce(); | ||
| 543 | ::google::protobuf::Metadata metadata; | ||
| 544 | metadata.descriptor = MapUpdate_descriptor_; | ||
| 545 | metadata.reflection = MapUpdate_reflection_; | ||
| 546 | return metadata; | ||
| 547 | } | ||
| 548 | |||
| 549 | |||
| 550 | // @@protoc_insertion_point(namespace_scope) | ||
| 551 | |||
| 552 | // @@protoc_insertion_point(global_scope) | ||
diff --git a/pacman-c++/pacman.pb.h b/pacman-c++/pacman.pb.h new file mode 100644 index 0000000..6f94834 --- /dev/null +++ b/pacman-c++/pacman.pb.h | |||
| @@ -0,0 +1,276 @@ | |||
| 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! | ||
| 2 | // source: pacman.proto | ||
| 3 | |||
| 4 | #ifndef PROTOBUF_pacman_2eproto__INCLUDED | ||
| 5 | #define PROTOBUF_pacman_2eproto__INCLUDED | ||
| 6 | |||
| 7 | #include <string> | ||
| 8 | |||
| 9 | #include <google/protobuf/stubs/common.h> | ||
| 10 | |||
| 11 | #if GOOGLE_PROTOBUF_VERSION < 2004000 | ||
| 12 | #error This file was generated by a newer version of protoc which is | ||
| 13 | #error incompatible with your Protocol Buffer headers. Please update | ||
| 14 | #error your headers. | ||
| 15 | #endif | ||
| 16 | #if 2004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION | ||
| 17 | #error This file was generated by an older version of protoc which is | ||
| 18 | #error incompatible with your Protocol Buffer headers. Please | ||
| 19 | #error regenerate this file with a newer version of protoc. | ||
| 20 | #endif | ||
| 21 | |||
| 22 | #include <google/protobuf/generated_message_util.h> | ||
| 23 | #include <google/protobuf/repeated_field.h> | ||
| 24 | #include <google/protobuf/extension_set.h> | ||
| 25 | #include <google/protobuf/generated_message_reflection.h> | ||
| 26 | // @@protoc_insertion_point(includes) | ||
| 27 | |||
| 28 | // Internal implementation detail -- do not call these. | ||
| 29 | void protobuf_AddDesc_pacman_2eproto(); | ||
| 30 | void protobuf_AssignDesc_pacman_2eproto(); | ||
| 31 | void protobuf_ShutdownFile_pacman_2eproto(); | ||
| 32 | |||
| 33 | class KeyPressUpdate; | ||
| 34 | class MapUpdate; | ||
| 35 | |||
| 36 | // =================================================================== | ||
| 37 | |||
| 38 | class KeyPressUpdate : public ::google::protobuf::Message { | ||
| 39 | public: | ||
| 40 | KeyPressUpdate(); | ||
| 41 | virtual ~KeyPressUpdate(); | ||
| 42 | |||
| 43 | KeyPressUpdate(const KeyPressUpdate& from); | ||
| 44 | |||
| 45 | inline KeyPressUpdate& operator=(const KeyPressUpdate& from) { | ||
| 46 | CopyFrom(from); | ||
| 47 | return *this; | ||
| 48 | } | ||
| 49 | |||
| 50 | inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { | ||
| 51 | return _unknown_fields_; | ||
| 52 | } | ||
| 53 | |||
| 54 | inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { | ||
| 55 | return &_unknown_fields_; | ||
| 56 | } | ||
| 57 | |||
| 58 | static const ::google::protobuf::Descriptor* descriptor(); | ||
| 59 | static const KeyPressUpdate& default_instance(); | ||
| 60 | |||
| 61 | void Swap(KeyPressUpdate* other); | ||
| 62 | |||
| 63 | // implements Message ---------------------------------------------- | ||
| 64 | |||
| 65 | KeyPressUpdate* New() const; | ||
| 66 | void CopyFrom(const ::google::protobuf::Message& from); | ||
| 67 | void MergeFrom(const ::google::protobuf::Message& from); | ||
| 68 | void CopyFrom(const KeyPressUpdate& from); | ||
| 69 | void MergeFrom(const KeyPressUpdate& from); | ||
| 70 | void Clear(); | ||
| 71 | bool IsInitialized() const; | ||
| 72 | |||
| 73 | int ByteSize() const; | ||
| 74 | bool MergePartialFromCodedStream( | ||
| 75 | ::google::protobuf::io::CodedInputStream* input); | ||
| 76 | void SerializeWithCachedSizes( | ||
| 77 | ::google::protobuf::io::CodedOutputStream* output) const; | ||
| 78 | ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; | ||
| 79 | int GetCachedSize() const { return _cached_size_; } | ||
| 80 | private: | ||
| 81 | void SharedCtor(); | ||
| 82 | void SharedDtor(); | ||
| 83 | void SetCachedSize(int size) const; | ||
| 84 | public: | ||
| 85 | |||
| 86 | ::google::protobuf::Metadata GetMetadata() const; | ||
| 87 | |||
| 88 | // nested types ---------------------------------------------------- | ||
| 89 | |||
| 90 | // accessors ------------------------------------------------------- | ||
| 91 | |||
| 92 | // required uint32 newKey = 1; | ||
| 93 | inline bool has_newkey() const; | ||
| 94 | inline void clear_newkey(); | ||
| 95 | static const int kNewKeyFieldNumber = 1; | ||
| 96 | inline ::google::protobuf::uint32 newkey() const; | ||
| 97 | inline void set_newkey(::google::protobuf::uint32 value); | ||
| 98 | |||
| 99 | // @@protoc_insertion_point(class_scope:KeyPressUpdate) | ||
| 100 | private: | ||
| 101 | inline void set_has_newkey(); | ||
| 102 | inline void clear_has_newkey(); | ||
| 103 | |||
| 104 | ::google::protobuf::UnknownFieldSet _unknown_fields_; | ||
| 105 | |||
| 106 | ::google::protobuf::uint32 newkey_; | ||
| 107 | |||
| 108 | mutable int _cached_size_; | ||
| 109 | ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; | ||
| 110 | |||
| 111 | friend void protobuf_AddDesc_pacman_2eproto(); | ||
| 112 | friend void protobuf_AssignDesc_pacman_2eproto(); | ||
| 113 | friend void protobuf_ShutdownFile_pacman_2eproto(); | ||
| 114 | |||
| 115 | void InitAsDefaultInstance(); | ||
| 116 | static KeyPressUpdate* default_instance_; | ||
| 117 | }; | ||
| 118 | // ------------------------------------------------------------------- | ||
| 119 | |||
| 120 | class MapUpdate : public ::google::protobuf::Message { | ||
| 121 | public: | ||
| 122 | MapUpdate(); | ||
| 123 | virtual ~MapUpdate(); | ||
| 124 | |||
| 125 | MapUpdate(const MapUpdate& from); | ||
| 126 | |||
| 127 | inline MapUpdate& operator=(const MapUpdate& from) { | ||
| 128 | CopyFrom(from); | ||
| 129 | return *this; | ||
| 130 | } | ||
| 131 | |||
| 132 | inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { | ||
| 133 | return _unknown_fields_; | ||
| 134 | } | ||
| 135 | |||
| 136 | inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { | ||
| 137 | return &_unknown_fields_; | ||
| 138 | } | ||
| 139 | |||
| 140 | static const ::google::protobuf::Descriptor* descriptor(); | ||
| 141 | static const MapUpdate& default_instance(); | ||
| 142 | |||
| 143 | void Swap(MapUpdate* other); | ||
| 144 | |||
| 145 | // implements Message ---------------------------------------------- | ||
| 146 | |||
| 147 | MapUpdate* New() const; | ||
| 148 | void CopyFrom(const ::google::protobuf::Message& from); | ||
| 149 | void MergeFrom(const ::google::protobuf::Message& from); | ||
| 150 | void CopyFrom(const MapUpdate& from); | ||
| 151 | void MergeFrom(const MapUpdate& from); | ||
| 152 | void Clear(); | ||
| 153 | bool IsInitialized() const; | ||
| 154 | |||
| 155 | int ByteSize() const; | ||
| 156 | bool MergePartialFromCodedStream( | ||
| 157 | ::google::protobuf::io::CodedInputStream* input); | ||
| 158 | void SerializeWithCachedSizes( | ||
| 159 | ::google::protobuf::io::CodedOutputStream* output) const; | ||
| 160 | ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; | ||
| 161 | int GetCachedSize() const { return _cached_size_; } | ||
| 162 | private: | ||
| 163 | void SharedCtor(); | ||
| 164 | void SharedDtor(); | ||
| 165 | void SetCachedSize(int size) const; | ||
| 166 | public: | ||
| 167 | |||
| 168 | ::google::protobuf::Metadata GetMetadata() const; | ||
| 169 | |||
| 170 | // nested types ---------------------------------------------------- | ||
| 171 | |||
| 172 | // accessors ------------------------------------------------------- | ||
| 173 | |||
| 174 | // repeated uint32 field = 1 [packed = true]; | ||
| 175 | inline int field_size() const; | ||
| 176 | inline void clear_field(); | ||
| 177 | static const int kFieldFieldNumber = 1; | ||
| 178 | inline ::google::protobuf::uint32 field(int index) const; | ||
| 179 | inline void set_field(int index, ::google::protobuf::uint32 value); | ||
| 180 | inline void add_field(::google::protobuf::uint32 value); | ||
| 181 | inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& | ||
| 182 | field() const; | ||
| 183 | inline ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* | ||
| 184 | mutable_field(); | ||
| 185 | |||
| 186 | // @@protoc_insertion_point(class_scope:MapUpdate) | ||
| 187 | private: | ||
| 188 | |||
| 189 | ::google::protobuf::UnknownFieldSet _unknown_fields_; | ||
| 190 | |||
| 191 | ::google::protobuf::RepeatedField< ::google::protobuf::uint32 > field_; | ||
| 192 | mutable int _field_cached_byte_size_; | ||
| 193 | |||
| 194 | mutable int _cached_size_; | ||
| 195 | ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; | ||
| 196 | |||
| 197 | friend void protobuf_AddDesc_pacman_2eproto(); | ||
| 198 | friend void protobuf_AssignDesc_pacman_2eproto(); | ||
| 199 | friend void protobuf_ShutdownFile_pacman_2eproto(); | ||
| 200 | |||
| 201 | void InitAsDefaultInstance(); | ||
| 202 | static MapUpdate* default_instance_; | ||
| 203 | }; | ||
| 204 | // =================================================================== | ||
| 205 | |||
| 206 | |||
| 207 | // =================================================================== | ||
| 208 | |||
| 209 | // KeyPressUpdate | ||
| 210 | |||
| 211 | // required uint32 newKey = 1; | ||
| 212 | inline bool KeyPressUpdate::has_newkey() const { | ||
| 213 | return (_has_bits_[0] & 0x00000001u) != 0; | ||
| 214 | } | ||
| 215 | inline void KeyPressUpdate::set_has_newkey() { | ||
| 216 | _has_bits_[0] |= 0x00000001u; | ||
| 217 | } | ||
| 218 | inline void KeyPressUpdate::clear_has_newkey() { | ||
| 219 | _has_bits_[0] &= ~0x00000001u; | ||
| 220 | } | ||
| 221 | inline void KeyPressUpdate::clear_newkey() { | ||
| 222 | newkey_ = 0u; | ||
| 223 | clear_has_newkey(); | ||
| 224 | } | ||
| 225 | inline ::google::protobuf::uint32 KeyPressUpdate::newkey() const { | ||
| 226 | return newkey_; | ||
| 227 | } | ||
| 228 | inline void KeyPressUpdate::set_newkey(::google::protobuf::uint32 value) { | ||
| 229 | set_has_newkey(); | ||
| 230 | newkey_ = value; | ||
| 231 | } | ||
| 232 | |||
| 233 | // ------------------------------------------------------------------- | ||
| 234 | |||
| 235 | // MapUpdate | ||
| 236 | |||
| 237 | // repeated uint32 field = 1 [packed = true]; | ||
| 238 | inline int MapUpdate::field_size() const { | ||
| 239 | return field_.size(); | ||
| 240 | } | ||
| 241 | inline void MapUpdate::clear_field() { | ||
| 242 | field_.Clear(); | ||
| 243 | } | ||
| 244 | inline ::google::protobuf::uint32 MapUpdate::field(int index) const { | ||
| 245 | return field_.Get(index); | ||
| 246 | } | ||
| 247 | inline void MapUpdate::set_field(int index, ::google::protobuf::uint32 value) { | ||
| 248 | field_.Set(index, value); | ||
| 249 | } | ||
| 250 | inline void MapUpdate::add_field(::google::protobuf::uint32 value) { | ||
| 251 | field_.Add(value); | ||
| 252 | } | ||
| 253 | inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& | ||
| 254 | MapUpdate::field() const { | ||
| 255 | return field_; | ||
| 256 | } | ||
| 257 | inline ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* | ||
| 258 | MapUpdate::mutable_field() { | ||
| 259 | return &field_; | ||
| 260 | } | ||
| 261 | |||
| 262 | |||
| 263 | // @@protoc_insertion_point(namespace_scope) | ||
| 264 | |||
| 265 | #ifndef SWIG | ||
| 266 | namespace google { | ||
| 267 | namespace protobuf { | ||
| 268 | |||
| 269 | |||
| 270 | } // namespace google | ||
| 271 | } // namespace protobuf | ||
| 272 | #endif // SWIG | ||
| 273 | |||
| 274 | // @@protoc_insertion_point(global_scope) | ||
| 275 | |||
| 276 | #endif // PROTOBUF_pacman_2eproto__INCLUDED | ||
diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro index dd08568..32f2151 100644 --- a/pacman-c++/pacman.pro +++ b/pacman-c++/pacman.pro | |||
| @@ -10,7 +10,8 @@ SOURCES += pixmapitem.cpp \ | |||
| 10 | audioplayer.cpp \ | 10 | audioplayer.cpp \ |
| 11 | clicklabel.cpp \ | 11 | clicklabel.cpp \ |
| 12 | sceneholder.cpp \ | 12 | sceneholder.cpp \ |
| 13 | util.cpp | 13 | util.cpp \ |
| 14 | pacman.pb.cc | ||
| 14 | HEADERS += pixmapitem.h \ | 15 | HEADERS += pixmapitem.h \ |
| 15 | actor.h \ | 16 | actor.h \ |
| 16 | animationmanager.h \ | 17 | animationmanager.h \ |
| @@ -23,7 +24,8 @@ HEADERS += pixmapitem.h \ | |||
| 23 | audioplayer.h \ | 24 | audioplayer.h \ |
| 24 | clicklabel.h \ | 25 | clicklabel.h \ |
| 25 | sceneholder.h \ | 26 | sceneholder.h \ |
| 26 | util.h | 27 | util.h \ |
| 28 | pacman.pb.h | ||
| 27 | RESOURCES += pacman.qrc | 29 | RESOURCES += pacman.qrc |
| 28 | 30 | ||
| 29 | OBJECTS_DIR = .obj | 31 | OBJECTS_DIR = .obj |
| @@ -33,3 +35,6 @@ RC_FILE = pacman.rc | |||
| 33 | OTHER_FILES += \ | 35 | OTHER_FILES += \ |
| 34 | style.qss \ | 36 | style.qss \ |
| 35 | pacman.rc | 37 | pacman.rc |
| 38 | |||
| 39 | LIBS += -lprotobuf | ||
| 40 | |||
diff --git a/pacman-c++/pacman.proto b/pacman-c++/pacman.proto new file mode 100644 index 0000000..39c68f7 --- /dev/null +++ b/pacman-c++/pacman.proto | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | message KeyPressUpdate { | ||
| 2 | required uint32 newKey = 1; | ||
| 3 | } | ||
| 4 | |||
| 5 | message MapUpdate { | ||
| 6 | repeated uint32 field = 1 [packed=true]; | ||
| 7 | } | ||
diff --git a/pacman-c++/pacman.server.pro b/pacman-c++/pacman.server.pro index c7ca9aa..5a31ffe 100644 --- a/pacman-c++/pacman.server.pro +++ b/pacman-c++/pacman.server.pro | |||
| @@ -10,7 +10,8 @@ SOURCES += pixmapitem.cpp \ | |||
| 10 | audioplayer.cpp \ | 10 | audioplayer.cpp \ |
| 11 | sceneholder.cpp \ | 11 | sceneholder.cpp \ |
| 12 | util.cpp \ | 12 | util.cpp \ |
| 13 | clicklabel.cpp | 13 | clicklabel.cpp \ |
| 14 | pacman.pb.cc | ||
| 14 | HEADERS += pixmapitem.h \ | 15 | HEADERS += pixmapitem.h \ |
| 15 | actor.h \ | 16 | actor.h \ |
| 16 | animationmanager.h \ | 17 | animationmanager.h \ |
| @@ -23,7 +24,8 @@ HEADERS += pixmapitem.h \ | |||
| 23 | audioplayer.h \ | 24 | audioplayer.h \ |
| 24 | sceneholder.h \ | 25 | sceneholder.h \ |
| 25 | util.h \ | 26 | util.h \ |
| 26 | clicklabel.h | 27 | clicklabel.h \ |
| 28 | pacman.pb.h | ||
| 27 | HEADERS += pixmapitem.h \ | 29 | HEADERS += pixmapitem.h \ |
| 28 | RESOURCES += pacman.qrc | 30 | RESOURCES += pacman.qrc |
| 29 | 31 | ||
| @@ -36,3 +38,6 @@ OTHER_FILES += \ | |||
| 36 | pacman.rc | 38 | pacman.rc |
| 37 | 39 | ||
| 38 | DEFINES += SERVER | 40 | DEFINES += SERVER |
| 41 | |||
| 42 | LIBS += -lprotobuf | ||
| 43 | |||
diff --git a/pacman-c++/sceneholder.cpp b/pacman-c++/sceneholder.cpp index dbc3ca5..0cb7d15 100644 --- a/pacman-c++/sceneholder.cpp +++ b/pacman-c++/sceneholder.cpp | |||
| @@ -34,7 +34,7 @@ void SceneHolder::updateMap(const Transmission::map_t& map) | |||
| 34 | //qDebug() << "col=" << color; | 34 | //qDebug() << "col=" << color; |
| 35 | 35 | ||
| 36 | PixmapItem* item = NULL; | 36 | PixmapItem* item = NULL; |
| 37 | if (cur == 0) { // no update | 37 | if (cur == Transmission::none) { // no update |
| 38 | } else if (cur & Transmission::empty) { | 38 | } else if (cur & Transmission::empty) { |
| 39 | PixmapItem* oldItem = visualMap[x][y]; | 39 | PixmapItem* oldItem = visualMap[x][y]; |
| 40 | // remove elements (in case it's not an actor) | 40 | // remove elements (in case it's not an actor) |
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index be24da0..8539410 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | #include "util.h" | 3 | #include "util.h" |
| 4 | 4 | ||
| 5 | #include "pacman.pb.h" | ||
| 6 | |||
| 5 | Server::Server(QWidget *parent) | 7 | Server::Server(QWidget *parent) |
| 6 | : SceneHolder(parent) | 8 | : SceneHolder(parent) |
| 7 | { | 9 | { |
| @@ -46,7 +48,6 @@ Transmission::map_t Server::calculateUpdates() | |||
| 46 | map[newMapPosition.x()][newMapPosition.y()] = | 48 | map[newMapPosition.x()][newMapPosition.y()] = |
| 47 | Transmission::pacman | i.key() | | 49 | Transmission::pacman | i.key() | |
| 48 | Util::actorMovementToTransmission(i.value()) ; | 50 | Util::actorMovementToTransmission(i.value()) ; |
| 49 | |||
| 50 | } | 51 | } |
| 51 | return map; | 52 | return map; |
| 52 | } | 53 | } |
