Commit d660c9f1 authored by Corentin Bocquillon's avatar Corentin Bocquillon

Protobuf

parent 39b612f2
File mode changed from 100644 to 100755
......@@ -76,11 +76,7 @@ main (int argc, char *argv[])
print_help ();
exit (EXIT_SUCCESS);
break;
// L’option pour spécifier l’IP du serveur auquel on veut se
// connecter.
// case 's':
// IP = optarg;
// break;
case 'v':
print_version ();
exit(EXIT_SUCCESS);
......@@ -98,12 +94,11 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
if (run_gui () != 0)
{
return 1;
}
return 0;
int r = run_gui ();
if (r != 0)
return 1;
else
return 0;
}
static void
......
This diff is collapsed.
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: player-data.proto
// source: src/player-data.proto
#ifndef PROTOBUF_player_2ddata_2eproto__INCLUDED
#define PROTOBUF_player_2ddata_2eproto__INCLUDED
#ifndef PROTOBUF_INCLUDED_src_2fplayer_2ddata_2eproto
#define PROTOBUF_INCLUDED_src_2fplayer_2ddata_2eproto
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000
#if GOOGLE_PROTOBUF_VERSION < 3006001
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#if 3006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
......@@ -24,14 +24,16 @@
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
#define PROTOBUF_INTERNAL_EXPORT_protobuf_src_2fplayer_2ddata_2eproto
namespace protobuf_player_2ddata_2eproto {
namespace protobuf_src_2fplayer_2ddata_2eproto {
// Internal implementation detail -- do not use these members.
struct TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
......@@ -42,15 +44,15 @@ struct TableStruct {
static const ::google::protobuf::uint32 offsets[];
};
void AddDescriptors();
void InitDefaultsplayer_dataImpl();
void InitDefaultsplayer_data();
inline void InitDefaults() {
InitDefaultsplayer_data();
}
} // namespace protobuf_player_2ddata_2eproto
} // namespace protobuf_src_2fplayer_2ddata_2eproto
class player_data;
class player_dataDefaultTypeInternal;
extern player_dataDefaultTypeInternal _player_data_default_instance_;
namespace google {
namespace protobuf {
template<> ::player_data* Arena::CreateMaybeMessage<::player_data>(Arena*);
} // namespace protobuf
} // namespace google
// ===================================================================
......@@ -95,7 +97,7 @@ class player_data : public ::google::protobuf::Message /* @@protoc_insertion_poi
return reinterpret_cast<const player_data*>(
&_player_data_default_instance_);
}
static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
static constexpr int kIndexInFileMessages =
0;
void Swap(player_data* other);
......@@ -105,28 +107,33 @@ class player_data : public ::google::protobuf::Message /* @@protoc_insertion_poi
// implements Message ----------------------------------------------
inline player_data* New() const PROTOBUF_FINAL { return New(NULL); }
inline player_data* New() const final {
return CreateMaybeMessage<player_data>(NULL);
}
player_data* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
player_data* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<player_data>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const player_data& from);
void MergeFrom(const player_data& from);
void Clear() PROTOBUF_FINAL;
bool IsInitialized() const PROTOBUF_FINAL;
void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const PROTOBUF_FINAL;
size_t ByteSizeLong() const final;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
::google::protobuf::io::CodedInputStream* input) final;
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
bool deterministic, ::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const PROTOBUF_FINAL;
void SetCachedSize(int size) const final;
void InternalSwap(player_data* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
......@@ -137,7 +144,7 @@ class player_data : public ::google::protobuf::Message /* @@protoc_insertion_poi
}
public:
::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
......@@ -261,7 +268,7 @@ class player_data : public ::google::protobuf::Message /* @@protoc_insertion_poi
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::internal::HasBits<1> _has_bits_;
mutable int _cached_size_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > inventory_item_id_;
mutable int _inventory_item_id_cached_byte_size_;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > inventory_number_;
......@@ -276,8 +283,7 @@ class player_data : public ::google::protobuf::Message /* @@protoc_insertion_poi
::google::protobuf::int32 velocity_;
::google::protobuf::int64 y_;
::google::protobuf::int32 selected_tool_;
friend struct ::protobuf_player_2ddata_2eproto::TableStruct;
friend void ::protobuf_player_2ddata_2eproto::InitDefaultsplayer_dataImpl();
friend struct ::protobuf_src_2fplayer_2ddata_2eproto::TableStruct;
};
// ===================================================================
......@@ -340,8 +346,11 @@ inline ::std::string* player_data::mutable_name() {
}
inline ::std::string* player_data::release_name() {
// @@protoc_insertion_point(field_release:player_data.name)
if (!has_name()) {
return NULL;
}
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
return name_.ReleaseNonDefaultNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void player_data::set_allocated_name(::std::string* name) {
if (name != NULL) {
......@@ -602,4 +611,4 @@ inline void player_data::set_selected_tool(::google::protobuf::int32 value) {
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_player_2ddata_2eproto__INCLUDED
#endif // PROTOBUF_INCLUDED_src_2fplayer_2ddata_2eproto
......@@ -162,13 +162,17 @@ Game::run ()
m_window.setKeyRepeatEnabled (false);
display_a_frame ();
int r = 1;
sf::Clock last_displayed_frame_time;
while (true)
{
this->handle_events ();
save_if_necessary ();
if (m_quit)
break;
{
r = 0;
break;
}
move_player_if_necessary ();
handle_clicks ();
......@@ -179,7 +183,7 @@ Game::run ()
}
m_window.setKeyRepeatEnabled (true);
return 1;
return r;
}
void
......
......@@ -60,7 +60,7 @@
int run_gui ();
/**
* Blit the players in “players” on the renderer “renderer”
* Blit the players in “players”.
*
* @param players is the vector containing every players.
* @param screen_origin is the offset in pixels from the origin of the map.
......
......@@ -24,6 +24,8 @@
* Displaying an inventory interface.
*/
#pragma once
#include <SFML/Graphics.hpp>
#include "../player.h"
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment