Added some player message objects to start thinking about initial messages
This commit is contained in:
parent
0b937b1d6a
commit
e37181fe35
5 changed files with 31 additions and 10 deletions
|
|
@ -1,4 +0,0 @@
|
|||
message AMessage {
|
||||
required int32 a=1;
|
||||
optional int32 b=2;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
// learn C.
|
||||
|
||||
#include <error.h>
|
||||
#include <message.h>
|
||||
#include <netinet/in.h> //sockaddr_in
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> // Keeping for conversion functions
|
||||
|
|
@ -11,6 +12,8 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int a = 1;
|
||||
msg_amsg_test(a);
|
||||
|
||||
// Set up containers for file descriptor id's
|
||||
int sockfd, clientsockfd, portno, errflag;
|
||||
|
|
@ -34,10 +37,6 @@ int main(int argc, char *argv[]) {
|
|||
error_crash("Can't open socket.");
|
||||
}
|
||||
|
||||
error_warn("Can't open socket.");
|
||||
int a = 1;
|
||||
msg_amsg_test(a);
|
||||
|
||||
// Make sure there is no junk data in serve_addr
|
||||
bzero((char *)&serv_addr, sizeof serv_addr);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,3 +6,10 @@
|
|||
#include <string.h>
|
||||
|
||||
void msg_amsg_test(int a);
|
||||
|
||||
// Creates a socket set's it up to listen to listen on the specified port and
|
||||
// returns the file descriptor
|
||||
int msg_create_serv_connection(int portno);
|
||||
|
||||
// Creates a socket for the client and returns the file descriptor
|
||||
int msg_accept_cli_connection();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
syntax = "proto2";
|
||||
|
||||
message AMessage {
|
||||
required int32 a = 1;
|
||||
optional int32 b = 2;
|
||||
|
|
|
|||
17
urchin-util/protobuf/player.proto
Normal file
17
urchin-util/protobuf/player.proto
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
syntax = "proto2";
|
||||
|
||||
message Item {
|
||||
required string id = 1;
|
||||
}
|
||||
|
||||
message PlayerStatus {
|
||||
required int32 id = 1;
|
||||
optional int32 health = 2;
|
||||
repeated Item inventory = 3;
|
||||
}
|
||||
|
||||
// Sending plain text passwords is bad
|
||||
message PlayerLogin {
|
||||
required string username = 1;
|
||||
required string password = 2;
|
||||
}
|
||||
Loading…
Reference in a new issue