Moved some structures around so they're accessible by both cli and serv
This commit is contained in:
parent
61c57edc70
commit
599bc76379
4 changed files with 23 additions and 11 deletions
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
|
#include <world_structures.h>
|
||||||
typedef enum { NORTH, EAST, SOUTH, WEST } move_directions;
|
|
||||||
|
|
||||||
// Returns pointer to new room based on current room and direction If room
|
// Returns pointer to new room based on current room and direction If room
|
||||||
// doesn't exist returns NULL
|
// doesn't exist returns NULL
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Define what a room is.
|
#include <world_structures.h>
|
||||||
typedef struct room {
|
|
||||||
char* name;
|
|
||||||
char* description;
|
|
||||||
struct room* north;
|
|
||||||
struct room* east;
|
|
||||||
struct room* south;
|
|
||||||
struct room* west;
|
|
||||||
} Room;
|
|
||||||
|
|
||||||
// Creator and destructor for the world
|
// Creator and destructor for the world
|
||||||
Room* wrld__create();
|
Room* wrld__create();
|
||||||
|
|
|
||||||
|
|
@ -23,3 +23,8 @@ int msg__accept_cli_connection(int server_sockfd);
|
||||||
// Handle logins
|
// Handle logins
|
||||||
void msg__handle_login(int *con_sockfd);
|
void msg__handle_login(int *con_sockfd);
|
||||||
void msg__login_req(int *con_sockfd, char *usernm, char *passwd);
|
void msg__login_req(int *con_sockfd, char *usernm, char *passwd);
|
||||||
|
|
||||||
|
|
||||||
|
// send and recive commands
|
||||||
|
void msg__handle_command(int *con_sockfd);
|
||||||
|
void msg__command_req(int *con_sockfd, char *usernm, char *passwd);
|
||||||
|
|
|
||||||
15
urchin-util/include/world_structures.h
Normal file
15
urchin-util/include/world_structures.h
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#pragma once
|
||||||
|
// Make world structures accessible to both server and client
|
||||||
|
|
||||||
|
// Define moveable directions
|
||||||
|
typedef enum { NORTH, EAST, SOUTH, WEST } move_directions;
|
||||||
|
|
||||||
|
// Define what a room is.
|
||||||
|
typedef struct room {
|
||||||
|
char* name;
|
||||||
|
char* description;
|
||||||
|
struct room* north;
|
||||||
|
struct room* east;
|
||||||
|
struct room* south;
|
||||||
|
struct room* west;
|
||||||
|
} Room;
|
||||||
Loading…
Reference in a new issue