--- deliantra/server/common/object.C 2006/09/14 22:33:59 1.47 +++ deliantra/server/common/object.C 2006/09/14 23:13:48 1.48 @@ -450,7 +450,7 @@ for (op = object::first; op != NULL; op = op->next) { dump_object (op); - fprintf (logfile, "Object %d\n:%s\n", op->count, errmsg); + fprintf (logfile, "Object %s\n", errmsg); } } @@ -486,6 +486,7 @@ for (op = object::first; op != NULL; op = op->next) if (op->count == i) break; + return op; } @@ -948,9 +949,6 @@ void object::unlink () { - //count = 0;//D - if (!prev && !next) return;//D - if (this == object::first) object::first = next; @@ -1087,7 +1085,6 @@ object *tmp, *last = 0; object *otmp; - tag_t tag; int check_walk_off; mapstruct *m; @@ -1194,7 +1191,6 @@ if (op->map->in_memory == MAP_SAVING) return; - tag = op->count; check_walk_off = !QUERY_FLAG (op, FLAG_NO_APPLY); for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) @@ -1223,10 +1219,8 @@ { move_apply (tmp, op, NULL); - if (was_destroyed (op, tag)) - { - LOG (llevError, "BUG: remove_ob(): name %s, archname %s destroyed " "leaving object\n", &tmp->name, &tmp->arch->name); - } + if (op->destroyed ()); + LOG (llevError, "BUG: remove_ob(): name %s, archname %s destroyed " "leaving object\n", &tmp->name, &tmp->arch->name); } /* Eneq(@csd.uu.se): Fixed this to skip tmp->above=tmp */ @@ -1935,25 +1929,15 @@ int check_move_on (object *op, object *originator) { - object * - tmp; - tag_t - tag; - mapstruct * - m = op->map; - int - x = op->x, y = op->y; + object *tmp; + mapstruct *m = op->map; + int x = op->x, y = op->y; - MoveType - move_on, - move_slow, - move_block; + MoveType move_on, move_slow, move_block; if (QUERY_FLAG (op, FLAG_NO_APPLY)) return 0; - tag = op->count; - move_on = GET_MAP_MOVE_ON (op->map, op->x, op->y); move_slow = GET_MAP_MOVE_SLOW (op->map, op->x, op->y); move_block = GET_MAP_MOVE_BLOCK (op->map, op->x, op->y); @@ -2023,7 +2007,7 @@ { move_apply (tmp, op, originator); - if (was_destroyed (op, tag)) + if (op->destroyed ()) return 1; /* what the person/creature stepped onto has moved the object @@ -2647,48 +2631,28 @@ prev = tmp; } - /*** copy inventory ***/ for (item = src->inv; item; item = item->below) - { - (void) insert_ob_in_ob (object_create_clone (item), dst); - } + insert_ob_in_ob (object_create_clone (item), dst); return dst; } -/* return true if the object was destroyed, 0 otherwise */ -int -was_destroyed (const object *op, tag_t old_tag) -{ - /* checking for FLAG_FREED isn't necessary, but makes this function more - * robust */ - return op->count != old_tag || QUERY_FLAG (op, FLAG_FREED); -} - /* GROS - Creates an object using a string representing its content. */ - /* Basically, we save the content of the string to a temp file, then call */ - /* load_object on it. I admit it is a highly inefficient way to make things, */ - /* but it was simple to make and allows reusing the load_object function. */ - /* Remember not to use load_object_str in a time-critical situation. */ - /* Also remember that multiparts objects are not supported for now. */ object * load_object_str (const char *obstr) { - object * - op; - char - filename[MAX_BUF]; + object *op; + char filename[MAX_BUF]; sprintf (filename, "%s/cfloadobstr2044", settings.tmpdir); - FILE * - tempfile = fopen (filename, "w"); + FILE *tempfile = fopen (filename, "w"); if (tempfile == NULL) { @@ -2719,8 +2683,7 @@ object * find_obj_by_type_subtype (const object *who, int type, int subtype) { - object * - tmp; + object *tmp; for (tmp = who->inv; tmp; tmp = tmp->below) if (tmp->type == type && tmp->subtype == subtype) @@ -2738,16 +2701,11 @@ key_value * get_ob_key_link (const object *ob, const char *key) { - key_value * - link; + key_value *link; for (link = ob->key_values; link != NULL; link = link->next) - { - if (link->key == key) - { - return link; - } - } + if (link->key == key) + return link; return NULL; }