/*
* dirs.c
*
* SFUN: Direction functions
* Supported directions: north, northeast, east, southeast, south,
* southwest, west, northwest, up, down
*
* (C) Frank Schmidt, Jesus@NorseMUD
*
*/
/* get direction opposite of <dir> */
static string get_opposite_dir(string dir) {
switch (dir) {
case "north": return "south";
case "south": return "north";
case "west": return "east";
case "east": return "west";
case "down": return "up";
case "up": return "down";
case "northeast": return "southwest";
case "northwest": return "southeast";
case "southeast": return "northwest";
case "southwest": return "northeast";
}
/* couldn't find direction */
return 0;
}
/* get direction command abbreviation (for exits) */
static string get_dir_abbrev(string dir) {
switch (dir) {
case "n": return "north";
case "s": return "south";
case "w": return "west";
case "e": return "east";
case "d": return "down";
case "u": return "up";
case "ne": return "northeast";
case "nw": return "northwest";
case "se": return "southeast";
case "sw": return "southwest";
case "north": return "n";
case "south": return "s";
case "west": return "w";
case "east": return "e";
case "down": return "d";
case "up": return "u";
case "northeast": return "ne";
case "northwest": return "nw";
case "southeast": return "se";
case "southwest": return "sw";
}
/* couldn't find abbreviation, return 0 */
return 0;
}