Go to the documentation of this file.
54 static int reference_number = 0;
60 for (exit_ob =
GET_MAP_OB(
map,
x,
y); exit_ob != NULL; exit_ob = exit_ob->above)
61 if (exit_ob->type ==
EXIT && exit_ob->msg != NULL)
71 memset(&rp, 0,
sizeof(
RMParms));
97 snprintf(
buf,
sizeof(
buf),
"%s", cp);
98 while (isdigit(
buf[strlen(
buf)-1]))
102 snprintf(newmap_name,
sizeof(newmap_name),
"/random/%s%04d", cp+1, reference_number++);
107 static void do_run(
void) {
111 int iteration,
x,
y,
map;
116 snprintf(
path,
sizeof(
path),
"/whalingoutpost/underwaterdungeon/level%d",
map);
123 while (random != NULL) {
124 random = get_random_map(random);
140 FAIL_UNLESS(iteration != 0,
"did %d iterations", iteration);
148 static void do_run(
void) {
154 FAIL_UNLESS(overlay != NULL,
"Couldn't load unique map ../../rsc/bug_1727944_unique");
156 while (
found == 0 && test < 10) {
158 FAIL_UNLESS(
map != NULL,
"couldn't load map ../../rsc/bug_1727944");
166 if (
check->title && strcmp(
check->title,
"of Plenty") == 0) {
196 if (
op->arch &&
op->name !=
op->arch->clone.name &&
op->name_pl ==
op->arch->clone.name_pl) {
201 if (!
op->name_pl &&
op->name)
216 }
else if ((!strcmp(
op->skill,
"one handed weapons") &&
op->body_info[1] != -1)
217 || (!strcmp(
op->skill,
"two handed weapons") &&
op->body_info[1] != -2)) {
218 LOG(
llevError,
"weapon %s arm usage does not match skill: %d, %s\n",
219 op->name,
op->body_info[1],
op->skill);
239 LOG(
llevDebug,
"Object %s still has last_heal set, not gen_sp_armour\n",
op->name ?
op->name :
"NULL");
240 op->gen_sp_armour =
op->last_heal;
245 if (!
op->item_power &&
ip) {
247 LOG(
llevDebug,
"Object %s had no item power, using %d\n",
op->name ?
op->name :
"NULL",
ip);
257 if (
ip > 2*
op->item_power &&
ip > (
op->item_power+3)) {
258 LOG(
llevDebug,
"Object %s seems to have too low item power? %d > %d\n",
op->name ?
op->name :
"NULL",
ip,
op->item_power);
271 op->randomitems = NULL;
280 op->randomitems = NULL;
282 op->value =
op->arch->clone.value*
op->inv->value;
286 if (
op->stats.hp >
op->stats.maxhp)
287 LOG(
llevDebug,
"Monster %s has hp set higher than maxhp (%d>%d)\n",
op->name,
op->stats.hp,
op->stats.maxhp);
307 temp->reference_count++;
309 temp->tail_x =
op->arch->tail_x;
310 temp->tail_y =
op->arch->tail_y;
312 temp->clone.inv = NULL;
313 temp->clone.env = NULL;
316 temp->clone.map = NULL;
324 temp->clone.speed = 0;
326 temp->clone.speed =
op->speed;
329 temp->more =
op->arch->more;
341 for (test = 0; test < 50; test++)
344 for (test = 0; test < 50; test++) {
346 FAIL_UNLESS(overlay != NULL,
"Couldn't load unique map ../../rsc/bug_1727944_unique");
362 FAIL_UNLESS(horn != NULL,
"couldn't find archetype horn.");
364 FAIL_UNLESS(horn2 != NULL,
"couldn't find archetype horn2.");
366 for (test = 0; test < 100000; test++) {
375 object *the_chest, *
check;
378 FAIL_UNLESS(tlist != NULL,
"couldn't find treasure list uncommon_items");
380 for (test = 0; test < 10; test++) {
387 FAIL_UNLESS(the_chest != NULL,
"failed to get chest");
393 FAIL_UNLESS(the_chest != NULL,
"failed to recover chest?");
412 Suite *s = suite_create(
"bug");
413 TCase *tc_core = tcase_create(
"Core");
418 suite_add_tcase(s, tc_core);
419 tcase_add_test(tc_core, test_randommaps);
420 tcase_set_timeout(tc_core, 0);
428 SRunner *sr = srunner_create(s);
430 srunner_set_fork_status(sr, CK_NOFORK);
434 srunner_set_xml(sr, LOGDIR
"/bugs/bugtrack/1727944.xml");
435 srunner_set_log(sr, LOGDIR
"/bugs/bugtrack/1727944.out");
436 srunner_run_all(sr, CK_ENV);
437 nf = srunner_ntests_failed(sr);
439 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
#define GET_MAP_OB(M, X, Y)
void object_set_flag_inv(object *op, int flag)
void LOG(LogLevel logLevel, const char *format,...)
mapstruct * get_empty_map(int sizex, int sizey)
START_TEST(test_randommaps)
mapstruct * ready_map_name(const char *name, int flags)
#define QUERY_FLAG(xyz, p)
archetype * get_archetype_struct(void)
#define FLAG_CONTENT_ON_GEN
int set_random_map_variable(RMParms *rp, const char *buf)
void set_materialname(object *op)
void object_copy(const object *src_ob, object *dest_ob)
#define MAP_PLAYER_UNIQUE
treasurelist * find_treasurelist(const char *name)
mapstruct * generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout, sstring reset_group)
object * object_insert_in_ob(object *op, object *where)
#define SAVE_MODE_OVERLAY
#define FLAG_IS_A_TEMPLATE
void apply_auto_fix(mapstruct *m)
sstring add_string(const char *str)
static END_TEST Suite * bug_suite(void)
void object_update_speed(object *op)
void delete_map(mapstruct *m)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
static void local_check_loaded_object(object *op)
object * create_archetype(const char *name)
void free_string(sstring str)
object * create_archetype_by_object_name(const char *name)
archetype * find_archetype(const char *name)
const char *const spell_mapping[SPELL_MAPPINGS]
void init(int argc, char **argv)
object * arch_to_object(archetype *at)
region * get_region_by_map(mapstruct *m)
struct treasurelist * randomitems
void object_remove(object *op)
int save_map(mapstruct *m, int flag)
int calc_item_power(const object *op)
static void teardown(void)
void generate_artifact(object *op, int difficulty)
int object_can_merge(object *ob1, object *ob2)