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

@ -990,18 +990,24 @@ void extract_char_final(struct char_data *ch)
* trivial workaround of 'vict = next_vict' doesn't work if the _next_ person
* in the list gets killed, for example, by an area spell. Why do we leave them
* on the character_list? Because code doing 'vict = vict->next' would get
* really confused otherwise. */
* really confused otherwise.
*
* Fixed a bug where it would over-count extractions if you try to extract the
* same character twice (e.g. double-purging in a script) -khufu / EmpireMUD
*/
void extract_char(struct char_data *ch)
{
char_from_furniture(ch);
clear_char_event_list(ch);
if (IS_NPC(ch))
if (IS_NPC(ch) && !MOB_FLAGGED(ch, MOB_NOTDEADYET)) {
SET_BIT_AR(MOB_FLAGS(ch), MOB_NOTDEADYET);
else
++extractions_pending;
}
else if (!IS_NPC(ch) && !PLR_FLAGGED(ch, PLR_NOTDEADYET)) {
SET_BIT_AR(PLR_FLAGS(ch), PLR_NOTDEADYET);
extractions_pending++;
++extractions_pending;
}
}
/* I'm not particularly pleased with the MOB/PLR hoops that have to be jumped