Replace RCF_PLAYERRACE with RCF_NPC, it's the less confusing default for tests.

This commit is contained in:
Enno Rehling 2014-07-05 19:20:15 -07:00
parent 4a8707b06d
commit 5b437c5833
4 changed files with 7 additions and 8 deletions

View File

@ -32,7 +32,7 @@ static void check_flag(CuTest *tc, const char *name, int flag) {
} }
static void test_flags(CuTest *tc) { static void test_flags(CuTest *tc) {
check_flag(tc, "playerrace", RCF_PLAYERRACE); check_flag(tc, "npc", RCF_NPC);
check_flag(tc, "scarepeasants", RCF_SCAREPEASANTS); check_flag(tc, "scarepeasants", RCF_SCAREPEASANTS);
check_flag(tc, "cansteal", RCF_CANSTEAL); check_flag(tc, "cansteal", RCF_CANSTEAL);
check_flag(tc, "noheal", RCF_NOHEAL); check_flag(tc, "noheal", RCF_NOHEAL);
@ -56,7 +56,7 @@ static void test_races(CuTest * tc)
"\"capacity\" : 4," "\"capacity\" : 4,"
"\"hp\" : 5," "\"hp\" : 5,"
"\"ac\" : 6," "\"ac\" : 6,"
"\"flags\" : [ \"playerrace\", \"walk\", \"undead\" ]" "\"flags\" : [ \"npc\", \"walk\", \"undead\" ]"
"}}}"; "}}}";
cJSON *json = cJSON_Parse(data); cJSON *json = cJSON_Parse(data);
const struct race *rc; const struct race *rc;
@ -70,7 +70,7 @@ static void test_races(CuTest * tc)
CuAssertPtrNotNull(tc, races); CuAssertPtrNotNull(tc, races);
rc = rc_find("orc"); rc = rc_find("orc");
CuAssertPtrNotNull(tc, rc); CuAssertPtrNotNull(tc, rc);
CuAssertIntEquals(tc, RCF_PLAYERRACE|RCF_WALK|RCF_UNDEAD, rc->flags); CuAssertIntEquals(tc, RCF_NPC|RCF_WALK|RCF_UNDEAD, rc->flags);
CuAssertStrEquals(tc, "1d4", rc->def_damage); CuAssertStrEquals(tc, "1d4", rc->def_damage);
CuAssertDblEquals(tc, 1.0, rc->magres, 0.0); CuAssertDblEquals(tc, 1.0, rc->magres, 0.0);
CuAssertDblEquals(tc, 2.0, rc->maxaura, 0.0); CuAssertDblEquals(tc, 2.0, rc->maxaura, 0.0);

View File

@ -184,7 +184,7 @@ extern "C" {
void free_races(void); void free_races(void);
/* Flags */ /* Flags */
#define RCF_PLAYERRACE (1<<0) /* can be played by a player. */ #define RCF_NPC (1<<0) /* can be played by a player. */
#define RCF_KILLPEASANTS (1<<1) /* Töten Bauern. Dämonen werden nicht über dieses Flag, sondern in randenc() behandelt. */ #define RCF_KILLPEASANTS (1<<1) /* Töten Bauern. Dämonen werden nicht über dieses Flag, sondern in randenc() behandelt. */
#define RCF_SCAREPEASANTS (1<<2) #define RCF_SCAREPEASANTS (1<<2)
#define RCF_CANSTEAL (1<<3) #define RCF_CANSTEAL (1<<3)
@ -238,7 +238,7 @@ extern "C" {
#define omniscient(f) ((f)->race==get_race(RC_ILLUSION) || (f)->race==get_race(RC_TEMPLATE)) #define omniscient(f) ((f)->race==get_race(RC_ILLUSION) || (f)->race==get_race(RC_TEMPLATE))
#define playerrace(rc) (fval((rc), RCF_PLAYERRACE)) #define playerrace(rc) (!fval((rc), RCF_NPC))
#define dragonrace(rc) ((rc) == get_race(RC_FIREDRAGON) || (rc) == get_race(RC_DRAGON) || (rc) == get_race(RC_WYRM) || (rc) == get_race(RC_BIRTHDAYDRAGON)) #define dragonrace(rc) ((rc) == get_race(RC_FIREDRAGON) || (rc) == get_race(RC_DRAGON) || (rc) == get_race(RC_WYRM) || (rc) == get_race(RC_BIRTHDAYDRAGON))
#define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==get_race(RC_DRACOID) || playerrace(rc)) #define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==get_race(RC_DRACOID) || playerrace(rc))
#define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY)) #define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY))

View File

@ -1668,8 +1668,8 @@ static int parse_races(xmlDocPtr doc)
rc->at_bonus = (char)xml_ivalue(node, "attackmodifier", 0); rc->at_bonus = (char)xml_ivalue(node, "attackmodifier", 0);
rc->df_bonus = (char)xml_ivalue(node, "defensemodifier", 0); rc->df_bonus = (char)xml_ivalue(node, "defensemodifier", 0);
if (xml_bvalue(node, "playerrace", false)) if (!xml_bvalue(node, "playerrace", false))
rc->flags |= RCF_PLAYERRACE; rc->flags |= RCF_NPC;
if (xml_bvalue(node, "scarepeasants", false)) if (xml_bvalue(node, "scarepeasants", false))
rc->flags |= RCF_SCAREPEASANTS; rc->flags |= RCF_SCAREPEASANTS;
if (xml_bvalue(node, "cansteal", true)) if (xml_bvalue(node, "cansteal", true))

View File

@ -25,7 +25,6 @@
struct race *test_create_race(const char *name) struct race *test_create_race(const char *name)
{ {
race *rc = rc_get_or_create(name); race *rc = rc_get_or_create(name);
rc->flags |= RCF_PLAYERRACE;
rc->maintenance = 10; rc->maintenance = 10;
return rc; return rc;
} }