mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-23 18:50:13 +01:00
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:
parent
d7a50664ea
commit
41da68bdb0
14 changed files with 182 additions and 125 deletions
|
|
@ -379,7 +379,7 @@ ACMD(do_mload)
|
|||
char_to_room(mob, rnum);
|
||||
if (SCRIPT(ch)) { /* 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(ch)->global_vars), "lastloaded", buf, 0);
|
||||
}
|
||||
load_mtrigger(mob);
|
||||
|
|
@ -392,7 +392,7 @@ ACMD(do_mload)
|
|||
}
|
||||
if (SCRIPT(ch)) { /* 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(ch)->global_vars), "lastloaded", buf, 0);
|
||||
}
|
||||
/* special handling to make objects able to load on a person/in a container/worn etc. */
|
||||
|
|
@ -821,7 +821,7 @@ ACMD(do_mremember)
|
|||
}
|
||||
|
||||
/* fill in the structure */
|
||||
mem->id = GET_ID(victim);
|
||||
mem->id = char_script_id(victim);
|
||||
if (argument && *argument) {
|
||||
mem->cmd = strdup(argument);
|
||||
}
|
||||
|
|
@ -865,7 +865,7 @@ ACMD(do_mforget)
|
|||
mem = SCRIPT_MEM(ch);
|
||||
prev = NULL;
|
||||
while (mem) {
|
||||
if (mem->id == GET_ID(victim)) {
|
||||
if (mem->id == char_script_id(victim)) {
|
||||
if (mem->cmd) free(mem->cmd);
|
||||
if (prev==NULL) {
|
||||
SCRIPT_MEM(ch) = mem->next;
|
||||
|
|
@ -950,7 +950,7 @@ ACMD(do_mtransform)
|
|||
if(m->player.description)
|
||||
tmpmob.player.description = strdup(m->player.description);
|
||||
|
||||
tmpmob.id = ch->id;
|
||||
tmpmob.script_id = ch->script_id;
|
||||
tmpmob.affected = ch->affected;
|
||||
tmpmob.carrying = ch->carrying;
|
||||
tmpmob.proto_script = ch->proto_script;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue