Crossfire Server, Trunk  R20513
check_1727944.c
Go to the documentation of this file.
1 /*
2  * CrossFire, A Multiplayer game for X-windows
3  *
4  * Copyright (C) 2007 Crossfire Development Team
5  * Copyright (C) 1992 Frank Tore Johansen
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  * The authors can be reached via e-mail at crossfire-devel@real-time.com
22  */
23 
34 #include <stdlib.h>
35 #include <check.h>
36 #include <global.h>
37 #include <sproto.h>
38 
39 static void setup(void) {
40  /* put any initialisation steps here, they will be run before each testcase */
41 }
42 
43 static void teardown(void) {
44  /* put any cleanup steps here, they will be run after each testcase */
45 }
46 
47 #if 0
48 static mapstruct *get_random_map(mapstruct *map) {
49  object *exit_ob;
50  mapstruct *random;
51  RMParms rp;
52  char newmap_name[HUGE_BUF], *cp;
53  static int reference_number = 0;
54  int x, y;
55 
56  exit_ob = NULL;
57  for (x = 0; x < MAP_WIDTH(map) && exit_ob == NULL; x++) {
58  for (y = 0; y < MAP_HEIGHT(map) && exit_ob == NULL; y++) {
59  for (exit_ob = GET_MAP_OB(map, x, y); exit_ob != NULL; exit_ob = exit_ob->above)
60  if (exit_ob->type == EXIT && exit_ob->msg != NULL)
61  break;
62  }
63  }
64 
65  if (!exit_ob)
66  /* this means we reached the end of the random part. */
67  return NULL;
68 
69  /* copied from server/server.c:enter_random_map(). */
70  memset(&rp, 0, sizeof(RMParms));
71  rp.Xsize = -1;
72  rp.Ysize = -1;
73  rp.region = get_region_by_map(exit_ob->map);
74  if (exit_ob->msg)
75  set_random_map_variable(&rp, exit_ob->msg);
76  rp.origin_x = exit_ob->x;
77  rp.origin_y = exit_ob->y;
78  strcpy(rp.origin_map, map->path);
79 
80  /* If we have a final_map, use it as a base name to give some clue
81  * as where the player is. Otherwise, use the origin map.
82  * Take the last component (after the last slash) to give
83  * shorter names without bogus slashes.
84  */
85  if (rp.final_map[0]) {
86  cp = strrchr(rp.final_map, '/');
87  if (!cp)
88  cp = rp.final_map;
89  } else {
90  char buf[HUGE_BUF];
91 
92  cp = strrchr(rp.origin_map, '/');
93  if (!cp)
94  cp = rp.origin_map;
95  /* Need to strip of any trailing digits, if it has them */
96  snprintf(buf, sizeof(buf), "%s", cp);
97  while (isdigit(buf[strlen(buf)-1]))
98  buf[strlen(buf)-1] = 0;
99  cp = buf;
100  }
101  snprintf(newmap_name, sizeof(newmap_name), "/random/%s%04d", cp+1, reference_number++);
102  /* now to generate the actual map. */
103  return generate_random_map(newmap_name, &rp, NULL);
104 }
105 
106 static void do_run(void) {
107  mapstruct *worldmap;
108  mapstruct *random;
109  mapstruct *old;
110  int iteration, x, y, map;
111  object *check;
112  char path[150];
113 
114  for (map = 1; map <= 3; map++) {
115  snprintf(path, sizeof(path), "/whalingoutpost/underwaterdungeon/level%d", map);
116  worldmap = ready_map_name(path, 0);
117  fail_unless(worldmap != NULL, "Can't load %s", path);
118 
119  random = worldmap;
120  old = NULL;
121  iteration = 0;
122  while (random != NULL) {
123  random = get_random_map(random);
124  if (!random)
125  break;
126  if (old)
127  delete_map(old);
128  old = random;
129  iteration++;
130  for (x = 0; x < MAP_WIDTH(random); x++) {
131  for (y = 0; y < MAP_HEIGHT(random); y++) {
132  for (check = GET_MAP_OB(random, x, y); check; check = check->above) {
133  if (check->type == ROD && check->title && strcmp(check->title, "of Plenty") == 0)
134  fail_unless(check->inv != NULL, "Horn has empty inventory!");
135  }
136  }
137  }
138  }
139  fail_unless(iteration != 0, "did %d iterations", iteration);
140  if (old)
141  delete_map(old);
142  }
143 }
144 #endif
145 
146 #if 0
147 static void do_run(void) {
148  mapstruct *map, *overlay;
149  int x, y, found = 0, test = 0;
150  object *check;
151 
152  overlay = ready_map_name("../../rsc/bug_1727944_unique", MAP_PLAYER_UNIQUE);
153  fail_unless(overlay != NULL, "Couldn't load unique map ../../rsc/bug_1727944_unique");
154 
155  while (found == 0 && test < 10) {
156  map = ready_map_name("../../rsc/bug_1727944", MAP_PLAYER_UNIQUE);
157  fail_unless(map != NULL, "couldn't load map ../../rsc/bug_1727944");
158 
159  for (x = 0; x < MAP_WIDTH(map); x++) {
160  for (y = 0; y < MAP_HEIGHT(map); y++) {
161  for (check = GET_MAP_OB(map, x, y); check; check = check->above) {
162  if (check->type == ROD) {
163  fail_unless(check->inv != NULL, "Horn has empty inventory!");
164  fail_unless(check->inv->below == NULL, "Horn has 2 items in inventory!");
165  if (check->title && strcmp(check->title, "of Plenty") == 0) {
166  object_remove(check);
167  object_insert_in_map_at(check, overlay, NULL, 0, 2, 3);
168  found++;
169  break;
170  }
171  }
172  }
173  }
174  }
175  delete_map(map);
176  test++;
177  }
178  save_map(overlay, SAVE_MODE_OVERLAY);
179  delete_map(overlay);
180 }
181 #endif
182 
183 extern int artifact_init;
184 extern int arch_init;
185 
186 /* Copied from loader.l */
187 extern const char *const spell_mapping[];
188 
189 static void local_check_loaded_object(object *op) {
190  int ip;
191 
192  if (artifact_init)
193  /* Artifacts are special beasts, let's not check them. */
194  return;
195 
196  /* We do some specialized handling to handle legacy cases of name_pl.
197  * If the object doesn't have a name_pl, we just use the object name -
198  * this isn't perfect (things won't be properly pluralized), but works to
199  * that degree (5 heart is still quite understandable). But the case we
200  * also have to catch is if this object is not using the normal name for
201  * the object. In that case, we also want to use the loaded name.
202  * Otherwise, what happens is that the the plural name will lose
203  * information (appear as just 'hearts' and not 'goblins heart')
204  */
205  if (op->arch && op->name != op->arch->clone.name && op->name_pl == op->arch->clone.name_pl) {
206  if (op->name_pl)
207  free_string(op->name_pl);
208  op->name_pl = NULL;
209  }
210  if (!op->name_pl && op->name)
211  op->name_pl = add_string(op->name);
212 
213  /* objects now have a materialname. try to patch it in */
214  if (!(IS_WEAPON(op) && op->level > 0)) {
215  set_materialname(op);
216  }
217  /* only do these when program is first run - a bit
218  * excessive to do this at every run - most of this is
219  * really just to catch any errors - program will still run, but
220  * not in the ideal fashion.
221  */
222  if ((op->type == WEAPON || op->type == BOW) && arch_init) {
223  if (!op->skill) {
224  LOG(llevError, "Weapon %s lacks a skill.\n", op->name);
225  } else if ((!strcmp(op->skill, "one handed weapons") && op->body_info[1] != -1)
226  || (!strcmp(op->skill, "two handed weapons") && op->body_info[1] != -2)) {
227  LOG(llevError, "weapon %s arm usage does not match skill: %d, %s\n",
228  op->name, op->body_info[1], op->skill);
229  }
230  }
231 
232  /* We changed last_heal to gen_sp_armour, which is what it
233  * really does for many objects. Need to catch any in maps
234  * that may have an old value.
235  */
236  if ((op->type == WEAPON)
237  || (op->type == ARMOUR)
238  || (op->type == HELMET)
239  || (op->type == SHIELD)
240  || (op->type == RING)
241  || (op->type == BOOTS)
242  || (op->type == GLOVES)
243  || (op->type == AMULET)
244  || (op->type == GIRDLE)
245  || (op->type == BRACERS)
246  || (op->type == CLOAK)) {
247  if (op->last_heal) {
248  LOG(llevDebug, "Object %s still has last_heal set, not gen_sp_armour\n", op->name ? op->name : "NULL");
249  op->gen_sp_armour = op->last_heal;
250  op->last_heal = 0;
251  }
252  ip = calc_item_power(op);
253  /* Legacy objects from before item power was in the game */
254  if (!op->item_power && ip) {
255  if (ip > 3) {
256  LOG(llevDebug, "Object %s had no item power, using %d\n", op->name ? op->name : "NULL", ip);
257  }
258  op->item_power = ip;
259  }
260  /* Check for possibly bogus values. Has to meet both these criteria -
261  * something that has item_power 1 is probably just fine if our calculated
262  * value is 1 or 2 - these values are small enough that hard to be precise.
263  * similarly, it item_power is 0, the first check will always pass,
264  * but not the second one.
265  */
266  if (ip > 2*op->item_power && ip > (op->item_power+3)) {
267  LOG(llevDebug, "Object %s seems to have too low item power? %d > %d\n", op->name ? op->name : "NULL", ip, op->item_power);
268  }
269  }
270  /* Old spellcasting object - need to load in the appropiate object */
271  if ((op->type == ROD || op->type == WAND || op->type == SCROLL || op->type == FIREWALL || /* POTIONS and ALTARS don't always cast spells, but if they do, update them */ ((op->type == POTION || op->type == ALTAR) && op->stats.sp))
272  && !op->inv
273  && !arch_init) {
274  object *tmp;
275 
276  /* Fireall is bizarre in that spell type was stored in dam. Rest are 'normal'
277  * in that spell was stored in sp.
278  */
279  tmp = create_archetype(spell_mapping[op->type == FIREWALL ? op->stats.dam : op->stats.sp]);
280  object_insert_in_ob(tmp, op);
281  op->randomitems = NULL; /* So another spell isn't created for this object */
282  }
283 
284  /* spellbooks & runes use slaying. But not to arch name, but to spell name */
285  if ((op->type == SPELLBOOK || op->type == RUNE) && op->slaying && !op->inv && !arch_init) {
286  object *tmp;
287 
289  object_insert_in_ob(tmp, op);
290  op->randomitems = NULL; /* So another spell isn't created for this object */
291  /* without this, value is all screwed up */
292  op->value = op->arch->clone.value*op->inv->value;
293  }
294 
295  if (QUERY_FLAG(op, FLAG_MONSTER)) {
296  if (op->stats.hp > op->stats.maxhp)
297  LOG(llevDebug, "Monster %s has hp set higher than maxhp (%d>%d)\n", op->name, op->stats.hp, op->stats.maxhp);
298  }
300  || op->type == CREATOR
301  || op->type == CONVERTER) {
302  /* Object will duplicate it's content as part of the
303  * generation process. To do this, we must flag inventory
304  * so it remains unevaluated concerning the randomitems and
305  * the living (a demonlord shouldn't cast from inside generator!)
306  */
308  }
309 
310  /* Here we'll handle custom monsters. In order to handle them correctly, especially in the fix_object
311  * method, we'll create a new temporary archetype containing defined values.
312  * Of course this doesn't apply when loading archetypes or artifacts.
313  */
314  if (arch_init == 0 && artifact_init == 0 && QUERY_FLAG(op, FLAG_MONSTER) && op->arch && !object_can_merge(op, &op->arch->clone)) {
316 
317  temp->reference_count++;
318  temp->name = add_string(op->arch->name);
319  temp->tail_x = op->arch->tail_x;
320  temp->tail_y = op->arch->tail_y;
321  object_copy(op, &temp->clone);
322  temp->clone.inv = NULL;
323  temp->clone.env = NULL;
324  temp->clone.x = 0;
325  temp->clone.y = 0;
326  temp->clone.map = NULL;
327  if (FABS(temp->clone.speed) > MIN_ACTIVE_SPEED) {
328  /* Clone has a speed, so need to clear that because it isn't on a map.
329  * But we need to keep the value, because otherwise the customized object
330  * will have no speed (fix_player() will use the 0 value). So set it
331  * to zero, call object_update_speed() to remove it from active list, then
332  * set its speed back to the original.
333  */
334  temp->clone.speed = 0;
335  object_update_speed(&temp->clone);
336  temp->clone.speed = op->speed;
337  }
338 
339  temp->more = op->arch->more;
340  op->arch = temp;
341  /* LOG(llevDebug, "created temporary archetype for %s at %d,%d\n", op->name, op->x, op->y); */
342  }
343 }
344 
345 START_TEST(test_randommaps) {
346 #if 0
347  int test;
348  mapstruct *overlay;
349  object *check;
350 
351  for (test = 0; test < 50; test++)
352  do_run();
353 
354  for (test = 0; test < 50; test++) {
355  overlay = ready_map_name("../../rsc/bug_1727944_unique", MAP_PLAYER_UNIQUE);
356  fail_unless(overlay != NULL, "Couldn't load unique map ../../rsc/bug_1727944_unique");
357  fail_unless(GET_MAP_OB(overlay, 2, 3) != NULL, "No item on spot 2,3?");
358 
359  for (check = GET_MAP_OB(overlay, 2, 3)->above; check != NULL; check = check->above) {
360  fail_unless(check->type == ROD, "Found a non horn?");
361  fail_unless(check->inv != NULL, "Horn without a spell!");
362  fail_unless(check->inv->below == NULL, "Horn with 2 items in inventory.");
363  }
364  save_map(overlay, SAVE_MODE_OVERLAY);
365  delete_map(overlay);
366  }
367 #endif
368 
369 #if 0
370  int test;
371  archetype *horn = find_archetype("horn");
372  fail_unless(horn != NULL, "couldn't find archetype horn.");
373  archetype *horn2 = find_archetype("horn2");
374  fail_unless(horn2 != NULL, "couldn't find archetype horn2.");
375 
376  for (test = 0; test < 100000; test++) {
377  object *check = arch_to_object(RANDOM()%2 ? horn : horn2);
378 
379  generate_artifact(check, RANDOM()%100);
380  fail_unless(check->inv != NULL, "horn without inventory!");
381  }
382 #endif
383 
384  int test, level, found = 0;
385  object *the_chest, *check;
386  mapstruct *map;
387  treasurelist *tlist = find_treasurelist("uncommon_items");
388  fail_unless(tlist != NULL, "couldn't find treasure list uncommon_items");
389 
390  for (test = 0; test < 10; test++) {
391  for (level = 1; level < 120; level++) {
392  map = get_empty_map(1, 1);
393  fail_unless(map != NULL, "failed to get empty map");
394  map->difficulty = level;
395 
396  the_chest = create_archetype("chest"); /* was "chest_2" */
397  fail_unless(the_chest != NULL, "failed to get chest");
398  the_chest->randomitems = tlist;
399  the_chest->stats.hp = RANDOM()%100;
400  object_insert_in_map_at(the_chest, map, NULL, 0, 0, 0);
401  apply_auto_fix(map);
402  the_chest = GET_MAP_OB(map, 0, 0);
403  fail_unless(the_chest != NULL, "failed to recover chest?");
404  for (check = the_chest->inv; check; check = check->below) {
405  if (check->type != ROD)
406  continue;
408  fail_unless(check->inv != NULL, "horn without inventory");
409  fail_unless(check->inv->below == NULL, "horn with 2 items");
410  fail_unless(check->randomitems == NULL, "horn with randomitems set");
411  found++;
412  }
413  delete_map(map);
414  }
415  }
416  fail_unless(found > 100, "didn't find 100 horn but %d??", found);
417 
418 }
419 END_TEST
420 
421 static Suite *bug_suite(void) {
422  Suite *s = suite_create("bug");
423  TCase *tc_core = tcase_create("Core");
424 
425  /*setup and teardown will be called before each test in testcase 'tc_core' */
426  tcase_add_checked_fixture(tc_core, setup, teardown);
427 
428  suite_add_tcase(s, tc_core);
429  tcase_add_test(tc_core, test_randommaps);
430  tcase_set_timeout(tc_core, 0);
431 
432  return s;
433 }
434 
435 int main(void) {
436  int nf;
437  Suite *s = bug_suite();
438  SRunner *sr = srunner_create(s);
439 
440  srunner_set_fork_status(sr, CK_NOFORK);
441  init(0, NULL);
442 
443  srunner_set_xml(sr, LOGDIR "/bugs/bugtrack/1727944.xml");
444  srunner_set_log(sr, LOGDIR "/bugs/bugtrack/1727944.out");
445  srunner_run_all(sr, CK_ENV); /*verbosity from env variable*/
446  nf = srunner_ntests_failed(sr);
447  srunner_free(sr);
448  return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
449 }
Error, serious thing.
Definition: logger.h:11
char path[HUGE_BUF]
Filename of the map.
Definition: map.h:365
int reference_count
How many times this temporary archetype is used.
Definition: object.h:473
Random map parameters.
Definition: random_map.h:14
archetype * find_archetype(const char *name)
Finds, using the hashtable, which archetype matches the given name.
Definition: arch.c:695
mapstruct * generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout)
Main random map routine.
Definition: random_map.c:74
int main(void)
See Ring.
Definition: object.h:185
int8_t tail_x
Definition: object.h:471
treasureliststruct represents one logical group of items to be generated together.
Definition: treasure.h:82
mapstruct * get_empty_map(int sizex, int sizey)
Creates and returns a map of the specific size.
Definition: map.c:874
See Bracers.
Definition: object.h:217
#define FABS(x)
Decstations have trouble with fabs()...
Definition: define.h:22
See Scroll.
Definition: object.h:221
See Cloak.
Definition: object.h:204
char final_map[RM_SIZE]
If not empty, the path of the final map this whole maze leads to.
Definition: random_map.h:52
treasurelist * find_treasurelist(const char *name)
Searches for the given treasurelist in the globally linked list of treasurelists which has been built...
Definition: treasure.c:292
mapstruct * ready_map_name(const char *name, int flags)
Makes sure the given map is loaded and swapped in.
Definition: map.c:1803
int32_t last_heal
Last healed.
Definition: object.h:357
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
Definition: shstr.c:280
#define HUGE_BUF
Used for messages - some can be quite long.
Definition: define.h:37
See Spellbook.
Definition: object.h:203
struct treasureliststruct * randomitems
Items to be generated.
Definition: object.h:385
#define MAP_HEIGHT(m)
Map height.
Definition: map.h:80
object clone
An object from which to do object_copy()
Definition: object.h:470
See Rune.
Definition: object.h:240
See Creator.
Definition: object.h:142
See Weapon.
Definition: object.h:119
See Helmet.
Definition: object.h:136
const char * slaying
Which race to do double damage to.
Definition: object.h:319
region * get_region_by_map(mapstruct *m)
Gets a region from a map.
Definition: region.c:74
#define IS_WEAPON(op)
Definition: define.h:162
See Rod.
Definition: object.h:109
struct obj * above
Pointer to the object stacked above this one.
Definition: object.h:288
See Girdle.
Definition: object.h:223
object * create_archetype_by_object_name(const char *name)
Creates an object given the name that appears during the game (for example, "writing pen" instead of ...
Definition: arch.c:160
See Amulet.
Definition: object.h:139
int16_t sp
Spell points.
Definition: living.h:41
int object_can_merge(object *ob1, object *ob2)
Examines the 2 objects given to it, and returns true if they can be merged together, including inventory.
Definition: object.c:171
Global type definitions and header inclusions.
See Boots.
Definition: object.h:212
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
Definition: object.h:465
See Wand & Staff.
Definition: object.h:220
int8_t tail_y
Where the lower right most portion of the object is in comparison to the head.
Definition: object.h:471
int16_t hp
Hit Points.
Definition: living.h:39
void object_set_flag_inv(object *op, int flag)
Activate recursively a flag on an object&#39;s inventory.
Definition: object.c:3081
int artifact_init
1 if doing archetypes initialization
Definition: artifact.c:28
const char * title
Of foo, etc.
Definition: object.h:317
int16_t y
Position in the map for this object.
Definition: object.h:326
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
Definition: object.c:1921
int16_t maxhp
Max hit points.
Definition: living.h:40
See Shooting Weapon.
Definition: object.h:118
See Exit.
Definition: object.h:181
const char * name_pl
The plural name of the object.
Definition: object.h:315
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
Definition: arch.c:620
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
Definition: object.c:2690
int arch_init
True if doing arch initialization.
Definition: arch.c:41
struct mapdef * map
Pointer to the map in which this object is present.
Definition: object.h:297
static void local_check_loaded_object(object *op)
#define snprintf
Definition: win32.h:46
int16_t dam
How much damage this object does when hitting.
Definition: living.h:45
const char * name
The name of the object, obviously...
Definition: object.h:311
struct obj * env
Pointer to the object which is the environment.
Definition: object.h:293
int8_t gen_sp_armour
Sp regen penalty this object has (was last_heal)
Definition: object.h:363
struct obj * below
Pointer to the object stacked below this one.
Definition: object.h:287
struct archt * more
Next part of a linked object.
Definition: object.h:469
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
Definition: define.h:375
See Potion.
Definition: object.h:111
int8_t item_power
Power rating of the object.
Definition: object.h:362
float speed
The overall speed of this object.
Definition: object.h:328
void init(int argc, char **argv)
This is the main server initialization function.
Definition: init.c:978
#define QUERY_FLAG(xyz, p)
Definition: define.h:225
void generate_artifact(object *op, int difficulty)
Decides randomly which artifact the object should be turned into.
Definition: artifact.c:155
See Magic Wall.
Definition: object.h:168
See Converter.
Definition: object.h:216
int16_t x
Definition: object.h:326
const char * skill
Name of the skill this object uses/grants.
Definition: object.h:321
int calc_item_power(const object *op)
This takes an object &#39;op&#39; and figures out what its item_power rating should be.
Definition: item.c:246
int Ysize
Definition: random_map.h:70
uint16_t difficulty
What level the player should be to play here.
Definition: map.h:343
int Xsize
Definition: random_map.h:69
int save_map(mapstruct *m, int flag)
Saves a map to file.
Definition: map.c:1436
char origin_map[RM_SIZE]
Path to the map this random map is generated from, to make an exit back.
Definition: random_map.h:50
See Shield.
Definition: object.h:135
START_TEST(test_randommaps)
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
Definition: object.h:372
#define FLAG_GENERATOR
Will generate type ob->stats.food.
Definition: define.h:248
See Altar.
Definition: object.h:122
int set_random_map_variable(RMParms *rp, const char *buf)
#define RANDOM()
Definition: define.h:679
const char *const spell_mapping[]
#define MAP_PLAYER_UNIQUE
This map is player-specific.
Definition: map.h:97
int origin_y
Definition: random_map.h:83
static END_TEST Suite * bug_suite(void)
living stats
Str, Con, Dex, etc.
Definition: object.h:368
struct archt * arch
Pointer to archetype.
Definition: object.h:412
#define MAP_WIDTH(m)
Map width.
Definition: map.h:78
Only for debugging purposes.
Definition: logger.h:13
static void teardown(void)
Definition: check_1727944.c:43
uint8_t type
PLAYER, BULLET, etc.
Definition: object.h:338
struct regiondef * region
Definition: random_map.h:91
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
Definition: map.c:1741
void apply_auto_fix(mapstruct *m)
Go through the entire map (only the first time when an original map is loaded) and performs special a...
Definition: main.c:261
sstring add_string(const char *str)
This will add &#39;str&#39; to the hash table.
Definition: shstr.c:124
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
Definition: define.h:674
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
Definition: map.h:172
#define FLAG_MONSTER
Will attack players.
Definition: define.h:245
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
Definition: object.c:838
struct obj * inv
Pointer to the first object in the inventory.
Definition: object.h:290
See Gloves.
Definition: object.h:213
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
Definition: logger.c:51
void set_materialname(object *op)
Set the material name and type for an item, if not set.
Definition: utils.c:300
This is a game-map.
Definition: map.h:325
static void setup(void)
Definition: check_1727944.c:39
int origin_x
Definition: random_map.h:84
See Breastplate Armor.
Definition: object.h:120
int16_t level
Level of creature or object.
Definition: object.h:351
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
Definition: arch.c:571
#define FLAG_CONTENT_ON_GEN
Definition: define.h:374
void object_update_speed(object *op)
Updates the speed of an object.
Definition: object.c:1129
int32_t value
How much money it is worth (or contains)
Definition: object.h:350
archetype * get_archetype_struct(void)
Allocates, initialises and returns the pointer to an archetype structure.
Definition: arch.c:312
const char * name
More definite name, like "generate_kobold".
Definition: object.h:466
#define SAVE_MODE_OVERLAY
Map is persisted as an overlay.
Definition: map.h:122
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
Definition: object.c:1654