diff --git a/src/server/command.c b/src/server/command.c index e69de29..76dc490 100644 --- a/src/server/command.c +++ b/src/server/command.c @@ -0,0 +1,15 @@ +#include "command.h" + +Room *cmd__move(move_directions direction, Room *current_room) { + switch (direction) { + case NORTH: + return current_room->north; + case EAST: + return current_room->east; + case SOUTH: + return current_room->south; + case WEST: + return current_room->west; + } + return NULL; +} diff --git a/src/server/command.h b/src/server/command.h index e69de29..5dfaba8 100644 --- a/src/server/command.h +++ b/src/server/command.h @@ -0,0 +1,10 @@ +#pragma once + +#include "world.h" +#include + +typedef enum { NORTH, EAST, SOUTH, WEST } move_directions; + +// Returns pointer to new room based on current room and direction If room +// doesn't exist returns NULL +Room *cmd__move(move_directions direction, Room *current_room); diff --git a/src/server/world.h b/src/server/world.h index 828dd03..0365411 100644 --- a/src/server/world.h +++ b/src/server/world.h @@ -1,3 +1,5 @@ +#pragma once + #define WORLD_SIZE 100 #include