Crossfire Server, Trunk
check_object.cpp
Go to the documentation of this file.
1 /*
2  * static char *rcsid_check_object_c =
3  * "$Id$";
4  */
5 
6 /*
7  * CrossFire, A Multiplayer game for X-windows
8  *
9  * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
10  * Copyright (C) 1992 Frank Tore Johansen
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  *
26  * The authors can be reached via e-mail at crossfire-devel@real-time.com
27  */
28 
29 /*
30  * This is the unit tests file for common/object.c
31  */
32 
33 #include <global.h>
34 #include <stdlib.h>
35 #include <check.h>
36 #include <loader.h>
37 #include <toolkit_common.h>
38 
39 #include "stringbuffer.h"
40 
41 static void setup(void) {
42  cctk_setdatadir(SOURCE_ROOT "lib");
43  cctk_setlog(LOGDIR "/unit/common/object.out");
44  printf("set log to %s\n", LOGDIR"/unit/common/object.out");
46 }
47 
48 static void teardown(void) {
49  /* put any cleanup steps here, they will be run after each testcase */
50 }
51 
52 /*
53  * Things to check
54  * object_update_turn_face
55  * object_update_speed
56  * object_remove_from_active_list
57  * object_update
58  * object_free_drop_inventory
59  * object_count_free
60  * object_count_used
61  * object_count_active
62  * object_sub_weight
63  * object_remove
64  * object_merge
65  * object_insert_in_map_at
66  * object_insert_in_map
67  * object_replace_insert_in_map
68  * object_split
69  * object_decrease_nrof
70  * object_add_weight
71  * object_insert_in_ob
72  * object_check_move_on
73  * map_find_by_archetype
74  * map_find_by_type
75  * object_present_in_ob
76  * object_present_in_ob_by_name
77  * arch_present_in_ob
78  * object_set_flag_inv
79  * object_unset_flag_inv
80  * object_set_cheat
81  * object_find_free_spot
82  * object_find_first_free_spot
83  * get_search_arr
84  * object_distance
85  * find_dir_2
86  * absdir
87  * dirdiff
88  * can_see_monsterP
89  * object_can_pick
90  * object_create_clone
91  * object_was_destroyed
92  * object_find_by_type_subtype
93  * object_get_key_value
94  * object_get_value
95  * object_set_value
96  * object_matches_string
97  */
101 START_TEST(test_object_can_merge) {
102  object *ob1;
103  object *ob2;
104 
107  fail_unless(object_can_merge(ob1, ob2), "Should be able to merge 2 same object");
108  ob2->name = add_string("Not same name");
109  fail_unless(!object_can_merge(ob1, ob2), "Should not be able to merge 2 object with different names");
111  ob2->type++;
112  fail_unless(!object_can_merge(ob1, ob2), "Should not be able to merge 2 object with different types");
114  ob1->nrof = (1UL<<31)-1;
115  ob2->nrof = 1;
116  fail_unless(!object_can_merge(ob1, ob2), "Should not be able to merge 2 object if result nrof goes to 1<<31 or higher");
117  /*TESTME*/
118 }
119 END_TEST
120 
124 START_TEST(test_object_sum_weight) {
125  object *ob1;
126  object *ob2;
127  object *ob3;
128  object *ob4;
129  unsigned long sum;
130 
133  ob3 = cctk_create_game_object(NULL);
134  ob4 = cctk_create_game_object(NULL);
135  ob1->weight = 10; /*This should not be taken into account by object_sum_weight*/
136  ob1->type = CONTAINER;
137  ob1->stats.Str = 40; /*40% reduction of weight*/
138  ob2->weight = 6;
139  ob2->nrof = 10;
140  ob3->weight = 7;
141  ob4->weight = 8;
143  object_insert_in_ob(ob3, ob1);
144  object_insert_in_ob(ob4, ob1);
145  sum = object_sum_weight(ob1);
146  fail_unless(sum == 45, "Sum of object's inventory should be 45 ((6*10+7+8)*.6) but was %lu.", sum);
147 }
148 END_TEST
149 
153 START_TEST(test_object_get_env_recursive) {
154  object *ob1;
155  object *ob2;
156  object *ob3;
157  object *ob4;
158  object *result;
159 
162  ob3 = cctk_create_game_object(NULL);
163  ob4 = cctk_create_game_object(NULL);
165  object_insert_in_ob(ob3, ob2);
166  object_insert_in_ob(ob4, ob3);
168  fail_unless(result == ob1, "Getting top level container for ob4(%p) should bring ob1(%p) but brought %p.", ob4, ob1, result);
169 }
170 END_TEST
171 
175 START_TEST(test_object_get_player_container) {
176  object *ob1;
177  object *ob2;
178  object *ob3;
179  object *ob4;
180  object *result;
181 
184  ob3 = cctk_create_game_object(NULL);
185  ob4 = cctk_create_game_object(NULL);
187  object_insert_in_ob(ob3, ob2);
188  object_insert_in_ob(ob4, ob3);
190  fail_unless(result == NULL, "Getting containing player for ob4(%p) should bring NULL but brought %p while not contained in a player.", ob4, result);
191  ob1->type = PLAYER;
193  fail_unless(result == ob1, "Getting containing player for ob4(%p) should bring ob1(%p) but brought %p while ob1 is player.", ob4, ob1, result);
194 }
195 END_TEST
196 
200 START_TEST(test_object_dump) {
201  object *ob1;
202  object *ob2;
203  object *ob3;
204  StringBuffer *sb;
205  char *result;
206 
209  ob3 = cctk_create_game_object(NULL);
211  object_insert_in_ob(ob3, ob2);
212  sb = stringbuffer_new();
213  object_dump(ob1, sb);
215  fail_unless(strstr(result, "arch") != NULL, "The object dump should contain 'arch' but was %s", sb);
216  free(result);
217 }
218 END_TEST
219 
223 START_TEST(test_object_dump_all) {
227  object_dump_all(); /*Should not crash, that all i can test*/
228 }
229 END_TEST
230 
234 START_TEST(test_object_find_by_tag_global) {
235  object *ob1;
236  object *result;
237 
242  fail_unless(result == ob1, "Should find ob1(%p) while search for item %d but got %p", ob1, ob1->count, result);
243 }
244 END_TEST
245 
249 START_TEST(test_object_find_by_name_global) {
250  object *ob1;
251  object *result;
252 
254  ob1->name = add_string("This is a name");
256  ob1->name = add_string("This is another name");
258  ob1->name = add_string("This is the key name");
259  result = object_find_by_name_global(add_string("This is the key name"));
260  fail_unless(result == ob1, "Searching for object with name 'This is the key name' returned %p(%s) instead of ob1(%p)", result, result ? result->name : "null", ob1);
261 }
262 END_TEST
263 
267 START_TEST(test_object_free_all_data) {
268  /*TESTME*/
269 }
270 END_TEST
271 
275 START_TEST(test_object_get_owner) {
276  object *ob1;
277  object *ob2;
278 
284  fail_unless(object_get_owner(ob2) == ob1, "Owner of ob2(%p) shoud be ob1(%p) but was %p", ob2, ob1, object_get_owner(ob2));
285 }
286 END_TEST
287 
291 START_TEST(test_object_clear_owner) {
292  object *ob1;
293  object *ob2;
294 
298  fail_unless(ob2->owner != NULL, "Prior to testing object_clear_owner, owner of ob2 was wrongly initialized"); /* XXX: use object_get_owner() */
300  fail_unless(ob2->owner == NULL, "After object_clear_owner ob2 still had an owner"); /* XXX: use object_get_owner() */
301 }
302 END_TEST
303 
307 START_TEST(test_object_set_owner) {
308  object *ob1;
309  object *ob2;
310 
314  fail_unless(ob2->owner == ob1, "After object_set_owner ob2(%p) owner should be ob1(%p) but was (%p)", ob2, ob1, ob2->owner); /* XXX: use object_get_owner() */
315 }
316 END_TEST
317 
321 START_TEST(test_object_copy_owner) {
322  object *ob1;
323  object *ob2;
324  object *ob3;
325 
328  ob3 = cctk_create_game_object(NULL);
330  object_copy_owner(ob3, ob2);
331  fail_unless(object_get_owner(ob2) == object_get_owner(ob3), "After object_copy_owner, ob3 and ob2 should have same owner (ob1=%p) but got %p and %p", object_get_owner(ob3), object_get_owner(ob2));
332 }
333 END_TEST
334 
338 START_TEST(test_object_reset) {
339  object *ob1;
340 
342  object_reset(ob1);
343  fail_unless(ob1->name == NULL, "Field name of ob1 was not NULLified by object_reset");
344  fail_unless(ob1->name_pl == NULL, "Field name_pl of ob1 was not NULLified by object_reset");
345  fail_unless(ob1->title == NULL, "Field title of ob1 was not NULLified by object_reset");
346  fail_unless(ob1->race == NULL, "Field race of ob1 was not NULLified by object_reset");
347  fail_unless(ob1->slaying == NULL, "Field slaying of ob1 was not NULLified by object_reset");
348  fail_unless(ob1->skill == NULL, "Field skill of ob1 was not NULLified by object_reset");
349  fail_unless(ob1->msg == NULL, "Field msg of ob1 was not NULLified by object_reset");
350  fail_unless(ob1->materialname == NULL, "Field materialname of ob1 was not NULLified by object_reset");
351  fail_unless(ob1->lore == NULL, "Field lore of ob1 was not NULLified by object_reset");
352 }
353 END_TEST
354 
358 START_TEST(test_object_clear) {
359  object *ob1;
360  const char *reference;
361 
363  cctk_set_object_strings(ob1, "This is a test String");
364  reference = add_string("This is a test String");
365  object_clear(ob1);
366  fail_unless(ob1->name == NULL, "Field name of ob1 was not cleaned by object_clear");
367  fail_unless(ob1->name_pl == NULL, "Field name_pl of ob1 was not cleaned by object_clear");
368  fail_unless(ob1->title == NULL, "Field title of ob1 was not cleaned by object_clear");
369  fail_unless(ob1->race == NULL, "Field race of ob1 was not cleaned by object_clear");
370  fail_unless(ob1->slaying == NULL, "Field slaying of ob1 was not cleaned by object_clear");
371  fail_unless(ob1->skill == NULL, "Field skill of ob1 was not cleaned by object_clear");
372  fail_unless(ob1->msg == NULL, "Field msg of ob1 was not cleaned by object_clear");
373  fail_unless(ob1->materialname == NULL, "Field materialname of ob1 was not cleaned by object_clear");
374  fail_unless(ob1->lore == NULL, "Field lore of ob1 was not cleaned by object_clear");
375  fail_unless(query_refcount(reference) == 1, "The number of references to string should drop back to 1 but was %d", query_refcount(reference));
376 }
377 END_TEST
378 
382 START_TEST(test_object_copy) {
383  object *ob1;
384  object *ob2;
385  const char *reference;
386  key_value *kv;
387 
390  cctk_set_object_strings(ob1, "test String1");
391  object_set_value(ob1, "some_key", "value", 1);
392  object_set_value(ob1, "some_other_key", "another_value", 1);
393  object_set_value(ob2, "random", "bla", 1);
394  object_set_value(ob2, "?!?", "!!!", 1);
395  cctk_set_object_strings(ob2, "test String2");
396  reference = add_string("test String2");
397  object_copy(ob1, ob2);
398  fail_unless(ob1->name == ob2->name, "Field name of ob1 should match ob2");
399  fail_unless(ob1->name_pl == ob2->name_pl, "Field name_pl of ob1 should match ob2");
400  fail_unless(ob1->title == ob2->title, "Field title of ob1 should match ob2");
401  fail_unless(ob1->race == ob2->race, "Field race of ob1 should match ob2");
402  fail_unless(ob1->slaying == ob2->slaying, "Field slaying of ob1 should match ob2");
403  fail_unless(ob1->skill == ob2->skill, "Field skill of ob1 should match ob2");
404  fail_unless(ob1->msg == ob2->msg, "Field msg of ob1 should match ob2");
405  fail_unless(ob1->materialname == ob2->materialname, "Field materialname of ob1 should match ob2");
406  fail_unless(ob1->lore == ob2->lore, "Field lore of ob1 should match ob2");
407  fail_unless(query_refcount(reference) == 1, "refcount of marker string is not dropped to 1 after copy object, some string field were not cleaned. refcount: %d", query_refcount(reference));
408 
409  fail_unless(ob2->key_values, "Key values should have been copied");
410  kv = ob2->key_values;
411  fail_unless(strcmp(kv->key, "some_other_key") == 0, "Wrong first key %s", ob2->key_values->key);
412  fail_unless(strcmp(kv->value, "another_value") == 0, "Wrong first value %s", ob2->key_values->value);
413  kv = kv->next;
414  fail_unless(kv, "Missing second key/value");
415  fail_unless(strcmp(kv->key, "some_key") == 0, "Wrong second key %s", ob2->key_values->key);
416  fail_unless(strcmp(kv->value, "value") == 0, "Wrong second value %s", ob2->key_values->value);
417  kv = kv->next;
418  fail_unless(kv == NULL, "Third key/value?!?");
419 }
420 END_TEST
421 
426 START_TEST(test_object_new) {
427  object *ob;
428  long int i;
429 
430  ob = object_new();
431  fail_unless(ob != NULL, "Should get an object after calling object_new()");
432  fail_unless(ob->name == NULL, "Field name has not been nullified by object_new()");
433  fail_unless(ob->name_pl == NULL, "Field name_pl has not been nullified by object_new()");
434  fail_unless(ob->title == NULL, "Field title has not been nullified by object_new()");
435  fail_unless(ob->race == NULL, "Field race has not been nullified by object_new()");
436  fail_unless(ob->slaying == NULL, "Field slaying has not been nullified by object_new()");
437  fail_unless(ob->skill == NULL, "Field skill has not been nullified by object_new()");
438  fail_unless(ob->lore == NULL, "Field lore has not been nullified by object_new()");
439  fail_unless(ob->msg == NULL, "Field msg has not been nullified by object_new()");
440  fail_unless(ob->materialname == NULL, "Field materialname has not been nullified by object_new()");
441  fail_unless(ob->prev == NULL, "Field prev has not been nullified by object_new()");
442  fail_unless(ob->active_next == NULL, "Field active_next has not been nullified by object_new()");
443  fail_unless(ob->active_prev == NULL, "Field active_prev has not been nullified by object_new()");
444  /* did you really thing i'll go with only one object? */
445  /* let's go for about 2M allocations in a row, let's test roughness */
446  for (i = 0; i < 1L<<17; i++) {
447  ob = object_new();
448  fail_unless(ob != NULL, "Should get an object after calling object_new() (iteration %l)", i);
449  if (!(i&((1<<13)-1)))
450  LOG(llevDebug, "%ldk items created with object_new\n", i>>10);
451  }
452 }
453 END_TEST
454 
458 START_TEST(test_object_update_turn_face) {
459  object *ob1;
460  const Face *face1;
461  const Face *face2;
462 
463  ob1 = cctk_create_game_object("arrow");
464  ob1->direction = 1;
466  face1 = ob1->face;
467  ob1->direction = 0;
469  face2 = ob1->face;
470  fail_unless(face2 != face1, "2 opposite direction should provide different faces after object_update_turn_face");
471 }
472 END_TEST
473 
474 #define IS_OBJECT_ACTIVE(op) (op->active_next || op->active_prev || op == active_objects)
475 
478 START_TEST(test_object_update_speed) {
479  object *ob1;
480  object *ob2;
481  object *ob3;
482  object *ob4;
483 
486  ob3 = cctk_create_game_object(NULL);
487  ob4 = cctk_create_game_object(NULL);
488  ob1->speed = MIN_ACTIVE_SPEED;
490  fail_unless(!IS_OBJECT_ACTIVE(ob1), "Object with absolute speed <=MIN_ACTIVE_SPEED(%f) should not be made active (speed=%f)", MIN_ACTIVE_SPEED, ob1->speed);
491  ob1->speed = -MIN_ACTIVE_SPEED;
493  fail_unless(!IS_OBJECT_ACTIVE(ob1), "Object with absolute speed <=MIN_ACTIVE_SPEED(%f) should not be made active (speed=%f)", MIN_ACTIVE_SPEED, ob1->speed);
494  ob1->speed = MIN_ACTIVE_SPEED*2;
496  fail_unless(IS_OBJECT_ACTIVE(ob1), "Object with absolute speed >MIN_ACTIVE_SPEED(%f) should be made active (speed=%f)", MIN_ACTIVE_SPEED, ob1->speed);
497  ob2->speed = -MIN_ACTIVE_SPEED*2;
499  fail_unless(IS_OBJECT_ACTIVE(ob2), "Object with absolute speed >MIN_ACTIVE_SPEED(%f) should be made active (speed=%f)", MIN_ACTIVE_SPEED, ob2->speed);
500  ob4->speed = ob3->speed = ob2->speed;
501  object_update_speed(ob3);
502  object_update_speed(ob4);
503  fail_unless(IS_OBJECT_ACTIVE(ob3), "Object with absolute speed >MIN_ACTIVE_SPEED(%f) should be made active (speed=%f)", MIN_ACTIVE_SPEED, ob3->speed);
504  fail_unless(IS_OBJECT_ACTIVE(ob4), "Object with absolute speed >MIN_ACTIVE_SPEED(%f) should be made active (speed=%f)", MIN_ACTIVE_SPEED, ob4->speed);
505  ob1->speed = 0.0;
506  ob2->speed = 0.0;
507  ob3->speed = 0.0;
508  ob4->speed = 0.0;
511  object_update_speed(ob3);
512  object_update_speed(ob4);
513  fail_unless(!IS_OBJECT_ACTIVE(ob1), "Object with absolute speed 0.0 should be inactivated", ob1->speed);
514  fail_unless(!IS_OBJECT_ACTIVE(ob2), "Object with absolute speed 0.0 should be inactivated", ob2->speed);
515  fail_unless(!IS_OBJECT_ACTIVE(ob3), "Object with absolute speed 0.0 should be inactivated", ob3->speed);
516  fail_unless(!IS_OBJECT_ACTIVE(ob4), "Object with absolute speed 0.0 should be inactivated", ob4->speed);
517 }
518 END_TEST
519 
523 START_TEST(test_object_remove_from_active_list) {
524  object *ob1;
525 
527  ob1->speed = MIN_ACTIVE_SPEED*2;
529  fail_unless(IS_OBJECT_ACTIVE(ob1), "Object with absolute speed >MIN_ACTIVE_SPEED(%f) should be made active (speed=%f)", MIN_ACTIVE_SPEED, ob1->speed);
531  fail_unless(!IS_OBJECT_ACTIVE(ob1), "After call to object_remove_from_active_list, object should be made inactive");
532 }
533 END_TEST
534 #undef IS_OBJECT_ACTIVE
535 
539 START_TEST(test_object_update) {
540  /*TESTME (this one need a map loading, left for later*/
541 }
542 END_TEST
543 
547 START_TEST(test_object_free_drop_inventory) {
548  object *ob1;
549  object *ob2;
550 
555  fail_unless(QUERY_FLAG(ob1, FLAG_FREED), "Freeing ob1 should mark it freed");
556  fail_unless(QUERY_FLAG(ob2, FLAG_FREED), "Freeing ob1 should mark it's content freed");
557 }
558 END_TEST
559 
563 START_TEST(test_object_count_free) {
564  int free1, free2;
565 
567  free1 = object_count_free();
569  free2 = object_count_free();
570  /* Behaviour under MEMORY_DEBUG is to allocate each object separately so
571  * both will be 0. Allow test suite to pass with this option.
572  */
573 #ifdef MEMORY_DEBUG
574  fail_unless(((free2 == 0) && (free1 == 0)), "after creating an object, the object_count_free() should return 0 (compiled with MEMORY_DEBUG)", free1-1, free2);
575 #else
576  fail_unless((free2 == free1-1), "after creating an object, the object_count_free() should return one less (%d) but returned %d", free1-1, free2);
577 #endif
578 }
579 END_TEST
580 
584 START_TEST(test_object_count_used) {
585  int used1, used2;
586 
588  used1 = object_count_used();
590  used2 = object_count_used();
591  fail_unless((used2 == used1+1), "after creating an object, the object_count_used() should return one more (%d) but returned %d", used1-1, used2);
592 }
593 END_TEST
594 
598 START_TEST(test_object_count_active) {
599  object *ob1;
600  int active1, active2;
601 
603  ob1->speed = MIN_ACTIVE_SPEED*2;
605  active1 = object_count_active();
607  ob1->speed = MIN_ACTIVE_SPEED*2;
609  active2 = object_count_active();
610  fail_unless((active2 == active1+1), "after activating an additional object, object_count_active should return one less %d but returned %d", active1-1, active2);
611 }
612 END_TEST
613 
617 START_TEST(test_object_sub_weight) {
618  object *ob1;
619  object *ob2;
620  object *ob3;
621  object *ob4;
622  unsigned long sum;
623 
626  ob3 = cctk_create_game_object(NULL);
627  ob4 = cctk_create_game_object(NULL);
628  ob1->weight = 10; /*This should not be taken into account by object_sum_weight*/
629  ob1->type = CONTAINER;
630  ob2->type = CONTAINER;
631  ob3->type = CONTAINER;
632  ob1->stats.Str = 40; /*40% reduction of weight*/
633  ob2->weight = 10;
634  ob3->weight = 10;
635  ob4->weight = 10;
637  object_insert_in_ob(ob3, ob2);
638  object_insert_in_ob(ob4, ob3);
639  sum = object_sum_weight(ob1);
640  fail_unless(sum == 18, "Sum of object's inventory should be 18 (30*0.6+10) but was %lu.", sum);
641  object_sub_weight(ob4, 10);
642  fail_unless(ob1->carrying == 12, "after call to object_sub_weight, carrying of ob1 should be 22 but was %d", ob1->carrying);
643 }
644 END_TEST
645 
649 START_TEST(test_object_remove) {
650  /*TESTME test those
651  * ob with more
652  * player inv
653  * remove from map
654  */
655 }
656 END_TEST
657 
661 START_TEST(test_object_merge) {
662  object *ob1;
663  object *ob2;
664  object *ob3;
665  object *ob4;
666 
669  ob3 = cctk_create_game_object(NULL);
670  ob4 = cctk_create_game_object(NULL);
672  ob1->below = ob2;
673  ob2->below = ob3;
674  ob3->below = ob4;
675  ob2->above = ob1;
676  ob3->above = ob2;
677  ob4->above = ob3;
678  ob1->name = add_string("test");
679  ob2->name = add_string("test2");
680  ob3->name = add_string("test3");
681 }
682 END_TEST
683 
687 START_TEST(test_object_insert_in_map_at) {
688  mapstruct *map;
689  object *first = NULL;
690  object *got = NULL;
691 
692  map = get_empty_map(5, 5);
693  fail_unless(map != NULL, "get_empty_map returned NULL.");
694 
695  /* Single tile object */
696  first = cctk_create_game_object("barrel");
697  fail_unless(first != NULL, "create barrel failed");
698 
699  got = object_insert_in_map_at(first, map, NULL, 0, 0, 0);
700  fail_unless(got == first, "item shouldn't be destroyed");
701 
702  first = cctk_create_game_object("dragon");
703  fail_unless(first != NULL, "create dragon failed");
704  fail_unless(first->more != NULL, "no other body part");
705 
706  got = object_insert_in_map_at(first, map, NULL, 0, 1, 1);
707  fail_unless(got == first, "item shouldn't be destroyed");
708 
709  fail_unless(GET_MAP_OB(map, 1, 1) == first, "item isn't on 1,1");
710  fail_unless(GET_MAP_OB(map, 2, 1) != NULL, "no item on 2,1");
711  fail_unless(GET_MAP_OB(map, 2, 1)->head == first, "head of 2,1 isn't 1,1");
712 }
713 END_TEST
714 
718 START_TEST(test_object_insert_in_map) {
719  mapstruct *map;
720  object *first = NULL;
721  object *second = NULL;
722  object *third = NULL;
723  object *floor = NULL;
724  object *got = NULL;
725 
726  map = get_empty_map(5, 5);
727  fail_unless(map != NULL, "get_empty_map returned NULL.");
728 
729  /* First, simple tests for insertion. */
730  floor = cctk_create_game_object("woodfloor");
731  fail_unless(floor != NULL, "create woodfloor failed");
732  floor->x = 3;
733  floor->y = 3;
734 
735  got = object_insert_in_map(floor, map, NULL, 0);
736  fail_unless(got == floor, "woodfloor shouldn't disappear");
737  fail_unless(floor == GET_MAP_OB(map, 3, 3), "woodfloor should be first object");
738 
739  first = cctk_create_game_object("barrel");
740  fail_unless(first != NULL, "create barrel failed");
741  first->x = 3;
742  first->y = 3;
743 
744  got = object_insert_in_map(first, map, NULL, 0);
745  fail_unless(got == first, "barrel shouldn't disappear");
746  fail_unless(floor == GET_MAP_OB(map, 3, 3), "woodfloor should still be first object");
747  fail_unless(floor->above == first, "barrel should be above floor");
748 
749  second = cctk_create_game_object("gem");
750  fail_unless(second != NULL, "create gem failed");
751  second->nrof = 1;
752  second->x = 3;
753  second->y = 3;
754 
756  fail_unless(got == second, "gem shouldn't disappear");
757  fail_unless(floor == GET_MAP_OB(map, 3, 3), "woodfloor should still be first object");
758  fail_unless(floor->above == second, "gem should be above floor");
759  fail_unless(second->above == first, "barrel should be above gem");
760 
761  third = cctk_create_game_object("bed_1");
762  fail_unless(third != NULL, "create bed_1 failed");
763  third->nrof = 1;
764  third->x = 3;
765  third->y = 3;
766 
768  fail_unless(got == third, "bed_1 shouldn't disappear");
769  fail_unless(floor == GET_MAP_OB(map, 3, 3), "woodfloor should still be first object");
770  fail_unless(third->above == first, "bed should be below barrel");
771  fail_unless(third->below == second, "bed should be above gem");
772 
773  /* Merging tests. */
774  third = cctk_create_game_object("gem");
775  fail_unless(third != NULL, "create gem failed");
776  third->nrof = 1;
777  third->x = 3;
778  third->y = 3;
779 
780  got = object_insert_in_map(third, map, NULL, 0);
781  fail_unless(got == third, "gem shouldn't disappear");
782  fail_unless(QUERY_FLAG(second, FLAG_FREED), "first gem should have been removed.");
783  fail_unless(third->nrof == 2, "second gem should have nrof 2");
784 
785  second = cctk_create_game_object("gem");
786  fail_unless(second != NULL, "create gem failed");
787  second->nrof = 1;
788  second->x = 3;
789  second->y = 3;
790  second->value = 1;
791 
792  got = object_insert_in_map(second, map, NULL, 0);
793  fail_unless(got == second, "modified gem shouldn't disappear");
794  fail_unless(second->nrof == 1, "modified gem should have nrof 1");
795 
796  /* Now check sacrificing, on another spot.
797  * Can't work here, as altar logic is in server.
798  * -> move that there.
799  */
800 /*
801  first = cctk_create_game_object("altar");
802  fail_unless(first != NULL, "create altar failed");
803  first->x = 2;
804  first->y = 2;
805  first->stats.food = 5;
806  first->value = 0;
807  fail_unless(object_insert_in_map(first, map, NULL, 0) == first, "altar shouldn't disappear");
808  fail_unless(GET_MAP_MOVE_ON(map, 2, 2)&MOVE_WALK == MOVE_WALK, "floor should have MOVE_WALK set");
809 
810  second = cctk_create_game_object("food");
811  fail_unless(second != NULL, "create food failed");
812  second->nrof = 5;
813  second->x = 2;
814  second->y = 2;
815  got = object_insert_in_map(second, map, NULL, 0);
816  fail_unless(got == NULL, "object_insert_in_map(food) should have returned NULL");
817  fail_unless(QUERY_FLAG(second, FLAG_FREED), "food should have been freed");
818 */
819 }
820 END_TEST
821 
822 
826 START_TEST(test_object_replace_insert_in_map) {
827  mapstruct *map;
828  object *first = NULL, *second = NULL, *third = NULL;
829  tag_t tag_first, tag_second, tag_third;
830  object *got = NULL;
831 
832  map = get_empty_map(5, 5);
833  fail_unless(map != NULL, "get_empty_map returned NULL.");
834 
835  /* Single tile object */
836  first = cctk_create_game_object("barrel");
837  fail_unless(first != NULL, "create barrel failed");
838  tag_first = first->count;
839 
840  got = object_insert_in_map_at(first, map, NULL, 0, 0, 0);
841  fail_unless(got == first, "item shouldn't be destroyed");
842 
843  second = cctk_create_game_object("table");
844  fail_unless(second != NULL, "create table failed");
845 
846  got = object_insert_in_map_at(second, map, NULL, 0, 0, 0);
847  fail_unless(got == second, "second item shouldn't be destroyed");
848  tag_second = second->count;
849 
850  third = cctk_create_game_object("barrel");
851  fail_unless(third != NULL, "create 2nd barrel failed");
852  got = object_insert_in_map_at(third, map, NULL, 0, 0, 0);
853  fail_unless(got == third, "second barrel shouldn't be destroyed");
854  tag_third = third->count;
855 
856  fail_unless(GET_MAP_OB(map, 0, 0) == first, "item at 0,0 isn't barrel");
857  fail_unless(GET_MAP_OB(map, 0, 0)->above == second, "second item at 0,0 isn't table");
858  fail_unless(GET_MAP_OB(map, 0, 0)->above->above == third, "third item at 0,0 isn't barrel");
859 
860  object_replace_insert_in_map("barrel", second);
861 
862  fail_unless(GET_MAP_OB(map, 0, 0) != first, "item at 0, 0 is still first?");
863  fail_unless(object_was_destroyed(first, tag_first), "1st barrel should be destroyed");
864  fail_unless(!object_was_destroyed(second, tag_second), "table shouldn't be destroyed");
865  fail_unless(object_was_destroyed(third, tag_third), "2nd barrel should be destroyed");
866 
867  fail_unless(GET_MAP_OB(map, 0, 0) != NULL, "no item at 0,0 after object_replace_insert_in_map");
868  fail_unless(GET_MAP_OB(map, 0, 0) != second, "second at bottom at 0,0 after object_replace_insert_in_map");
869  fail_unless(GET_MAP_OB(map, 0, 0)->above == second, "table isn't above new barrel");
870  fail_unless(strcmp(GET_MAP_OB(map, 0, 0)->arch->name, "barrel") == 0, "item at 0,0 is not a barrel after object_replace_insert_in_map");
871 }
872 END_TEST
873 
877 START_TEST(test_object_split) {
878  object *first = NULL;
879  object *second = NULL;
880  char err[50];
881 
882  first = cctk_create_game_object("gem");
883  fail_unless(first != NULL, "create gem failed");
884  first->nrof = 5;
885 
886  second = object_split(first, 2, err, sizeof(err));
887  fail_unless(second != NULL, "should return an item");
888  fail_unless(second->nrof == 2, "2 expected to split");
889  fail_unless(first->nrof == 3, "3 should be left");
890 
891  second = object_split(first, 3, err, sizeof(err));
892  fail_unless(second != NULL, "should return an item");
893  fail_unless(QUERY_FLAG(first, FLAG_FREED), "first should be freed");
894 
895  first = object_split(second, 10, err, sizeof(err));
896  fail_unless(first == NULL, "should return NULL");
897  fail_unless(second->nrof == 3, "3 should be left");
898 }
899 END_TEST
900 
904 START_TEST(test_object_decrease_nrof) {
905  object *first = NULL;
906  object *second = NULL;
907 
908  first = cctk_create_game_object("gem");
909  fail_unless(first != NULL, "create gem failed");
910  first->nrof = 5;
911 
912  second = object_decrease_nrof(first, 3);
913  fail_unless(second == first, "gem shouldn't be destroyed");
914 
915  second = object_decrease_nrof(first, 2);
916  fail_unless(second == NULL, "object_decrease_nrof should return NULL");
917  fail_unless(QUERY_FLAG(first, FLAG_FREED), "gem should have been freed");
918 }
919 END_TEST
920 
924 START_TEST(test_object_add_weight) {
925  /*TESTME*/
926 }
927 END_TEST
928 
932 START_TEST(test_object_insert_in_ob) {
933  object *container = NULL;
934  object *item = NULL;
935 
936  item = cctk_create_game_object("gem");
937  fail_unless(item != NULL, "create gem failed");
938  item->weight = 50;
939 
940  /* Bookshelves have no weight reduction. */
941  container = cctk_create_game_object("bookshelf");
942  fail_unless(container != NULL, "create bookshelf failed");
943 
944  object_insert_in_ob(item, container);
945  fail_unless(container->inv == item, "item not inserted");
946  fail_unless(container->carrying == 50, "container should carry 50 and not %d", container->carrying);
947 
949  fail_unless(container->carrying == 0, "container should carry 0 and not %d", container->carrying);
950 
951  /* Sacks have a Str of 10, so will reduce the weight. */
952  container = cctk_create_game_object("sack");
953  fail_unless(container != NULL, "create sack failed");
954 
955  object_insert_in_ob(item, container);
956  fail_unless(container->inv == item, "item not inserted");
957  fail_unless(container->carrying == 45, "container should carry 45 and not %d", container->carrying);
958 }
959 END_TEST
960 
964 START_TEST(test_object_check_move_on) {
965  /*TESTME*/
966 }
967 END_TEST
968 
972 START_TEST(test_map_find_by_archetype) {
973  /*TESTME*/
974 }
975 END_TEST
976 
980 START_TEST(test_map_find_by_type) {
981  /*TESTME*/
982 }
983 END_TEST
984 
988 START_TEST(test_object_present_in_ob) {
989  /*TESTME*/
990 }
991 END_TEST
992 
996 START_TEST(test_object_present_in_ob_by_name) {
997  /*TESTME*/
998 }
999 END_TEST
1000 
1004 START_TEST(test_arch_present_in_ob) {
1005  /*TESTME*/
1006 }
1007 END_TEST
1008 
1012 START_TEST(test_object_set_flag_inv) {
1013  /*TESTME*/
1014 }
1015 END_TEST
1016 
1020 START_TEST(test_object_unset_flag_inv) {
1021  /*TESTME*/
1022 }
1023 END_TEST
1024 
1028 START_TEST(test_object_set_cheat) {
1029  /*TESTME*/
1030 }
1031 END_TEST
1032 
1036 START_TEST(test_object_find_free_spot) {
1037  /*TESTME*/
1038 }
1039 END_TEST
1040 
1044 START_TEST(test_object_find_first_free_spot) {
1045  /*TESTME*/
1046 }
1047 END_TEST
1048 
1052 START_TEST(test_get_search_arr) {
1053  /*TESTME*/
1054 }
1055 END_TEST
1056 
1060 START_TEST(test_object_distance) {
1061  /*TESTME*/
1062 }
1063 END_TEST
1064 
1068 START_TEST(test_find_dir_2) {
1069  /*TESTME*/
1070 }
1071 END_TEST
1072 
1076 START_TEST(test_absdir) {
1077  /*TESTME*/
1078 }
1079 END_TEST
1080 
1084 START_TEST(test_dirdiff) {
1085  /*TESTME*/
1086 }
1087 END_TEST
1088 
1092 START_TEST(test_can_see_monsterP) {
1093  /*TESTME*/
1094 }
1095 END_TEST
1096 
1100 START_TEST(test_object_can_pick) {
1101  /*TESTME*/
1102 }
1103 END_TEST
1104 
1108 START_TEST(test_object_create_clone) {
1109  /*TESTME*/
1110 }
1111 END_TEST
1112 
1116 START_TEST(test_object_was_destroyed) {
1117  /*TESTME*/
1118 }
1119 END_TEST
1120 
1124 START_TEST(test_object_find_by_type_subtype) {
1125  /*TESTME*/
1126 }
1127 END_TEST
1128 
1132 START_TEST(test_object_get_key_value) {
1133  /*TESTME*/
1134 }
1135 END_TEST
1136 
1140 START_TEST(test_object_get_value) {
1141  /*TESTME*/
1142 }
1143 END_TEST
1144 
1148 START_TEST(test_object_set_value) {
1149  /*TESTME*/
1150 }
1151 END_TEST
1152 
1156 START_TEST(test_object_matches_string) {
1157  object *pl;
1158  object *o1, *o2;
1159  int val;
1160 
1161  pl = cctk_create_game_object("kobold");
1162  fail_unless(pl != NULL, "couldn't create kobold");
1163  pl->contr = (player *)calloc(1, sizeof(player));
1164  fail_unless(pl->contr != NULL, "couldn't alloc contr");
1165 
1166  o1 = cctk_create_game_object("cloak");
1167  fail_unless(o1 != NULL, "couldn't find cloak archetype");
1168  o1->title = add_string("of Gorokh");
1170 
1171  val = object_matches_string(pl, o1, "all");
1172  fail_unless(val == 1, "all didn't match cloak");
1173  val = object_matches_string(pl, o1, "Gorokh");
1174  fail_unless(val == 0, "unidentified cloak matched title with value %d", val);
1175  val = object_matches_string(pl, o1, "random");
1176  fail_unless(val == 0, "unidentified cloak matched random value with value %d", val);
1177 
1179  val = object_matches_string(pl, o1, "Gorokh");
1180  fail_unless(val != 0, "identified cloak didn't match title with value %d", val);
1181 
1182  o2 = cctk_create_game_object("cloak");
1183  SET_FLAG(o2, FLAG_UNPAID);
1184  val = object_matches_string(pl, o2, "unpaid");
1185  fail_unless(val == 2, "unpaid cloak didn't match unpaid");
1186  val = object_matches_string(pl, o2, "cloak");
1187  fail_unless(val != 0, "unpaid cloak didn't match cloak with %d", val);
1188  val = object_matches_string(pl, o2, "wrong");
1189  fail_unless(val == 0, "unpaid cloak matched wrong name %d", val);
1190 }
1191 END_TEST
1192 
1193 static Suite *object_suite(void) {
1194  Suite *s = suite_create("object");
1195  TCase *tc_core = tcase_create("Core");
1196 
1197  /*setup and teardown will be called before each test in testcase 'tc_core' */
1198  tcase_add_unchecked_fixture(tc_core, setup, teardown);
1199 
1200  suite_add_tcase(s, tc_core);
1201  tcase_add_test(tc_core, test_object_can_merge);
1202  tcase_add_test(tc_core, test_object_sum_weight);
1203  tcase_add_test(tc_core, test_object_get_env_recursive);
1204  tcase_add_test(tc_core, test_object_get_player_container);
1205  tcase_add_test(tc_core, test_object_dump);
1206  tcase_add_test(tc_core, test_object_dump_all);
1207  tcase_add_test(tc_core, test_object_find_by_tag_global);
1208  tcase_add_test(tc_core, test_object_find_by_name_global);
1209  tcase_add_test(tc_core, test_object_free_all_data);
1210  tcase_add_test(tc_core, test_object_get_owner);
1211  tcase_add_test(tc_core, test_object_clear_owner);
1212  tcase_add_test(tc_core, test_object_set_owner);
1213  tcase_add_test(tc_core, test_object_copy_owner);
1214  tcase_add_test(tc_core, test_object_reset);
1215  tcase_add_test(tc_core, test_object_clear);
1216  tcase_add_test(tc_core, test_object_copy);
1217  tcase_add_test(tc_core, test_object_new);
1218  tcase_add_test(tc_core, test_object_update_turn_face);
1219  tcase_add_test(tc_core, test_object_update_speed);
1220  tcase_add_test(tc_core, test_object_remove_from_active_list);
1221  tcase_add_test(tc_core, test_object_update);
1222  tcase_add_test(tc_core, test_object_free_drop_inventory);
1223  tcase_add_test(tc_core, test_object_count_free);
1224  tcase_add_test(tc_core, test_object_count_used);
1225  tcase_add_test(tc_core, test_object_count_active);
1226  tcase_add_test(tc_core, test_object_sub_weight);
1227  tcase_add_test(tc_core, test_object_remove);
1228  tcase_add_test(tc_core, test_object_merge);
1229  tcase_add_test(tc_core, test_object_insert_in_map_at);
1230  tcase_add_test(tc_core, test_object_insert_in_map);
1231  tcase_add_test(tc_core, test_object_replace_insert_in_map);
1232  tcase_add_test(tc_core, test_object_split);
1233  tcase_add_test(tc_core, test_object_decrease_nrof);
1234  tcase_add_test(tc_core, test_object_add_weight);
1235  tcase_add_test(tc_core, test_object_insert_in_ob);
1236  tcase_add_test(tc_core, test_object_check_move_on);
1237  tcase_add_test(tc_core, test_map_find_by_archetype);
1238  tcase_add_test(tc_core, test_map_find_by_type);
1239  tcase_add_test(tc_core, test_object_present_in_ob);
1240  tcase_add_test(tc_core, test_object_present_in_ob_by_name);
1241  tcase_add_test(tc_core, test_arch_present_in_ob);
1242  tcase_add_test(tc_core, test_object_set_flag_inv);
1243  tcase_add_test(tc_core, test_object_unset_flag_inv);
1244  tcase_add_test(tc_core, test_object_set_cheat);
1245  tcase_add_test(tc_core, test_object_find_free_spot);
1246  tcase_add_test(tc_core, test_object_find_first_free_spot);
1247  tcase_add_test(tc_core, test_get_search_arr);
1248  tcase_add_test(tc_core, test_object_distance);
1249  tcase_add_test(tc_core, test_find_dir_2);
1250  tcase_add_test(tc_core, test_absdir);
1251  tcase_add_test(tc_core, test_dirdiff);
1252  tcase_add_test(tc_core, test_can_see_monsterP);
1253  tcase_add_test(tc_core, test_object_can_pick);
1254  tcase_add_test(tc_core, test_object_create_clone);
1255  tcase_add_test(tc_core, test_object_was_destroyed);
1256  tcase_add_test(tc_core, test_object_find_by_type_subtype);
1257  tcase_add_test(tc_core, test_object_get_key_value);
1258  tcase_add_test(tc_core, test_object_get_value);
1259  tcase_add_test(tc_core, test_object_set_value);
1260  tcase_add_test(tc_core, test_object_matches_string);
1261 
1262  return s;
1263 }
1264 
1265 int main(void) {
1266  int nf;
1267  SRunner *sr;
1268  Suite *s = object_suite();
1269 
1270  sr = srunner_create(s);
1271  srunner_set_xml(sr, LOGDIR "/unit/common/object.xml");
1272 /* if you wish to debug, uncomment the following line. */
1273 /* srunner_set_fork_status(sr, CK_NOFORK);*/
1274 
1275  srunner_run_all(sr, CK_ENV); /*verbosity from env variable*/
1276  nf = srunner_ntests_failed(sr);
1277  srunner_free(sr);
1278  return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
1279 }
object_was_destroyed
#define object_was_destroyed(op, old_tag)
Definition: object.h:68
GET_MAP_OB
#define GET_MAP_OB(M, X, Y)
Definition: map.h:173
Face
Definition: face.h:14
PLAYER
@ PLAYER
Definition: object.h:110
object_get_owner
object * object_get_owner(object *op)
Definition: object.cpp:804
global.h
object_clear_owner
void object_clear_owner(object *op)
Definition: object.cpp:823
object_get_env_recursive
object * object_get_env_recursive(object *op)
Definition: object.cpp:590
object_update_turn_face
void object_update_turn_face(object *op)
Definition: object.cpp:1332
object_count_active
int object_count_active(void)
Definition: object.cpp:1783
sunnista.got
def got
Definition: sunnista.py:87
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.cpp:51
get_empty_map
mapstruct * get_empty_map(int sizex, int sizey)
Definition: map.cpp:869
SET_FLAG
#define SET_FLAG(xyz, p)
Definition: define.h:224
obj::count
tag_t count
Definition: object.h:305
main
int main(void)
Definition: check_object.cpp:1265
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
obj::value
int32_t value
Definition: object.h:358
cctk_setdatadir
void cctk_setdatadir(const char *datadir)
Definition: toolkit_common.cpp:69
stringbuffer_new
StringBuffer * stringbuffer_new(void)
Definition: stringbuffer.cpp:57
pl
Definition: player.h:105
object_dump_all
void object_dump_all(void)
Definition: object.cpp:704
_key_value::key
const char * key
Definition: object.h:41
object_set_owner
void object_set_owner(object *op, object *owner)
Definition: object.cpp:840
guildjoin.ob
ob
Definition: guildjoin.py:42
START_TEST
START_TEST(test_object_can_merge)
Definition: check_object.cpp:101
object_reset
void object_reset(object *op)
Definition: object.cpp:934
object_copy
void object_copy(const object *src_ob, object *dest_ob)
Definition: object.cpp:1192
object_find_by_tag_global
object * object_find_by_tag_global(tag_t i)
Definition: object.cpp:727
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.cpp:2851
cctk_create_game_object
object * cctk_create_game_object(const char *archname)
Definition: toolkit_common.cpp:105
obj::nrof
uint32_t nrof
Definition: object.h:340
object_clear
void object_clear(object *op)
Definition: object.cpp:983
INS_ABOVE_FLOOR_ONLY
#define INS_ABOVE_FLOOR_ONLY
Definition: object.h:570
stringbuffer.h
stringbuffer_finish
char * stringbuffer_finish(StringBuffer *sb)
Definition: stringbuffer.cpp:76
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.cpp:1560
toolkit_common.h
disinfect.map
map
Definition: disinfect.py:4
obj::name
sstring name
Definition: object.h:317
cctk_setlog
void cctk_setlog(const char *logfile)
Definition: toolkit_common.cpp:64
rotate-tower.result
bool result
Definition: rotate-tower.py:13
teardown
static void teardown(void)
Definition: check_object.cpp:48
object_dump
void object_dump(const object *op, StringBuffer *sb)
Definition: object.cpp:645
add_string
sstring add_string(const char *str)
Definition: shstr.cpp:124
object_count_free
int object_count_free(void)
Definition: object.cpp:1751
CONTAINER
@ CONTAINER
Definition: object.h:234
FLAG_FREED
#define FLAG_FREED
Definition: define.h:233
IS_OBJECT_ACTIVE
#define IS_OBJECT_ACTIVE(op)
Definition: check_object.cpp:474
object_update_speed
void object_update_speed(object *op)
Definition: object.cpp:1349
obj::carrying
int32_t carrying
Definition: object.h:375
obj::x
int16_t x
Definition: object.h:333
INS_BELOW_ORIGINATOR
#define INS_BELOW_ORIGINATOR
Definition: object.h:573
obj::speed
float speed
Definition: object.h:335
setup
static void setup(void)
Definition: check_object.cpp:41
tag_t
uint32_t tag_t
Definition: object.h:12
obj::below
struct obj * below
Definition: object.h:293
object_matches_string
int object_matches_string(object *pl, object *op, const char *name)
Definition: object.cpp:4567
query_refcount
int query_refcount(sstring str)
Definition: shstr.cpp:224
mapdef
Definition: map.h:317
object_insert_in_map_at
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Definition: object.cpp:2098
object_new
object * object_new(void)
Definition: object.cpp:1273
object_insert_in_map
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
Definition: object.cpp:2359
StringBuffer
Definition: stringbuffer.cpp:25
guildbuy.ob2
ob2
Definition: guildbuy.py:23
obj::y
int16_t y
Definition: object.h:333
obj::title
sstring title
Definition: object.h:323
FLAG_REMOVED
#define FLAG_REMOVED
Definition: define.h:232
object_decrease_nrof
object * object_decrease_nrof(object *op, uint32_t i)
Definition: object.cpp:2670
cctk_init_std_archetypes
void cctk_init_std_archetypes(void)
Definition: toolkit_common.cpp:83
obj::type
uint8_t type
Definition: object.h:346
guildbuy.ob1
ob1
Definition: guildbuy.py:22
object_count_used
int object_count_used(void)
Definition: object.cpp:1767
obj::weight
int32_t weight
Definition: object.h:373
item
Definition: item.py:1
object_find_by_name_global
object * object_find_by_name_global(const char *str)
Definition: object.cpp:747
object_split
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
Definition: object.cpp:2631
_key_value
Definition: object.h:40
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
obj::more
struct obj * more
Definition: object.h:301
object_remove_from_active_list
void object_remove_from_active_list(object *op)
Definition: object.cpp:1392
MIN_ACTIVE_SPEED
#define MIN_ACTIVE_SPEED
Definition: define.h:639
loader.h
cctk_set_object_strings
void cctk_set_object_strings(object *op, const char *string)
Definition: toolkit_common.cpp:127
object_remove
void object_remove(object *op)
Definition: object.cpp:1833
_key_value::next
struct _key_value * next
Definition: object.h:43
object_sum_weight
signed long object_sum_weight(object *op)
Definition: object.cpp:568
FLAG_UNPAID
#define FLAG_UNPAID
Definition: define.h:236
_key_value::value
const char * value
Definition: object.h:42
object_copy_owner
void object_copy_owner(object *op, object *clone)
Definition: object.cpp:893
obj::above
struct obj * above
Definition: object.h:294
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.cpp:4492
object_suite
static END_TEST Suite * object_suite(void)
Definition: check_object.cpp:1193
object_sub_weight
void object_sub_weight(object *op, signed long weight)
Definition: object.cpp:1807
object_get_player_container
object * object_get_player_container(object *op)
Definition: object.cpp:607
altar_valkyrie.pl
pl
Definition: altar_valkyrie.py:28
object_replace_insert_in_map
void object_replace_insert_in_map(const char *arch_string, object *op)
Definition: object.cpp:2591
object_can_merge
int object_can_merge(object *ob1, object *ob2)
Definition: object.cpp:433
llevDebug
@ llevDebug
Definition: logger.h:13
obj::inv
struct obj * inv
Definition: object.h:296
FLAG_IDENTIFIED
#define FLAG_IDENTIFIED
Definition: define.h:261