void remove_object_hash(struct object *ob) { struct object * s; int h = ObjHash(ob->name); s = find_obj_n(ob->name); if (s != ob) fatal("Remove object \"%s\": found a different object!\n", ob->name); obj_table[h] = ob->next_hash; ob->next_hash = 0; objs_in_table--; if (ob->flags & O_CLONE) ob->prog->num_clones--; if (ob->prog->clones == ob) { if (ob->next_all->prog == ob->prog && ob->next_all->flags & O_CLONE && ob->next_all != ob) ob->prog->clones = ob->next_all; else ob->prog->clones = NULL; } if (ob->next_all == ob) obj_list = NULL; else if (ob == obj_list) obj_list = ob->next_all; ob->prev_all->next_all = ob->next_all; ob->next_all->prev_all = ob->prev_all; }
struct object * lookup_object_hash(char *s) { struct object * ob = find_obj_n(s); user_obj_lookups++; if (ob) user_obj_found++; return(ob); }
void remove_object_hash P1(struct object *, ob) { int h = ObjHash(ob->name); struct object *s; s = find_obj_n(ob->name); DEBUG_CHECK1(s != ob, "Remove object \"%s\": found a different object!", ob->name); obj_table[h] = ob->next_hash; ob->next_hash = 0; objs_in_table--; return; }
void enter_object_hash(struct object *ob) { struct object *s, *sibling; int h = ObjHash(ob->name); /* Add to object list */ if (ob->flags & O_CLONE && ob->prog->clones) { sibling = ob->prog->clones; ob->next_all = sibling; ob->prev_all = sibling->prev_all; sibling->prev_all->next_all = ob; sibling->prev_all = ob; if (sibling == obj_list) obj_list = ob; } else if (obj_list) { ob->next_all = obj_list; ob->prev_all = obj_list->prev_all; obj_list->prev_all->next_all = ob; obj_list->prev_all = ob; obj_list = ob; } else obj_list = ob->next_all = ob->prev_all = ob; if (ob->flags & O_CLONE) { ob->prog->clones = ob; ob->prog->num_clones++; } s = find_obj_n(ob->name); if (s) { if (s != ob) fatal("Duplicate object \"%s\" in object hash table\n", ob->name); else fatal("Entering object \"%s\" twice in object table\n", ob->name); } if (ob->next_hash) fatal("Object \"%s\" not found in object table but next link not null\n", ob->name); ob->next_hash = obj_table[h]; obj_table[h] = ob; objs_in_table++; }
void enter_object_hash P1(struct object *, ob) { int h = ObjHash(ob->name); IF_DEBUG(struct object *s); IF_DEBUG(s = find_obj_n(ob->name)); DEBUG_CHECK1(s && s != ob, "Duplicate object \"%s\" in object hash table", ob->name); DEBUG_CHECK1(s, "Entering object \"%s\" twice in object table", ob->name); DEBUG_CHECK1(ob->next_hash, "Object \"%s\" not found in object table but next link not null", ob->name); ob->next_hash = obj_table[h]; obj_table[h] = ob; objs_in_table++; return; }