Started adding races support

Started adding Races support, based on http://www.circlemud.org/pub/CircleMUD/contrib/code/players/races.txt

Signed-off-by: Polonkai Gergely <polesz@w00d5t0ck.info>
This commit is contained in:
Polonkai Gergely 2012-03-06 08:41:05 +01:00
parent 525aff7a00
commit 0ec7dd3b79
3 changed files with 82 additions and 0 deletions

70
src/races.c Normal file
View File

@ -0,0 +1,70 @@
#include "sysdep.h"
#include "conf.h"
#include "structs.h"
#include "interpreter.h"
#include "utils.h"
const char *race_abbrevs[] = {
"Hao",
"Utn",
"Dua",
"\n"
};
const char *pc_race_types[] = {
"Haoon",
"Utnir",
"Duaron",
"\n"
};
const char *race_menu = "\r\n"
"Select race:\r\n"
"(1) Haoon\r\n"
"(2) Utnir\r\n"
"(3) Duaron\r\n";
int
parse_race(char arg)
{
arg = LOWER(arg);
switch (arg)
{
case '1':
return RACE_HAOON;
break;
case '2':
return RACE_UTNIR;
break;
case '3':
return RACE_DUARON;
break;
default:
return RACE_UNDEFINED;
break;
}
}
long
find_race_bitvector(char arg)
{
arg = LOWER(arg);
switch (arg)
{
case '1':
return (1 << 0);
break;
case '2':
return (1 << 1);
break;
case '3':
return (1 << 2);
break;
default:
return 0;
break;
}
}

View File

@ -130,6 +130,13 @@
#define CLASS_DRAGON 4 #define CLASS_DRAGON 4
#define CLASS_GIANT 5 #define CLASS_GIANT 5
/* Race */
#define RACE_UNDEFINED (-1)
#define RACE_HAOON 0
#define RACE_UTNIR 1
#define RACE_DUARON 2
#define NUM_RACES 3 /* This must be the number of races! */
/* Sex */ /* Sex */
#define SEX_NEUTRAL 0 #define SEX_NEUTRAL 0
@ -263,6 +270,7 @@
#define CON_DELCNF1 15 /* Delete confirmation 1 */ #define CON_DELCNF1 15 /* Delete confirmation 1 */
#define CON_DELCNF2 16 /* Delete confirmation 2 */ #define CON_DELCNF2 16 /* Delete confirmation 2 */
#define CON_DISCONNECT 17 /* In-game link loss (leave character) */ #define CON_DISCONNECT 17 /* In-game link loss (leave character) */
#define CON_QRACE 18 /* Race? */
/* Character equipment positions: used as index for char_data.equipment[] */ /* Character equipment positions: used as index for char_data.equipment[] */
/* NOTE: Don't confuse these constants with the ITEM_ bitvectors /* NOTE: Don't confuse these constants with the ITEM_ bitvectors
@ -734,6 +742,7 @@ struct char_player_data {
char *title; /* PC / NPC's title */ char *title; /* PC / NPC's title */
byte sex; /* PC / NPC's sex */ byte sex; /* PC / NPC's sex */
byte chclass; /* PC / NPC's class */ byte chclass; /* PC / NPC's class */
byte race; /* PC / NPC's race */
byte level; /* PC / NPC's level */ byte level; /* PC / NPC's level */
sh_int hometown; /* PC s Hometown (zone) */ sh_int hometown; /* PC s Hometown (zone) */
struct time_data time; /* PC's AGE in days */ struct time_data time; /* PC's AGE in days */
@ -943,6 +952,7 @@ struct char_file_u {
char title[MAX_TITLE_LENGTH+1]; char title[MAX_TITLE_LENGTH+1];
byte sex; byte sex;
byte chclass; byte chclass;
byte race;
byte level; byte level;
sh_int hometown; sh_int hometown;
time_t birth; /* Time of birth of character */ time_t birth; /* Time of birth of character */

View File

@ -275,6 +275,7 @@ void update_pos(struct char_data *victim);
GET_LEVEL(ch)) GET_LEVEL(ch))
#define GET_CLASS(ch) ((ch)->player.chclass) #define GET_CLASS(ch) ((ch)->player.chclass)
#define GET_RACE(ch) ((ch)->player.race)
#define GET_HOME(ch) ((ch)->player.hometown) #define GET_HOME(ch) ((ch)->player.hometown)
#define GET_HEIGHT(ch) ((ch)->player.height) #define GET_HEIGHT(ch) ((ch)->player.height)
#define GET_WEIGHT(ch) ((ch)->player.weight) #define GET_WEIGHT(ch) ((ch)->player.weight)
@ -483,6 +484,7 @@ void update_pos(struct char_data *victim);
#define CLASS_ABBR(ch) (IS_NPC(ch) ? "--" : class_abbrevs[(int)GET_CLASS(ch)]) #define CLASS_ABBR(ch) (IS_NPC(ch) ? "--" : class_abbrevs[(int)GET_CLASS(ch)])
#define RACE_ABBR(ch) (IS_NPC(ch) ? "--" : race_abbrevs[(int)GET_RACE(ch)])
#define IS_MAGIC_USER(ch) (!IS_NPC(ch) && \ #define IS_MAGIC_USER(ch) (!IS_NPC(ch) && \
(GET_CLASS(ch) == CLASS_MAGIC_USER)) (GET_CLASS(ch) == CLASS_MAGIC_USER))