DG Scripts bug fixes (#44)

* Increase ID space

DG Scripts uses tiny idspace that results in wacky bugs when the mud is
running too long.

* Overhaul script ids

All references to GET_ID(ch/obj) were removed and replaced by
char_script_id() and obj_script_id(), which don’t assign ids until they
are needed. The ch->id and obj->id variable names were changed to
script_id to prevent accidental errors for future programmers. This
change greatly increases how long the mud can run before it runs out of
ID space.

* Fix extraction count

This prevents an error log where it has over-counted the extractions
pending. It now behaves correctly when the same mob is %purge%’d or
extract_char()’d twice.
This commit is contained in:
Paul Clarke 2018-02-15 12:06:35 -07:00 committed by wyld-sw
parent d7a50664ea
commit 41da68bdb0
14 changed files with 182 additions and 125 deletions

View file

@ -330,7 +330,7 @@ static OCMD(do_otransform)
tmpobj.worn_on = obj->worn_on;
tmpobj.in_obj = obj->in_obj;
tmpobj.contains = obj->contains;
tmpobj.id = obj->id;
tmpobj.script_id = obj->script_id;
tmpobj.proto_script = obj->proto_script;
tmpobj.script = obj->script;
tmpobj.next_content = obj->next_content;
@ -491,7 +491,7 @@ static OCMD(do_dgoload)
if (SCRIPT(obj)) { /* It _should_ have, but it might be detached. */
char buf[MAX_INPUT_LENGTH];
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(mob));
sprintf(buf, "%c%ld", UID_CHAR, char_script_id(mob));
add_var(&(SCRIPT(obj)->global_vars), "lastloaded", buf, 0);
}
@ -506,7 +506,7 @@ static OCMD(do_dgoload)
if (SCRIPT(obj)) { /* It _should_ have, but it might be detached. */
char buf[MAX_INPUT_LENGTH];
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(object));
sprintf(buf, "%c%ld", UID_CHAR, obj_script_id(object));
add_var(&(SCRIPT(obj)->global_vars), "lastloaded", buf, 0);
}