Added quick move room method
This commit is contained in:
parent
2b40943d14
commit
61c57edc70
3 changed files with 27 additions and 0 deletions
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "world.h"
|
||||||
|
#include <error.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#define WORLD_SIZE 100
|
#define WORLD_SIZE 100
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue