TempusMUD / Tempuscode

Codebase for TempusMUD
http://tempusmud.com/
Other
7 stars 6 forks source link

Fix mass purging of rooms and zones #509

Closed origintempus closed 8 years ago

origintempus commented 8 years ago

This fixes the issue with purging entire rooms or zones. When you use the purge command without arguments, or zpurge, every mob and object in a room, or zone, is supposed to get purged. However, right now it only destroys the first mob in the room, or each room in zpurge.

This is due to a problem with GList and removing an item from the list while iterating through the list at the same time. This is why only the first mob actually gets purged. After the first removal from the list the iteration fails. This fix changes the way the iteration through the room list of mobiles is processed, allowing the next item in the list to be saved before removing the current item.

This fix changes the loop both in do_purge() and in do_zonepurge() to actually go through the entire list of room occupants and purge them.

It should be noted that as this actually makes purging entire rooms work again, when zpurging there will be slight lag with zones that have a large number of occupants.