forked from github/server
only name monsters that have a naming function. test is bad, failing.
This commit is contained in:
parent
9a72157cf3
commit
8a157de36c
|
@ -1470,12 +1470,12 @@ unit *create_unit(region * r, faction * f, int number, const struct race *urace,
|
||||||
/* u->region auch */
|
/* u->region auch */
|
||||||
u->hp = unit_max_hp(u) * number;
|
u->hp = unit_max_hp(u) * number;
|
||||||
|
|
||||||
if (!dname) {
|
if (dname) {
|
||||||
name_unit(u);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
u->_name = _strdup(dname);
|
u->_name = _strdup(dname);
|
||||||
}
|
}
|
||||||
|
else if (urace->generate_name || playerrace(urace)) {
|
||||||
|
name_unit(u);
|
||||||
|
}
|
||||||
|
|
||||||
if (creator) {
|
if (creator) {
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
|
#include "monsters.h"
|
||||||
#include "guard.h"
|
#include "guard.h"
|
||||||
#include "reports.h"
|
#include "reports.h"
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
|
@ -244,10 +245,24 @@ static void test_monsters_learn_exp(CuTest * tc)
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_spawn_seaserpent(CuTest *tc) {
|
||||||
|
region *r;
|
||||||
|
unit *u;
|
||||||
|
faction *f;
|
||||||
|
test_cleanup();
|
||||||
|
r = test_create_region(0, 0, 0);
|
||||||
|
f = test_create_faction(0);
|
||||||
|
u = spawn_seaserpent(r, f);
|
||||||
|
CuAssertPtrNotNull(tc, u);
|
||||||
|
CuAssertPtrEquals(tc, 0, u->_name);
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
CuSuite *get_monsters_suite(void)
|
CuSuite *get_monsters_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
SUITE_ADD_TEST(suite, test_monsters_attack);
|
SUITE_ADD_TEST(suite, test_monsters_attack);
|
||||||
|
SUITE_ADD_TEST(suite, test_spawn_seaserpent);
|
||||||
SUITE_ADD_TEST(suite, test_monsters_attack_ocean);
|
SUITE_ADD_TEST(suite, test_monsters_attack_ocean);
|
||||||
SUITE_ADD_TEST(suite, test_seaserpent_piracy);
|
SUITE_ADD_TEST(suite, test_seaserpent_piracy);
|
||||||
SUITE_ADD_TEST(suite, test_monsters_waiting);
|
SUITE_ADD_TEST(suite, test_monsters_waiting);
|
||||||
|
|
Loading…
Reference in New Issue